Premade

Trait Premade 

Source
pub trait Premade {
Show 46 methods // Required methods fn stat(&self) -> Stats; fn set_hp(&mut self, amount: f64); fn set_mp(&mut self, amount: f64); fn set_xp(&mut self, amount: f64); fn set_hp_max(&mut self, amount: f64); fn set_mp_max(&mut self, amount: f64); fn set_xp_next(&mut self, amount: f64); fn set_gp(&mut self, amount: f64); fn set_atk(&mut self, amount: f64); fn set_def(&mut self, amount: f64); fn set_m_atk(&mut self, amount: f64); fn set_m_def(&mut self, amount: f64); fn set_level(&mut self, amount: f64); fn set_speed(&mut self, amount: f64); // Provided methods fn id(&self) -> f64 { ... } fn hp(&self) -> f64 { ... } fn mp(&self) -> f64 { ... } fn xp(&self) -> f64 { ... } fn hp_max(&self) -> f64 { ... } fn mp_max(&self) -> f64 { ... } fn xp_next(&self) -> f64 { ... } fn level(&self) -> f64 { ... } fn speed(&self) -> f64 { ... } fn gp(&self) -> f64 { ... } fn atk(&self) -> f64 { ... } fn def(&self) -> f64 { ... } fn m_atk(&self) -> f64 { ... } fn m_def(&self) -> f64 { ... } fn add_atk(&mut self, amount: f64) { ... } fn add_def(&mut self, amount: f64) { ... } fn add_m_atk(&mut self, amount: f64) { ... } fn add_m_def(&mut self, amount: f64) { ... } fn add_xp(&mut self, amount: f64) { ... } fn add_hp_max(&mut self, amount: f64) { ... } fn add_mp_max(&mut self, amount: f64) { ... } fn add_level(&mut self, amount: f64) { ... } fn add_speed(&mut self, amount: f64) { ... } fn damage(&mut self, amount: f64) { ... } fn heal(&mut self, amount: f64) { ... } fn attack_stable(&self, other: Stats) -> f64 { ... } fn attack(&self, other: Stats) -> f64 { ... } fn buy(&mut self, price: f64) -> bool { ... } fn earn(&mut self, price: f64) { ... } fn next(&self) -> f64 { ... } fn stats_vec(&self) -> Vec<f64> { ... } fn level_up(&mut self) -> bool { ... }
}

Required Methods§

Source

fn stat(&self) -> Stats

§Function you need to imlement

stat returns the Stats you created

Source

fn set_hp(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Health Points

Source

fn set_mp(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Mana Points

Source

fn set_xp(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Experience Points

Source

fn set_hp_max(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Max Health Points

Source

fn set_mp_max(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Max Mana Points

Source

fn set_xp_next(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Next Experience Points

Source

fn set_gp(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Gold Points

Source

fn set_atk(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Attack Points

Source

fn set_def(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Defense Points

Source

fn set_m_atk(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Mana Attack Points

Source

fn set_m_def(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Mana Defense Points

Source

fn set_level(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Level

Source

fn set_speed(&mut self, amount: f64)

§Function you need to imlement

Set the Stats Level

Provided Methods§

Source

fn id(&self) -> f64

Return the Stats id number

Source

fn hp(&self) -> f64

Return the Stats Health Points

Source

fn mp(&self) -> f64

Return the Stats Mana Points

Source

fn xp(&self) -> f64

Return the Stats Experience Points

Source

fn hp_max(&self) -> f64

Return the Stats Max Health Points

Source

fn mp_max(&self) -> f64

Return the Stats Max Mana Points

Source

fn xp_next(&self) -> f64

Return the Stats Next Experience Points

Source

fn level(&self) -> f64

Return the Stats Level

Source

fn speed(&self) -> f64

Return the Stats Speed

Source

fn gp(&self) -> f64

Return the Stats Gold Points

Source

fn atk(&self) -> f64

Return the Stats Attack Points

Source

fn def(&self) -> f64

Return the Stats Defense Points

Source

fn m_atk(&self) -> f64

Return the Stats Mana Attack Points

Source

fn m_def(&self) -> f64

Return the Stats Mana Defense Points

Source

fn add_atk(&mut self, amount: f64)

Return the Stats Attack Points

Source

fn add_def(&mut self, amount: f64)

Return the Stats Defense Points

Source

fn add_m_atk(&mut self, amount: f64)

Return the Stats Mana Attack Points

Source

fn add_m_def(&mut self, amount: f64)

Return the Stats Mana Defense Points

Source

fn add_xp(&mut self, amount: f64)

Return the Stats Experience Points

Source

fn add_hp_max(&mut self, amount: f64)

Return the Stats Max Health Points

Source

fn add_mp_max(&mut self, amount: f64)

Return the Stats Max Mana Points

Source

fn add_level(&mut self, amount: f64)

Return the Stats Level

Source

fn add_speed(&mut self, amount: f64)

Return the Stats Speed

Source

fn damage(&mut self, amount: f64)

Damage the character by an amount

Source

fn heal(&mut self, amount: f64)

Add health to character but not beyond their Max Healh Points

Source

fn attack_stable(&self, other: Stats) -> f64

Stable attack forumla attack*(100/(100+defense))

Source

fn attack(&self, other: Stats) -> f64

Scalable attack forumla damage = att * att / (att + def)

Source

fn buy(&mut self, price: f64) -> bool

Source

fn earn(&mut self, price: f64)

Source

fn next(&self) -> f64

Get the next amount of XP needed to level up

Source

fn stats_vec(&self) -> Vec<f64>

a vector of stats used to get the standard deviation

Source

fn level_up(&mut self) -> bool

Implementors§