Struct ScriptPokemon

Source
pub struct ScriptPokemon<ID: Clone>(_, pub BattlePokemon);

Tuple Fields§

§1: BattlePokemon

Implementations§

Source§

impl<ID: Clone> ScriptPokemon<ID>

Source

pub fn new(pokemon: Indexed<ID, &BattlePokemon>) -> Self

Source

pub fn throw_move<R: Rng + Clone + 'static>( &mut self, random: ScriptRandom<R>, m: ScriptMove, ) -> bool

Source

pub fn get_damage<R: Rng + Clone + 'static>( &mut self, random: ScriptRandom<R>, target: Self, power: INT, category: MoveCategory, move_type: PokemonType, crit_rate: INT, ) -> ScriptDamage

Source

pub fn hp(&mut self) -> INT

Methods from Deref<Target = BattlePokemon>§

Source

pub fn battle_exp_from(&self, type_: &BattleType) -> Experience

Source

pub fn stat(&self, stat: StatType) -> BaseStat

Source

pub fn damage_kind( &self, random: &mut impl Rng, target: &Self, kind: DamageKind, category: MoveCategory, move_type: PokemonType, crit_rate: CriticalRate, ) -> DamageResult<Health>

Source

pub fn move_power_damage_random( &self, random: &mut impl Rng, target: &Self, power: Power, category: MoveCategory, move_type: PokemonType, crit: bool, ) -> DamageResult<Health>

Source

pub fn move_power_damage( &self, target: &Self, power: Power, category: MoveCategory, move_type: PokemonType, crit: bool, range: u8, ) -> DamageResult<Health>

Methods from Deref<Target = OwnedPokemon>§

Source

pub fn hp(&self) -> u16

Get the current HP of this pokemon.

Source

pub fn fainted(&self) -> bool

Has the pokemon fainted.

Source

pub fn name(&self) -> &str

Get the name of this pokemon. Returns the nickname or the pokemon’s name.

Source

pub fn should_evolve(&self) -> Option<&u16>

Source

pub fn exp_from(&self) -> u32

Get the Experience from this pokemon at its current Level.

Source

pub fn moves_at_level(&self) -> impl DoubleEndedIterator

Get this pokemon’s moves at its current Level.

Source

pub fn max_hp(&self) -> u16

Get the maximum Health of this pokemon.

Source

pub fn percent_hp(&self) -> f32

Get the current Health of this pokemon as a percentage.

Source

pub fn stat(&self, stat: StatType) -> u16

Get a BaseStat for this pokemon.

Source

pub fn heal_hp(&mut self, amount: Option<u16>)

Heal this pokemon with an optional amount of Health.

Source

pub fn heal(&mut self, hp: Option<u16>, pp: Option<u8>)

Heal this pokemon with an optional amount of Health and restore all its move’s PP by an optional amount.

Source

pub fn add_exp<'s>( &'s mut self, movedex: &Dex<Move>, experience: u32, ) -> impl DoubleEndedIterator + 's

Add Experience to this pokemon, and also handle level ups.

Source

pub fn on_level_up( &mut self, movedex: &Dex<Move>, previous: u8, ) -> impl DoubleEndedIterator

Handle leveling up.

Trait Implementations§

Source§

impl<ID: Clone + Clone> Clone for ScriptPokemon<ID>

Source§

fn clone(&self) -> ScriptPokemon<ID>

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<ID: Debug + Clone> Debug for ScriptPokemon<ID>

Source§

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

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

impl<ID: Clone> Deref for ScriptPokemon<ID>

Source§

type Target = BattlePokemon

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<ID: Clone> Into<PokemonIdentifier<ID>> for ScriptPokemon<ID>

Source§

fn into(self) -> PokemonIdentifier<ID>

Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

§

impl<ID> Freeze for ScriptPokemon<ID>
where ID: Freeze,

§

impl<ID> RefUnwindSafe for ScriptPokemon<ID>
where ID: RefUnwindSafe,

§

impl<ID> Send for ScriptPokemon<ID>
where ID: Send,

§

impl<ID> Sync for ScriptPokemon<ID>
where ID: Sync,

§

impl<ID> Unpin for ScriptPokemon<ID>
where ID: Unpin,

§

impl<ID> UnwindSafe for ScriptPokemon<ID>
where ID: UnwindSafe,

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.