use std::{collections::BTreeMap, fmt};
use npc_engine_core::AgentId;
use crate::map::Location;
#[derive(Clone, Hash, PartialEq, Eq, Debug)]
pub struct AgentState {
pub acc_capture: u16,
pub cur_or_last_location: Location,
pub next_location: Option<Location>,
pub hp: u8,
pub ammo: u8,
}
#[derive(Clone, Hash, PartialEq, Eq)]
pub enum CapturePointState {
Free,
Capturing(AgentId),
Captured(AgentId),
}
impl fmt::Debug for CapturePointState {
fn fmt(&self, f: &'_ mut fmt::Formatter) -> fmt::Result {
match &self {
CapturePointState::Free => f.write_str("__"),
CapturePointState::Capturing(agent) => f.write_fmt(format_args!("C{:?}", agent.0)),
CapturePointState::Captured(agent) => f.write_fmt(format_args!("H{:?}", agent.0)),
}
}
}
#[derive(Clone, Hash, PartialEq, Eq, Debug)]
pub struct State {
pub agents: BTreeMap<AgentId, AgentState>,
pub capture_points: [CapturePointState; 3],
pub ammo: u8,
pub ammo_tick: u8,
pub medkit: u8,
pub medkit_tick: u8,
}
pub type Diff = Option<State>;