Skip to main content

LevelUp

Struct LevelUp 

Source
pub struct LevelUp<P: MonsterProvider> {
    pub levels_gained: u8,
    pub old_level: u8,
    pub new_level: u8,
    pub learned_moves: Vec<P::MoveId>,
}
Expand description

Result of an EXP gain: what happened to the monster’s level.

Parameterized by the MonsterProvider only so it can carry the game’s opaque move ids in Self::learned_moves; the engine never inspects them.

Fields§

§levels_gained: u8

How many levels were gained (0 if none).

§old_level: u8

Level before the EXP was applied.

§new_level: u8

Level after the EXP was applied.

§learned_moves: Vec<P::MoveId>

Moves newly learned across the levels crossed, in ascending-level order (populated by ExpProvider::learn_moves_on_levelup; empty by default).

Implementations§

Source§

impl<P: MonsterProvider> LevelUp<P>

Source

pub fn gained(&self) -> bool

Whether any level was gained.

Trait Implementations§

Source§

impl<P: Clone + MonsterProvider> Clone for LevelUp<P>
where P::MoveId: Clone,

Source§

fn clone(&self) -> LevelUp<P>

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<P: Debug + MonsterProvider> Debug for LevelUp<P>
where P::MoveId: Debug,

Source§

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

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

impl<P: MonsterProvider> Default for LevelUp<P>

Source§

fn default() -> Self

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

impl<P: Eq + MonsterProvider> Eq for LevelUp<P>
where P::MoveId: Eq,

Source§

impl<P: PartialEq + MonsterProvider> PartialEq for LevelUp<P>
where P::MoveId: PartialEq,

Source§

fn eq(&self, other: &LevelUp<P>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<P: PartialEq + MonsterProvider> StructuralPartialEq for LevelUp<P>
where P::MoveId: PartialEq,

Auto Trait Implementations§

§

impl<P> Freeze for LevelUp<P>

§

impl<P> RefUnwindSafe for LevelUp<P>

§

impl<P> Send for LevelUp<P>
where <P as MonsterProvider>::MoveId: Send,

§

impl<P> Sync for LevelUp<P>
where <P as MonsterProvider>::MoveId: Sync,

§

impl<P> Unpin for LevelUp<P>
where <P as MonsterProvider>::MoveId: Unpin,

§

impl<P> UnsafeUnpin for LevelUp<P>

§

impl<P> UnwindSafe for LevelUp<P>

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.