pub struct Combatant {
pub id: Uuid,
pub name: String,
pub character_id: Option<Uuid>,
pub monster_id: Option<Uuid>,
pub initiative_modifier: i8,
pub initiative: Option<i16>,
pub hit_points: HitPoints,
pub armor_class: Option<u8>,
pub concealed: bool,
}Expand description
Anyone in a combat: a character, a monster, or anyone else the DM adds.
Fields§
§id: UuidChosen by the client that adds the combatant, so it can predict the outcome exactly. The server rejects duplicates.
name: String§character_id: Option<Uuid>Set when this combatant is a character from the character service.
monster_id: Option<Uuid>Set when this combatant is a monster from the monster service, so its stat block can be shown.
initiative_modifier: i8§initiative: Option<i16>Initiative total. None until rolled or set.
hit_points: HitPointsWhile Self::concealed, only how hurt it looks: see Vitality.
armor_class: Option<u8>§concealed: boolIts hit points and armor class are behind the DM’s screen: a
player’s device sees monsters like this (see view).
Implementations§
Source§impl Combatant
impl Combatant
Sourcepub fn new(name: impl Into<String>, max_hp: u16) -> Self
pub fn new(name: impl Into<String>, max_hp: u16) -> Self
A combatant at full hit points, with no initiative yet.
Sourcepub fn from_character(character: &Character) -> Self
pub fn from_character(character: &Character) -> Self
A combatant for a character sheet, using its current HP, AC and Dexterity modifier.
Sourcepub fn from_monster(monster: &Monster, name: String, hit_points: u16) -> Self
pub fn from_monster(monster: &Monster, name: String, hit_points: u16) -> Self
A combatant for a monster, called name (e.g. “Goblin 2”), with
hit_points (its maximum, or rolled).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Combatant
impl<'de> Deserialize<'de> for Combatant
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>,
impl Eq for Combatant
impl StructuralPartialEq for Combatant
Auto Trait Implementations§
impl Freeze for Combatant
impl RefUnwindSafe for Combatant
impl Send for Combatant
impl Sync for Combatant
impl Unpin for Combatant
impl UnsafeUnpin for Combatant
impl UnwindSafe for Combatant
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.