FFI for Battle Party
This commit is contained in:
@@ -2,12 +2,15 @@ use std::sync::Arc;
|
||||
|
||||
use crate::dynamic_data::models::pokemon::Pokemon;
|
||||
use crate::dynamic_data::models::pokemon_party::PokemonParty;
|
||||
use crate::{ValueIdentifiable, ValueIdentifier};
|
||||
|
||||
/// A battle party is a wrapper around a party, with the indices for which the party is responsible
|
||||
/// on the field attached.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
pub struct BattleParty {
|
||||
/// A unique identifier so we know what value this is.
|
||||
identifier: ValueIdentifier,
|
||||
/// The party the BattleParty is holding.
|
||||
party: Arc<PokemonParty>,
|
||||
/// The indices for which the party is responsible, in the format (side, index)
|
||||
@@ -19,6 +22,7 @@ impl BattleParty {
|
||||
/// for.
|
||||
pub fn new(party: Arc<PokemonParty>, responsible_indices: Vec<(u8, u8)>) -> Self {
|
||||
Self {
|
||||
identifier: Default::default(),
|
||||
party,
|
||||
responsible_indices,
|
||||
}
|
||||
@@ -54,3 +58,9 @@ impl BattleParty {
|
||||
&self.party
|
||||
}
|
||||
}
|
||||
|
||||
impl ValueIdentifiable for BattleParty {
|
||||
fn value_identifier(&self) -> ValueIdentifier {
|
||||
self.identifier
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user