Gen7ScriptsRs/gen_7_scripts/src/moves/cure_party_status.rs

39 lines
984 B
Rust

use crate::common_usings::*;
script!(CurePartyStatus, "cure_party_status");
impl Script for CurePartyStatus {
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) {
let user = mv.user();
user.clear_status();
let party = user.battle().unwrap().find_party_for_pokemon(&user);
if let Some(party) = party {
let p = party.party();
for index in 0..p.length() {
let mon = p.get_pokemon(index);
if let Some(mon) = mon {
if !mon.equals(&user) {
mon.clear_status();
}
}
}
}
}
fn as_any(&self) -> &dyn Any {
self
}
}