PkmnLib_rs/src/script_implementations/rune/wrappers/executing_move.rs

27 lines
770 B
Rust

use crate::dynamic_data::ExecutingMove;
use crate::script_implementations::rune::wrappers::{impl_rune_wrapper, RuneWrapper};
use rune::runtime::{AnyObj, Shared};
use rune::Any;
use std::sync::Arc;
pub fn register(module: &mut rune::Module) -> anyhow::Result<()> {
module.ty::<RuneExecutingMove>()?;
Ok(())
}
#[derive(Debug, Any)]
pub struct RuneExecutingMove {
inner: Arc<ExecutingMove>,
}
impl RuneExecutingMove {
#[rune::function]
pub fn target_count(&self) -> usize { self.inner.target_count() }
#[rune::function]
pub fn number_of_hits(&self) -> u8 { self.inner.number_of_hits() }
#[rune::function]
pub fn user(&self) -> Shared<AnyObj> { self.inner.user().wrap() }
}
impl_rune_wrapper!(&Arc<ExecutingMove>, RuneExecutingMove);