Simplify WASM interface for static_statistic_set
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
fb98798046
commit
44a169cba7
|
@ -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::<AssuranceData>(
|
||||
if let Some(s) = get_volatile_as::<AssuranceData>(
|
||||
target.battle_side().as_ref(),
|
||||
AssuranceData::get_const_name(),
|
||||
) {
|
||||
|
|
|
@ -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<ImmutableStatisticSetImpl>) -> u16;
|
||||
fn static_statistics_set_get_attack(r: ExternRef<ImmutableStatisticSetImpl>) -> u16;
|
||||
fn static_statistics_set_get_defense(r: ExternRef<ImmutableStatisticSetImpl>) -> u16;
|
||||
fn static_statistics_set_get_special_attack(r: ExternRef<ImmutableStatisticSetImpl>)
|
||||
-> u16;
|
||||
fn static_statistics_set_get_special_defense(
|
||||
fn static_statistics_set_get_stat(
|
||||
r: ExternRef<ImmutableStatisticSetImpl>,
|
||||
stat: Statistic,
|
||||
) -> u16;
|
||||
fn static_statistics_set_get_speed(r: ExternRef<ImmutableStatisticSetImpl>) -> u16;
|
||||
}
|
||||
}
|
||||
#[cfg(not(feature = "mock_data"))]
|
||||
|
|
Loading…
Reference in New Issue