use core::any::Any; use core::mem::transmute; use pkmn_lib_interface::app_interface::{ExecutingMove, Pokemon, Statistic}; use pkmn_lib_interface::handling::{Script, ScriptCapabilities}; pub struct Acupressure {} impl Acupressure { pub const fn get_const_name() -> &'static str { "acupressure" } } impl Script for Acupressure { 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, mv: ExecutingMove, target: Pokemon, hit: u8) { if target == mv.user() { mv.get_hit_data(&target, hit).fail(); return; } let rand_stat: Statistic = unsafe { transmute(target.battle().unwrap().random().get_between(1, 6) as u8) }; target.change_stat_boost(rand_stat, 2, false); } fn as_any(&self) -> &dyn Any { self } }