2022-06-06 11:54:59 +00:00
|
|
|
use crate::dynamic_data::models::pokemon_party::PokemonParty;
|
|
|
|
|
2022-06-03 14:35:18 +00:00
|
|
|
#[derive(Debug)]
|
2022-06-06 11:54:59 +00:00
|
|
|
pub struct BattleParty<'a> {
|
|
|
|
party: &'a PokemonParty<'a>,
|
|
|
|
responsible_indices: Vec<(u8, u8)>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> BattleParty<'a> {
|
|
|
|
pub fn is_responsible_for_index(&self, side: u8, index: u8) -> bool {
|
|
|
|
for responsible_index in &self.responsible_indices {
|
|
|
|
if responsible_index.0 == side && responsible_index.1 == index {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
false
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn has_pokemon_not_in_field(&self) -> bool {
|
|
|
|
for pokemon in self.party.pokemon().iter().flatten() {
|
|
|
|
let pokemon = pokemon.read().unwrap();
|
|
|
|
if pokemon.is_usable() && !pokemon.is_on_battlefield() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
false
|
|
|
|
}
|
|
|
|
}
|