Expand description
D&D 5e types and common mechanics.
This crate provides types and common mechanics used in Dungeons & Dragons 5th Edition (D&D 5e).
§Getting Started
To use this crate, add it to your Cargo.toml file:
[dependencies.dnd]
version = "0.1"You can then import the necessary modules in your Rust code:
use dnd::core::{AbilityScore, AbilityModifier, Level, ProficiencyBonus};
let strength = AbilityScore::new(16);
let modifier = AbilityModifier::from(strength);
let level = Level::new(5);
let proficiency_bonus = ProficiencyBonus::from(level);
assert_eq!(modifier.value(), 3);
assert_eq!(proficiency_bonus.value(), 3);§Features
It is compatible with no_std environments, making it suitable for embedded systems:
[dependencies.dnd]
version = "0.1"
default-features = falseModules§
- core
- A dependency-free foundation of
dnd.