Skip to main content

MonsterSheet

Struct MonsterSheet 

Source
pub struct MonsterSheet {
Show 30 fields pub name: String, pub size: String, pub kind: String, pub alignment: String, pub armor_class: u8, pub armor: String, pub hit_points: u16, pub hit_dice: String, pub speed: String, pub ability_scores: AbilityScores, pub initiative: Option<i8>, pub saving_throws: BTreeMap<Ability, i8>, pub skills: BTreeMap<Skill, i8>, pub damage_vulnerabilities: Vec<String>, pub damage_resistances: Vec<String>, pub damage_immunities: Vec<String>, pub condition_immunities: Vec<String>, pub senses: String, pub languages: String, pub challenge: String, pub xp: u32, pub proficiency_bonus: i8, pub traits: Vec<Feature>, pub actions: Vec<Feature>, pub bonus_actions: Vec<Feature>, pub reactions: Vec<Feature>, pub legendary_actions: Vec<Feature>, pub source: String, pub edition: Option<Edition>, pub notes: String,
}
Expand description

A full stat block. Everything but the name has a default, so a file needs only what the monster actually has.

Fields§

§name: String§size: String

“Medium”, “Large”…

§kind: String

The creature type: “humanoid (goblinoid)”, “dragon”…

§alignment: String§armor_class: u8§armor: String

What the AC comes from: “leather armor, shield”.

§hit_points: u16

The average, as printed.

§hit_dice: String

The hit dice, e.g. “2d6” or “18d10+36”; empty if there are none.

§speed: String

“30 ft., fly 60 ft.”

§ability_scores: AbilityScores§initiative: Option<i8>

Overrides the Dexterity modifier (2024 stat blocks print it).

§saving_throws: BTreeMap<Ability, i8>

Saving throw bonuses that differ from the plain modifier.

§skills: BTreeMap<Skill, i8>§damage_vulnerabilities: Vec<String>§damage_resistances: Vec<String>§damage_immunities: Vec<String>§condition_immunities: Vec<String>§senses: String

“darkvision 60 ft., passive Perception 9”

§languages: String§challenge: String

The challenge rating as printed: “0”, “1/8”, “1/4”, “1/2”, “1”…

§xp: u32§proficiency_bonus: i8§traits: Vec<Feature>§actions: Vec<Feature>§bonus_actions: Vec<Feature>§reactions: Vec<Feature>§legendary_actions: Vec<Feature>§source: String

Where it’s from: “SRD 5.1”, “SRD 5.2”, “Homebrew”…

§edition: Option<Edition>

The rules it’s written for; None suits either.

§notes: String

Implementations§

Source§

impl MonsterSheet

Source

pub fn validate(&self) -> Result<(), MonsterError>

Checks the stat block: a name, hit points, hit dice that can be read, and ability scores from 1 to 30.

Source

pub fn hit_dice(&self) -> Option<HitDice>

Its hit dice, if it has any that can be read (8d10+40).

Source

pub fn max_hit_points(&self) -> u16

The most hit points it can have: its hit dice’s maximum, or the printed number if it has no hit dice.

Source

pub fn experience_points(&self) -> u32

Its experience points, from its challenge rating if not given.

Source

pub fn initiative_modifier(&self) -> i8

What it adds to initiative: initiative if given, otherwise its Dexterity modifier.

Source

pub fn challenge_value(&self) -> f32

The challenge rating as a number, for sorting: “1/4” is 0.25.

Source

pub fn suits(&self, edition: Edition) -> bool

Whether a campaign playing by edition should see it.

Trait Implementations§

Source§

impl Clone for MonsterSheet

Source§

fn clone(&self) -> MonsterSheet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ComposeSchema for MonsterSheet

Source§

fn compose(generics: Vec<RefOr<Schema>>) -> RefOr<Schema>

Source§

impl Debug for MonsterSheet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MonsterSheet

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for MonsterSheet

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for MonsterSheet

Source§

fn eq(&self, other: &MonsterSheet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for MonsterSheet

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToSchema for MonsterSheet

Source§

fn name() -> Cow<'static, str>

Return name of the schema. Read more
Source§

fn schemas(schemas: &mut Vec<(String, RefOr<Schema>)>)

Implement reference [utoipa::openapi::schema::Schema]s for this type. Read more
Source§

impl Eq for MonsterSheet

Source§

impl StructuralPartialEq for MonsterSheet

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PartialSchema for T
where T: ComposeSchema + ?Sized,

§

fn schema() -> RefOr<Schema>

Return ref or schema of implementing type that can then be used to construct combined schemas.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,