Gen7ScriptsRs/gen_7_scripts/src/moves/flinch.rs

32 lines
651 B
Rust

use crate::common_usings::*;
use crate::pokemon::flinch_effect::FlinchEffect;
script!(Flinch, "flinch");
impl Script for Flinch {
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,
_move: ExecutingMove,
target: Pokemon,
_hit: u8,
) -> PkmnResult<()> {
target.add_volatile(Box::new(FlinchEffect::new()))?;
Ok(())
}
fn as_any(&self) -> &dyn Any {
self
}
}