firecore_battle/
player.rs1use alloc::vec::Vec;
2
3use serde::{Deserialize, Serialize};
4
5use pokedex::{
6 item::bag::{InitBag, SavedBag},
7 pokemon::owned::SavedPokemon,
8};
9
10use crate::{
11 data::BattleData,
12 party::{ActivePokemon, PlayerParty, RemoteParty},
13 pokemon::PokemonView,
14};
15
16#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
17pub struct PlayerSettings {
18 pub gains_exp: bool,
19}
20
21impl Default for PlayerSettings {
22 fn default() -> Self {
23 Self { gains_exp: true }
24 }
25}
26
27pub struct Player<ID, A: ActivePokemon, P, T, E> {
28 pub party: PlayerParty<ID, A, P, T>,
29 pub bag: InitBag,
30 pub settings: PlayerSettings,
31 pub endpoint: E,
32}
33
34impl<ID, A: ActivePokemon, P: PokemonView, T, E> Player<ID, A, P, T, E> {
35 pub fn id(&self) -> &ID {
36 self.party.id()
37 }
38
39 pub fn name(&self) -> &str {
40 self.party.name()
41 }
42}
43
44#[derive(Debug, Clone, Deserialize, Serialize)]
45pub struct ClientPlayerData<ID, T> {
46 pub data: BattleData,
47 pub local: PlayerParty<ID, usize, SavedPokemon, T>,
48 pub remotes: Vec<RemoteParty<ID, T>>,
49 pub bag: SavedBag,
50}