Gen7ScriptsRs/gen_7_scripts/src/pokemon/infatuated.rs

29 lines
598 B
Rust

use crate::common_usings::*;
script!(Infatuated, "infatuated");
impl Script for Infatuated {
fn new() -> Self {
Self {}
}
fn get_name(&self) -> &'static str {
Self::get_const_name()
}
fn get_capabilities(&self) -> &[ScriptCapabilities] {
&[ScriptCapabilities::PreventMove]
}
fn prevent_move(&self, mv: ExecutingMove, prevent: &mut bool) -> PkmnResult<()> {
if mv.user().battle()?.unwrap().random().get_max(2)? == 0 {
*prevent = true
}
Ok(())
}
fn as_any(&self) -> &dyn Any {
self
}
}