Gen7ScriptsRs/gen_7_scripts/src/pokemon/infatuated.rs

28 lines
563 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) {
if mv.user().battle().unwrap().random().get_max(2) == 0 {
*prevent = true
}
}
fn as_any(&self) -> &dyn Any {
self
}
}