Skip to main content

TurnEvent

Enum TurnEvent 

Source
pub enum TurnEvent<P: EffectProvider + ?Sized> {
    MoveUsed {
        actor: BattlerRef,
        move_: P::Move,
    },
    Missed {
        actor: BattlerRef,
    },
    Blocked {
        actor: BattlerRef,
    },
    Crit {
        actor: BattlerRef,
    },
    Damaged {
        target: BattlerRef,
        amount: u16,
        cause: Option<HpChangeCause<P>>,
    },
    Healed {
        target: BattlerRef,
        amount: u16,
        cause: Option<HpChangeCause<P>>,
    },
    StatusInflicted {
        target: BattlerRef,
        status: P::Status,
    },
    StatusCured {
        target: BattlerRef,
        status: P::Status,
    },
    StatChanged {
        target: BattlerRef,
        stat: P::Stat,
        delta: i8,
    },
    Fainted {
        who: BattlerRef,
    },
}
Expand description

One structural event observed during a stack-driven turn (see module docs).

Generic over the game’s BattleProvider associated types; the engine never interprets the move/status/stat values — it only records them, in order.

Variants§

§

MoveUsed

actor began executing move_ (it passed the BeforeMove gate + cost).

Fields

§actor: BattlerRef

The battler whose move executed.

§move_: P::Move

The move that executed (the effective move — a lock-in override is already resolved by the driver before this is recorded).

§

Missed

actor’s move missed (the accuracy / immunity miss branch).

Fields

§actor: BattlerRef

The battler whose move missed.

§

Blocked

actor’s move was PREVENTED before it executed — a BeforeMove gate aborted it (e.g. asleep / frozen / fully paralyzed / a confusion self-hit) or it could not pay its resource cost. No MoveUsed is logged for a blocked move. The engine reports only THAT the move was prevented; the game derives the reason from the battler’s status / volatiles (e.g. “is fast asleep!”).

Fields

§actor: BattlerRef

The battler whose move was prevented.

§

Crit

actor’s move landed a critical hit.

Fields

§actor: BattlerRef

The battler who landed the crit.

§

Damaged

target lost amount HP this step.

Fields

§target: BattlerRef

The battler that lost HP.

§amount: u16

HP lost (> 0).

§cause: Option<HpChangeCause<P>>

Why the HP was lost — None for move damage; Some(..) for a residual tick (burn/poison/toxic/leech). See HpChangeCause.

§

Healed

target recovered amount HP this step.

Fields

§target: BattlerRef

The battler that gained HP.

§amount: u16

HP gained (> 0).

§cause: Option<HpChangeCause<P>>

Why the HP was gained — None for a move heal (drain/Recover); Some(..) for a residual drain-to-source (Leech Seed’s seeder gain).

§

StatusInflicted

target gained the non-volatile status.

Fields

§target: BattlerRef

The battler that gained a status.

§status: P::Status

The new non-volatile status.

§

StatusCured

target’s non-volatile status was cleared / cured.

Fields

§target: BattlerRef

The battler whose status was cleared.

§status: P::Status

The status that was cleared.

§

StatChanged

target’s stat stage changed by delta signed steps.

Fields

§target: BattlerRef

The battler whose stat stage changed.

§stat: P::Stat

The stat that changed.

§delta: i8

The signed change in stage (e.g. +1, -2).

§

Fainted

who fainted (HP reached 0 this step).

Fields

§who: BattlerRef

The battler that fainted.

Trait Implementations§

Source§

impl<P: EffectProvider + ?Sized> Clone for TurnEvent<P>

Source§

fn clone(&self) -> Self

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: EffectProvider + ?Sized> Debug for TurnEvent<P>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P> Freeze for TurnEvent<P>

§

impl<P> RefUnwindSafe for TurnEvent<P>

§

impl<P> Send for TurnEvent<P>

§

impl<P> Sync for TurnEvent<P>

§

impl<P> Unpin for TurnEvent<P>

§

impl<P> UnsafeUnpin for TurnEvent<P>

§

impl<P> UnwindSafe for TurnEvent<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.