Skip to main content

BattleAI

Trait BattleAI 

Source
pub trait BattleAI<P: BattleProvider + ?Sized> {
    // Required methods
    fn select_move(
        &self,
        battler: &BattlerState<P>,
        state: &BattleState<P>,
    ) -> P::Move;
    fn should_switch(&self, battler: &BattlerState<P>) -> bool;
    fn should_use_item(&self, battler: &BattlerState<P>) -> Option<P::Item>;
}
Expand description

AI decision-making for battle actions.

Implementations decide which move to use, whether to switch monsters, and whether to use items — all based on the current battle state.

Required Methods§

Source

fn select_move( &self, battler: &BattlerState<P>, state: &BattleState<P>, ) -> P::Move

Select a move for the given battler.

Source

fn should_switch(&self, battler: &BattlerState<P>) -> bool

Decide whether the battler should switch to a different monster.

Source

fn should_use_item(&self, battler: &BattlerState<P>) -> Option<P::Item>

Decide whether the battler should use an item, and which one.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§