31 lines
958 B
Rust
31 lines
958 B
Rust
|
use crate::dynamic_data::BattleRandom;
|
||
|
use crate::script_implementations::wasm::export_registry::register;
|
||
|
use crate::script_implementations::wasm::extern_ref::ExternRef;
|
||
|
use wasmer::FunctionEnvMut;
|
||
|
|
||
|
use crate::script_implementations::wasm::script_resolver::WebAssemblyEnv;
|
||
|
|
||
|
register! {
|
||
|
fn battle_random_get(
|
||
|
env: FunctionEnvMut<WebAssemblyEnv>,
|
||
|
battle_random: ExternRef<BattleRandom>,
|
||
|
) -> i32 {
|
||
|
battle_random.value_func(&env).unwrap().get()
|
||
|
}
|
||
|
fn battle_random_get_max(
|
||
|
env: FunctionEnvMut<WebAssemblyEnv>,
|
||
|
battle_random: ExternRef<BattleRandom>,
|
||
|
max: i32
|
||
|
) -> i32 {
|
||
|
battle_random.value_func(&env).unwrap().get_max(max)
|
||
|
}
|
||
|
fn battle_random_get_between(
|
||
|
env: FunctionEnvMut<WebAssemblyEnv>,
|
||
|
battle_random: ExternRef<BattleRandom>,
|
||
|
min: i32,
|
||
|
max: i32
|
||
|
) -> i32 {
|
||
|
battle_random.value_func(&env).unwrap().get_between(min, max)
|
||
|
}
|
||
|
}
|