[−][src]Struct dofus_stuff::character::Character
Fields
item_slots: Vec<ItemSlot<'static, 'i>>
base_stats: HashMap<&'i CaracKind, u16>
unspent: u16
Methods
impl<'i> Character<'i>
[src]
pub fn new(level: u8, sets: &'i HashMap<u64, Set>) -> Self
[src]
pub fn iter_items(&self) -> impl Iterator<Item = &Equipement>
[src]
Iterator over items currently equiped.
pub fn get_caracs(&self) -> RawCaracs
[src]
pub fn iter_set_synergies(&self) -> impl Iterator<Item = (u64, u8)>
[src]
pub fn carac_cost_from_zero(kind: &CaracKind, val: u16) -> u16
[src]
Compute the number of points to spend to reach a value for an initially zero characteristic.
val
must be positive.
Examples
use dofus_stuff::character::*; use dofus_stuff::dofapi::{CaracKind::*, Element::*}; assert_eq!(Character::carac_cost_from_zero(&Wisdom, 100), 300); assert_eq!(Character::carac_cost_from_zero(&Stats(Air), 100), 100); assert_eq!(Character::carac_cost_from_zero(&Stats(Air), 150), 200);
pub fn carac_spend_cost(&self, kind: &CaracKind, amount: u16) -> u16
[src]
Compute the number of points to spend to increase a characteristic.
Examples
use dofus_stuff::character::*; use dofus_stuff::dofapi::{CaracKind::*, Element::*}; let db_sets = HashMap::new(); let mut character = Character::new(200, &db_sets); assert_eq!(character.carac_spend_cost(&Stats(Air), 100), 100); assert_eq!(character.carac_spend_cost(&Stats(Air), 150), 200); character.carac_spend(&Stats(Air), 100).unwrap(); assert_eq!(character.carac_spend_cost(&Stats(Air), 50), 100); assert_eq!(character.carac_spend_cost(&Stats(Air), 150), 350);
pub fn carac_unspend_recover(
&self,
kind: &'i CaracKind,
amount: u16
) -> Result<u16, CharacterError<'i>>
[src]
&self,
kind: &'i CaracKind,
amount: u16
) -> Result<u16, CharacterError<'i>>
Compute the number of points recovered by decreasing a characteristic.
Examples
use dofus_stuff::character::*; use dofus_stuff::dofapi::{CaracKind::*, Element::*}; let db_sets = HashMap::new(); let mut character = Character::new(200, &db_sets); character.carac_spend(&Stats(Air), 200).unwrap(); assert_eq!(character.carac_unspend_recover(&Stats(Air), 100), Ok(200)); assert_eq!(character.carac_unspend_recover(&Stats(Air), 200), Ok(300)); assert!(character.carac_unspend_recover(&Stats(Air), 201).is_err());
pub fn carac_spend(
&mut self,
kind: &'i CaracKind,
amount: u16
) -> Result<(), CharacterError>
[src]
&mut self,
kind: &'i CaracKind,
amount: u16
) -> Result<(), CharacterError>
Try to spend points to increase characteristic.
Examples
use dofus_stuff::character::*; use dofus_stuff::dofapi::{CaracKind::*, Element::*}; let db_sets = HashMap::new(); let mut character = Character::new(200, &db_sets); assert!(character.carac_spend(&Stats(Air), 100).is_ok()); assert!(character.carac_spend(&Stats(Air), 400).is_err());
pub fn carac_unspend(
&mut self,
kind: &'i CaracKind,
amount: u16
) -> Result<(), CharacterError>
[src]
&mut self,
kind: &'i CaracKind,
amount: u16
) -> Result<(), CharacterError>
Try to recover points by decreasing a characteristic.
Examples
use dofus_stuff::character::*; use dofus_stuff::dofapi::{CaracKind::*, Element::*}; let db_sets = HashMap::new(); let mut character = Character::new(200, &db_sets); character.carac_spend(&Stats(Air), 200).unwrap(); assert_eq!(character.carac_unspend(&Stats(Air), 100), Ok(())); assert_eq!(character.carac_unspend(&Stats(Air), 99), Ok(())); assert!(character.carac_unspend(&Stats(Air), 201).is_err());
pub fn carac_spend_or_seek(
&mut self,
kind: &'i CaracKind,
amount: u16,
seek_from: &'i CaracKind
) -> Result<(), CharacterError>
[src]
&mut self,
kind: &'i CaracKind,
amount: u16,
seek_from: &'i CaracKind
) -> Result<(), CharacterError>
Try to spend points to increase a characteristic, if there is not enough unspent points, try to seek points from another characteristic.
Returns Character::NotEnoughCaracs(seek_from) if it is not possible to find enough points to increase properly this stat.
Examples
use dofus_stuff::character::*; use dofus_stuff::dofapi::{CaracKind::*, Element::*}; let db_sets = HashMap::new(); let mut character = Character::new(200, &db_sets); // Seek from unspent points assert!( character .carac_spend_or_seek(&Stats(Air), 150, &Wisdom) .is_ok() ); assert!( character .carac_spend_or_seek(&Vitality, 795, &Wisdom) .is_ok() ); // Seek from another carac assert!( character .carac_spend_or_seek(&Vitality, 200, &Stats(Air)) .is_ok() ); assert!( character .carac_spend_or_seek(&Vitality, 1, &Stats(Air)) .is_err() );
pub fn all_conditions(&self) -> Condition
[src]
Return a condition equivalent to the union of all item's conditions.
pub fn condition_overflow(&self, cond: &Condition) -> f64
[src]
Compute an approximate smithmage weight value required to complie to a condition.
pub fn count_item_conflicts(&self) -> u8
[src]
Trait Implementations
Auto Trait Implementations
impl<'i> Send for Character<'i>
impl<'i> Unpin for Character<'i>
impl<'i> Sync for Character<'i>
impl<'i> UnwindSafe for Character<'i>
impl<'i> RefUnwindSafe for Character<'i>
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,