diff --git a/gen_7_scripts/src/moves/assurance.rs b/gen_7_scripts/src/moves/assurance.rs index 4056b1d..8fa4e3c 100755 --- a/gen_7_scripts/src/moves/assurance.rs +++ b/gen_7_scripts/src/moves/assurance.rs @@ -3,7 +3,7 @@ use alloc::boxed::Box; use core::any::Any; use core::sync::atomic::{AtomicBool, Ordering}; use pkmn_lib_interface::app_interface::{ - BattleSide, DamageSource, ExecutingMove, Pokemon, TurnChoice, + get_volatile_as, BattleSide, DamageSource, ExecutingMove, Pokemon, TurnChoice, }; use pkmn_lib_interface::handling::{Script, ScriptCapabilities}; @@ -48,7 +48,7 @@ impl Script for Assurance { _hit: u8, base_power: &mut u8, ) { - if let Some(s) = pkmn_lib_interface::app_interface::get_volatile_as::( + if let Some(s) = get_volatile_as::( target.battle_side().as_ref(), AssuranceData::get_const_name(), ) { diff --git a/pkmn_lib_interface/src/app_interface/static_data/statistics.rs b/pkmn_lib_interface/src/app_interface/static_data/statistics.rs index a0cb2ed..ad06ad3 100644 --- a/pkmn_lib_interface/src/app_interface/static_data/statistics.rs +++ b/pkmn_lib_interface/src/app_interface/static_data/statistics.rs @@ -56,16 +56,22 @@ mod implementation { Self::from_ref(reference, &|reference| Self { inner: Rc::new(ImmutableStatisticSetInner { reference, - hp: cached_value!({ static_statistics_set_get_hp(reference) }), - attack: cached_value!({ static_statistics_set_get_attack(reference) }), - defense: cached_value!({ static_statistics_set_get_defense(reference) }), + hp: cached_value!({ static_statistics_set_get_stat(reference, Statistic::HP) }), + attack: cached_value!({ + static_statistics_set_get_stat(reference, Statistic::Attack) + }), + defense: cached_value!({ + static_statistics_set_get_stat(reference, Statistic::Defense) + }), special_attack: cached_value!({ - static_statistics_set_get_special_attack(reference) + static_statistics_set_get_stat(reference, Statistic::SpecialAttack) }), special_defense: cached_value!({ - static_statistics_set_get_special_defense(reference) + static_statistics_set_get_stat(reference, Statistic::SpecialDefense) + }), + speed: cached_value!({ + static_statistics_set_get_stat(reference, Statistic::Speed) }), - speed: cached_value!({ static_statistics_set_get_speed(reference) }), }), }) } @@ -101,15 +107,10 @@ mod implementation { crate::handling::cacheable::cacheable!(ImmutableStatisticSetImpl); extern "wasm" { - fn static_statistics_set_get_hp(r: ExternRef) -> u16; - fn static_statistics_set_get_attack(r: ExternRef) -> u16; - fn static_statistics_set_get_defense(r: ExternRef) -> u16; - fn static_statistics_set_get_special_attack(r: ExternRef) - -> u16; - fn static_statistics_set_get_special_defense( + fn static_statistics_set_get_stat( r: ExternRef, + stat: Statistic, ) -> u16; - fn static_statistics_set_get_speed(r: ExternRef) -> u16; } } #[cfg(not(feature = "mock_data"))]