Implements CurePartyStatus
This commit is contained in:
41
gen_7_scripts/src/moves/cure_party_status.rs
Normal file
41
gen_7_scripts/src/moves/cure_party_status.rs
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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 => {}
|
||||
|
||||
Reference in New Issue
Block a user