20 lines
660 B
Rust
20 lines
660 B
Rust
use crate::dynamic_data::{ChoiceQueue, Pokemon};
|
|
use crate::script_implementations::wasm::export_registry::register;
|
|
use crate::script_implementations::wasm::extern_ref::ExternRef;
|
|
use crate::script_implementations::wasm::script_resolver::WebAssemblyEnv;
|
|
use wasmer::FunctionEnvMut;
|
|
|
|
register! {
|
|
fn choice_queue_move_pokemon_choice_next(
|
|
env: FunctionEnvMut<WebAssemblyEnv>,
|
|
battle_random: ExternRef<ChoiceQueue>,
|
|
pokemon: ExternRef<Pokemon>
|
|
) -> u8 {
|
|
if battle_random.value_func(&env).unwrap().move_pokemon_choice_next(pokemon.value_func(&env).unwrap()) {
|
|
1
|
|
} else {
|
|
0
|
|
}
|
|
}
|
|
}
|