Implements CurePartyStatus

This commit is contained in:
2022-09-10 12:41:33 +02:00
parent 0f85f4f0a4
commit 19706c4c3c
4 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
use crate::script;
use core::any::Any;
use pkmn_lib_interface::app_interface::{ExecutingMove, Pokemon};
use pkmn_lib_interface::handling::{Script, ScriptCapabilities};
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 != user {
mon.clear_status();
}
}
}
}
}
fn as_any(&self) -> &dyn Any {
self
}
}

View File

@@ -8,6 +8,7 @@ pub mod aurora_veil;
pub mod automize;
pub mod change_all_target_stats;
pub mod change_target_stats;
pub mod cure_party_status;
pub mod light_screen;
pub mod multi_hit_move;
pub mod reflect;

View File

@@ -42,6 +42,7 @@ pub fn get_script(category: ScriptCategory, name: &StringKey) -> Option<Box<dyn
change_target_stats::ChangeTargetSpecialAttack,
change_target_stats::ChangeTargetSpecialDefense,
change_target_stats::ChangeTargetSpeed,
cure_party_status::CurePartyStatus,
);
}
ScriptCategory::Ability => {}