Gen7ScriptsRs/pkmn_lib_interface/src/app_interface/dynamic_data/choice_queue.rs

32 lines
800 B
Rust
Executable File

use crate::{ExternRef, ExternalReferenceType, Pokemon};
#[derive(Clone)]
pub struct ChoiceQueue {
reference: ExternRef<ChoiceQueue>,
}
impl ChoiceQueue {
#[cfg(not(feature = "mock_data"))]
pub fn new(reference: ExternRef<ChoiceQueue>) -> Self {
Self { reference }
}
pub fn move_pokemon_choice_next(&self, pokemon: &Pokemon) -> bool {
unsafe { choice_queue_move_pokemon_choice_next(self.reference, pokemon.reference()) }
}
}
#[cfg(not(feature = "mock_data"))]
impl ExternalReferenceType for ChoiceQueue {
fn from_extern_value(reference: ExternRef<Self>) -> Self {
Self::new(reference)
}
}
extern "wasm" {
fn choice_queue_move_pokemon_choice_next(
r: ExternRef<ChoiceQueue>,
pokemon: ExternRef<Pokemon>,
) -> bool;
}