Struct Stats

Source
pub struct Stats {
Show 43 fields pub id: u32, pub name: String, pub form: Stage, pub condition: Normal, pub element1: Normal, pub element2: Advanced, pub rate: Rate, pub owner: u32, pub xp: f64, pub total_xp: f64, pub hp_xp: f64, pub atk_xp: f64, pub def_xp: f64, pub speed_xp: f64, pub special_xp: f64, pub level: f64, pub hp_max: f64, pub hp: f64, pub atk: f64, pub def: f64, pub speed: f64, pub special: f64, pub image: String, pub move0: Normal, pub move0_mp: f64, pub move1: Normal, pub move1_mp: f64, pub move2: Normal, pub move2_mp: f64, pub move3: Normal, pub move3_mp: f64, pub move4: Normal, pub move4_mp: f64, pub item0: Normal, pub items0: f64, pub item1: Normal, pub items1: f64, pub item2: Normal, pub items2: f64, pub item3: Normal, pub items3: f64, pub item4: Normal, pub items4: f64,
}

Fields§

§id: u32

Identification number

§name: String

Name of creature

§form: Stage

Current Stage

§condition: Normal

Current status/ailment condition

§element1: Normal

Normal element type

§element2: Advanced

Advanced element type

§rate: Rate

The rate of occurrence, or rate of success

§owner: u32

this is the owner’s id

§xp: f64

level cycle xp (for display)

§total_xp: f64

Total XP

§hp_xp: f64

Experience points for leveling Health Points

§atk_xp: f64

Experience points for leveling Attack

§def_xp: f64

Experience points for leveling Defense

§speed_xp: f64

Experience points for leveling Speed

§special_xp: f64

Experience points for leveling Special

§level: f64

Current level

§hp_max: f64

Maximum Health Points

§hp: f64

Current Health Points

§atk: f64

Attack power

§def: f64

Defense capability

§speed: f64

Speed of creature in battle, or as they move

§special: f64
§image: String

Putting a file name here generates a picture

§move0: Normal§move0_mp: f64

Mana Points for Special move 0

§move1: Normal§move1_mp: f64

Mana Points for Special move 1

§move2: Normal§move2_mp: f64

Mana Points for Special move 2

§move3: Normal§move3_mp: f64

Mana Points for Special move 3

§move4: Normal§move4_mp: f64

Mana Points for Special move 4

§item0: Normal§items0: f64

Number of items in slot 0

§item1: Normal§items1: f64

Number of items in slot 1

§item2: Normal§items2: f64

Number of items in slot 2

§item3: Normal§items3: f64

Number of items in slot 3

§item4: Normal§items4: f64

Number of items in slot 4

Implementations§

Source§

impl Stats

Source

pub fn check_capture(&self) -> bool

Source

pub fn check_encounter(&self) -> bool

Source

pub fn heal(&mut self, value: f64) -> bool

Source

pub fn next(&self) -> f64

Source

pub fn level_up(&mut self)

Source

pub fn new() -> Self

Source

pub fn use_mp(&mut self, move_number: u32) -> bool

Source

pub fn get_mp(&self, move_number: u32) -> f64

Source

pub fn restore_mp(&mut self, move_number: u32, value: f64) -> bool

Source

pub fn moves(&self) -> Vec<Special>

Source

pub fn add_move(&mut self, special: Special) -> bool

Source

pub fn remove_move(&mut self, move_number: u32) -> bool

Source

pub fn get_move(&self, move_number: u32) -> Special

Source

pub fn valid_move(&self, move_number: u32) -> bool

Source

pub fn damage_attack(&mut self, atk_move: Special) -> f64

Source

pub fn special(&mut self, id: usize, other: Stats) -> Option<f64>

Source

pub fn items(&self) -> Vec<MyItem>

Source

pub fn add_item(&mut self, special: MyItem) -> bool

Source

pub fn remove_item(&mut self, item_number: u32) -> bool

Source

pub fn get_item(&self, item_number: u32) -> MyItem

Source

pub fn use_item(&mut self, item_number: u32) -> bool

Trait Implementations§

Source§

impl Clone for Stats

Source§

fn clone(&self) -> Stats

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Stats

Source§

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

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

impl Default for Stats

Source§

fn default() -> Self
where Self: Sized,

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

impl<'de> Deserialize<'de> for Stats

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 Stats

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 Random for Stats

Source§

type Type = Stats

Source§

fn random_type(&self) -> Self::Type

Source§

fn random_rate(&self, value: u32) -> u32

Source§

fn random(&self, min: f64, max: f64) -> f64

Source§

fn half(&self) -> bool

Source§

fn usually(&self) -> bool

Source§

fn often(&self) -> bool

Source§

fn hardly(&self) -> bool

Source§

fn barely(&self) -> bool

Source§

impl Serialize for Stats

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 StructuralPartialEq for Stats

Auto Trait Implementations§

§

impl Freeze for Stats

§

impl RefUnwindSafe for Stats

§

impl Send for Stats

§

impl Sync for Stats

§

impl Unpin for Stats

§

impl UnwindSafe for Stats

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
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.

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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