pub struct CharacterSheet {Show 17 fields
pub name: String,
pub player_name: Option<String>,
pub race: String,
pub background: String,
pub alignment: String,
pub classes: Vec<ClassLevel>,
pub experience_points: u32,
pub ability_scores: AbilityScores,
pub hit_points: HitPoints,
pub armor_class: u8,
pub speed: u16,
pub saving_throw_proficiencies: Vec<Ability>,
pub skill_proficiencies: Vec<Skill>,
pub inventory: Vec<Item>,
pub spellcasting: Spellcasting,
pub resources: Vec<Resource>,
pub notes: String,
}Expand description
The editable contents of a character sheet. This is the request body for both creating and replacing a character.
Fields§
§name: String§player_name: Option<String>§race: String§background: String§alignment: String§classes: Vec<ClassLevel>§experience_points: u32§ability_scores: AbilityScores§hit_points: HitPoints§armor_class: u8§speed: u16§saving_throw_proficiencies: Vec<Ability>§skill_proficiencies: Vec<Skill>§inventory: Vec<Item>§spellcasting: Spellcasting§resources: Vec<Resource>Limited-use class features and abilities (Action Surge, Rage, Ki…).
notes: StringImplementations§
Source§impl CharacterSheet
impl CharacterSheet
Sourcepub fn apply(&mut self, action: &CharacterAction) -> Result<(), ActionError>
pub fn apply(&mut self, action: &CharacterAction) -> Result<(), ActionError>
Applies an action. On error the sheet is left unchanged.
Source§impl CharacterSheet
impl CharacterSheet
Sourcepub fn total_level(&self) -> u8
pub fn total_level(&self) -> u8
Sum of all class levels (at least 1 for display purposes when empty).
Sourcepub fn proficiency_bonus(&self) -> i8
pub fn proficiency_bonus(&self) -> i8
The proficiency bonus for the character’s total level.
Sourcepub fn saving_throw(&self, ability: Ability) -> i8
pub fn saving_throw(&self, ability: Ability) -> i8
The bonus to a saving throw: the ability’s modifier, plus proficiency if proficient.
Sourcepub fn skill_bonus(&self, skill: Skill) -> i8
pub fn skill_bonus(&self, skill: Skill) -> i8
The bonus to a skill check: its ability’s modifier, plus proficiency if proficient.
Sourcepub fn spell_save_dc(&self, ability: Ability) -> i8
pub fn spell_save_dc(&self, ability: Ability) -> i8
The spell save DC when casting with ability: 8 + proficiency + modifier.
Sourcepub fn spell_attack_bonus(&self, ability: Ability) -> i8
pub fn spell_attack_bonus(&self, ability: Ability) -> i8
The spell attack bonus when casting with ability: proficiency + modifier.
Sourcepub fn validate(&self) -> Result<(), ValidationError>
pub fn validate(&self) -> Result<(), ValidationError>
Validates rules that serde can’t express. Shared by server and clients so frontends can give immediate feedback.
Source§impl CharacterSheet
impl CharacterSheet
Sourcepub fn derive_slots(&mut self, edition: Edition)
pub fn derive_slots(&mut self, edition: Edition)
Sets the spell slots (and Pact Magic) the classes give, under the
campaign’s edition. Slots already spent stay spent, up to the new
number.
Trait Implementations§
Source§impl Clone for CharacterSheet
impl Clone for CharacterSheet
Source§fn clone(&self) -> CharacterSheet
fn clone(&self) -> CharacterSheet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ComposeSchema for CharacterSheet
impl ComposeSchema for CharacterSheet
Source§impl Debug for CharacterSheet
impl Debug for CharacterSheet
Source§impl Default for CharacterSheet
impl Default for CharacterSheet
Source§impl<'de> Deserialize<'de> for CharacterSheetwhere
CharacterSheet: Default,
impl<'de> Deserialize<'de> for CharacterSheetwhere
CharacterSheet: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for CharacterSheet
impl PartialEq for CharacterSheet
Source§fn eq(&self, other: &CharacterSheet) -> bool
fn eq(&self, other: &CharacterSheet) -> bool
self and other values to be equal, and is used by ==.