pub struct Character {Show 21 fields
pub id: u32,
pub name: String,
pub race: String,
pub class: String,
pub subclass: String,
pub level: u32,
pub experience: u64,
pub stats: CharacterStats,
pub max_hp: i32,
pub current_hp: i32,
pub temp_hp: i32,
pub armor_class: i32,
pub proficiency_bonus: i32,
pub speed_m: f32,
pub alignment: String,
pub background: String,
pub known_spells: Vec<u32>,
pub spell_slots: Vec<(u32, u32)>,
pub features: Vec<String>,
pub equipment_ids: Vec<u32>,
pub gold: f32,
}Fields§
§id: u32§name: String§race: String§class: String§subclass: String§level: u32§experience: u64§stats: CharacterStats§max_hp: i32§current_hp: i32§temp_hp: i32§armor_class: i32§proficiency_bonus: i32§speed_m: f32§alignment: String§background: String§known_spells: Vec<u32>§spell_slots: Vec<(u32, u32)>§features: Vec<String>§equipment_ids: Vec<u32>§gold: f32Implementations§
Source§impl Character
impl Character
pub fn new(id: u32, name: &str) -> Self
pub fn is_alive(&self) -> bool
pub fn is_unconscious(&self) -> bool
pub fn heal(&mut self, amount: i32)
pub fn take_damage(&mut self, amount: i32)
pub fn initiative_roll(&self, dice_roll: u32) -> i32
pub fn passive_perception(&self) -> i32
pub fn xp_to_next_level(&self) -> u64
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Character
impl RefUnwindSafe for Character
impl Send for Character
impl Sync for Character
impl Unpin for Character
impl UnsafeUnpin for Character
impl UnwindSafe for Character
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.