generated from GarandPLG/rust-flake-template
Move ZoomLevel into skirmish_states
Introduce Structure and Unit traits with enum wrappers. Replace old zoom helper with ZoomLevel methods. Update imports, BoardState, CellWidget, and CLI to use new locations.
This commit is contained in:
@@ -1,34 +1,50 @@
|
||||
use crate::app::states::{Players, skirmish_states::structures::Structure};
|
||||
use ratatui::style::Color;
|
||||
|
||||
use crate::app::states::Players;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct BaseBuilding {
|
||||
durability: u16,
|
||||
stress: u8,
|
||||
owner: Players,
|
||||
level: u8,
|
||||
}
|
||||
|
||||
impl BaseBuilding {
|
||||
pub fn new(owner: Players) -> Self {
|
||||
Self { owner, level: b'1' }
|
||||
}
|
||||
|
||||
pub fn get_tag(&self) -> char {
|
||||
'B'
|
||||
}
|
||||
|
||||
pub fn get_color(&self) -> Color {
|
||||
match self.owner {
|
||||
Players::Player => Color::LightBlue,
|
||||
Players::Enemy => Color::LightRed,
|
||||
Self {
|
||||
durability: 1500,
|
||||
stress: 0,
|
||||
owner,
|
||||
level: b'1',
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_owner(&self) -> Players {
|
||||
self.owner
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_level(&self) -> char {
|
||||
impl Structure for BaseBuilding {
|
||||
fn get_tag(&self) -> char {
|
||||
'B'
|
||||
}
|
||||
|
||||
fn get_color(&self) -> Color {
|
||||
match self.owner {
|
||||
Players::Player => Color::LightBlue,
|
||||
Players::Enemy => Color::LightRed,
|
||||
}
|
||||
}
|
||||
|
||||
fn get_level(&self) -> char {
|
||||
self.level as char
|
||||
}
|
||||
|
||||
fn get_durability(&self) -> u16 {
|
||||
self.durability
|
||||
}
|
||||
|
||||
fn get_stress(&self) -> u8 {
|
||||
self.stress
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user