Skip to main content

TurnEvent

Enum TurnEvent 

Source
pub enum TurnEvent<P: BattleProvider + ?Sized> {
    MoveUsed {
        who: BattlerRef,
        move_: P::Move,
    },
    ActionPrevented {
        who: BattlerRef,
        reason: EffectResult,
    },
    Missed {
        who: BattlerRef,
        target: BattlerRef,
    },
    Damage {
        who: BattlerRef,
        target: BattlerRef,
        amount: u16,
        critical: bool,
        effectiveness: f32,
    },
    Faint {
        who: BattlerRef,
    },
    Switched {
        side: u8,
        to_slot: usize,
    },
    Residual {
        result: EffectResult,
    },
    Effect {
        result: EffectResult,
    },
}
Expand description

A single observable event produced during turn execution.

Generic over the provider so move identifiers stay game-defined. The game translates these into its own UI / animation steps.

Variants§

§

MoveUsed

A battler began its action with the given chosen move.

Fields

§who: BattlerRef

The acting battler.

§move_: P::Move

The move used.

§

ActionPrevented

A battler’s action was prevented by the pre-move gate (sleep, freeze, flinch, full paralysis, recharge, …). Carries the gate’s reason.

Fields

§who: BattlerRef

The prevented battler.

§reason: EffectResult

Why it could not act.

§

Missed

A move missed (failed accuracy_check, including the Gen-1 1/256 miss).

Fields

§who: BattlerRef

The attacker.

§target: BattlerRef

The intended target.

§

Damage

Damage was dealt to target.

Fields

§who: BattlerRef

The attacker.

§target: BattlerRef

The battler that took the damage.

§amount: u16

Amount of HP lost.

§critical: bool

Whether this was a critical hit.

§effectiveness: f32

Type-effectiveness multiplier from the damage calculation.

§

Faint

A battler fainted (HP reached 0).

Fields

§who: BattlerRef

The fainted battler.

§

Switched

A battler switched to another party slot.

Fields

§side: u8

The acting side.

§to_slot: usize

Destination slot.

§

Residual

An end-of-turn residual effect resolved (poison/burn tick, leech, …).

Fields

§result: EffectResult

The residual result.

§

Effect

A generic effect result the game wishes to surface (catch/run handling, item use, forced actions, …).

Fields

§result: EffectResult

The effect result.

Trait Implementations§

Source§

impl<P: BattleProvider + ?Sized> Debug for TurnEvent<P>

Source§

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

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

impl<P: BattleProvider + ?Sized> PartialEq for TurnEvent<P>
where P::Move: PartialEq,

Source§

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

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

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

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl<P> Freeze for TurnEvent<P>
where <P as BattleProvider>::Move: Freeze, P: ?Sized,

§

impl<P> RefUnwindSafe for TurnEvent<P>
where <P as BattleProvider>::Move: RefUnwindSafe, P: ?Sized,

§

impl<P> Send for TurnEvent<P>
where <P as BattleProvider>::Move: Send, P: ?Sized,

§

impl<P> Sync for TurnEvent<P>
where <P as BattleProvider>::Move: Sync, P: ?Sized,

§

impl<P> Unpin for TurnEvent<P>
where <P as BattleProvider>::Move: Unpin, P: ?Sized,

§

impl<P> UnsafeUnpin for TurnEvent<P>
where <P as BattleProvider>::Move: UnsafeUnpin, P: ?Sized,

§

impl<P> UnwindSafe for TurnEvent<P>
where <P as BattleProvider>::Move: UnwindSafe, P: ?Sized,

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