Skip to main content

BattleAction

Enum BattleAction 

Source
pub enum BattleAction<P: BattleProvider + ?Sized> {
    Fight {
        move_: P::Move,
    },
    Switch {
        to_slot: usize,
    },
    UseItem {
        item: P::Item,
    },
    Run,
    Nothing,
}
Expand description

The action a battler has chosen to take this turn.

Generic over the provider so the concrete move/item identifiers stay game-defined. Catch/Run resolution is game-specific: a game models them as UseItem/Run and decides the BattleEnd outcome inside its hooks.

Variants§

§

Fight

Use a move against the implied target (the opposing lead in 1v1).

Fields

§move_: P::Move

The chosen move.

§

Switch

Switch the active battler to another party slot on the same side.

Fields

§to_slot: usize

Destination slot within the acting side’s party.

§

UseItem

Use an item (potions, status cures, capture devices, …).

Fields

§item: P::Item

The chosen item.

§

Run

Attempt to flee the battle.

§

Nothing

Do nothing this turn (e.g. recharging, forced inaction handled upstream).

Trait Implementations§

Source§

impl<P: BattleProvider + ?Sized> Clone for BattleAction<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: BattleProvider + ?Sized> Debug for BattleAction<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 BattleAction<P>
where <P as BattleProvider>::Move: Freeze, <P as BattleProvider>::Item: Freeze, P: ?Sized,

§

impl<P> RefUnwindSafe for BattleAction<P>

§

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

§

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

§

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

§

impl<P> UnsafeUnpin for BattleAction<P>

§

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