use bevy::prelude::*;
pub type BattleId = String;
#[derive(Message, Debug, Clone, Reflect)]
pub struct CombatStartRequested {
pub battle_id: BattleId,
pub combat_entity: Entity, }
#[derive(Message, Debug, Clone, Reflect)]
pub struct CombatTurnAdvanceRequested {
pub battle_id: BattleId,
}
#[derive(Message, Debug, Clone, Reflect)]
pub struct CombatEndRequested {
pub battle_id: BattleId,
}
#[derive(Message, Debug, Clone, Reflect)]
pub struct DamageRequested {
pub attacker: Entity,
pub target: Entity,
pub base_damage: i32,
}
#[derive(Message, Debug, Clone, Reflect)]
pub struct CombatStartedEvent {
pub battle_id: BattleId,
pub combat_entity: Entity,
}
#[derive(Message, Debug, Clone, Reflect)]
pub struct CombatTurnCompletedEvent {
pub battle_id: BattleId,
pub turn: u32,
pub log_entries: Vec<String>,
}
#[derive(Message, Debug, Clone, Reflect)]
pub struct DamageAppliedEvent {
pub attacker: Entity,
pub target: Entity,
pub actual_damage: i32,
pub is_dead: bool,
}
#[derive(Message, Debug, Clone, Reflect)]
pub struct CombatEndedEvent {
pub battle_id: BattleId,
pub result: CombatResult,
pub total_turns: u32,
pub score: u32,
}
#[derive(Debug, Clone, PartialEq, Reflect)]
pub enum CombatResult {
Victory,
Defeat,
Ongoing,
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_combat_result() {
assert_eq!(CombatResult::Victory, CombatResult::Victory);
assert_ne!(CombatResult::Victory, CombatResult::Defeat);
}
}