Gen7ScriptsRs/gen_7_scripts/src/moves/prevent_foes_exit.rs

35 lines
756 B
Rust

use crate::common_usings::*;
use crate::pokemon::prevent_foes_exit::PreventFoesExitEffect;
script!(PreventFoesExist, "prevent_foes_exit");
impl Script for PreventFoesExist {
fn new() -> Self {
Self {}
}
fn get_name(&self) -> &'static str {
Self::get_const_name()
}
fn get_capabilities(&self) -> &[ScriptCapabilities] {
&[ScriptCapabilities::OnSecondaryEffect]
}
fn on_secondary_effect(
&self,
executing_move: ExecutingMove,
_target: Pokemon,
_hit: u8,
) -> PkmnResult<()> {
executing_move
.user()
.add_volatile(Box::new(PreventFoesExitEffect::new()))?;
Ok(())
}
fn as_any(&self) -> &dyn Any {
self
}
}