31 lines
691 B
Rust
31 lines
691 B
Rust
use crate::script;
|
|
use core::any::Any;
|
|
use pkmn_lib_interface::app_interface::ExecutingMove;
|
|
use pkmn_lib_interface::handling::{Script, ScriptCapabilities};
|
|
|
|
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
|
|
}
|
|
}
|