pub struct BattleDriver;Expand description
The generic turn-execution driver. Stateless: state goes in, events come out.
Implementations§
Source§impl BattleDriver
impl BattleDriver
Sourcepub fn execute_turn<P: BattleProvider>(
provider: &P,
state: &mut BattleState<P>,
actions: [BattleAction<P>; 2],
rng: &mut dyn BattleRng,
) -> TurnOutcome<P>
pub fn execute_turn<P: BattleProvider>( provider: &P, state: &mut BattleState<P>, actions: [BattleAction<P>; 2], rng: &mut dyn BattleRng, ) -> TurnOutcome<P>
Execute exactly one full battle turn given each side’s chosen action
(actions[0] = player, actions[1] = opponent).
See the module docs for the sequencing. The provider supplies all
numbers/rules via its hooks; rng supplies all randomness.
Sourcepub fn apply_switch<P: BattleProvider>(
state: &mut BattleState<P>,
side: u8,
to_slot: usize,
) -> bool
pub fn apply_switch<P: BattleProvider>( state: &mut BattleState<P>, side: u8, to_slot: usize, ) -> bool
Switch the active battler on side to to_slot. Returns true on a
successful, in-bounds switch to a non-fainted member.
Auto Trait Implementations§
impl Freeze for BattleDriver
impl RefUnwindSafe for BattleDriver
impl Send for BattleDriver
impl Sync for BattleDriver
impl Unpin for BattleDriver
impl UnsafeUnpin for BattleDriver
impl UnwindSafe for BattleDriver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more