Gen7ScriptsRs/gen_7_scripts/src/pokemon/prevent_foes_exit.rs

35 lines
796 B
Rust

use crate::common_usings::*;
script!(PreventFoesExitEffect, "prevent_foes_exit");
impl Script for PreventFoesExitEffect {
fn new() -> Self {
Self {}
}
fn get_name(&self) -> &'static str {
Self::get_const_name()
}
fn get_capabilities(&self) -> &[ScriptCapabilities] {
&[
ScriptCapabilities::PreventOpponentSwitch,
ScriptCapabilities::PreventOpponentRunAway,
]
}
fn prevent_opponent_switch(&self, _choice: TurnChoice, prevent: &mut bool) -> PkmnResult<()> {
*prevent = true;
Ok(())
}
fn prevent_opponent_run_away(&self, _choice: TurnChoice, prevent: &mut bool) -> PkmnResult<()> {
*prevent = true;
Ok(())
}
fn as_any(&self) -> &dyn Any {
self
}
}