From 2d6ee1dddda6a51692adff10160bb93a76430b0b Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Sat, 12 May 2018 15:10:35 +0200 Subject: Added new building specifications --- src/engine/settings.rs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/engine/settings.rs') diff --git a/src/engine/settings.rs b/src/engine/settings.rs index a6691d7..b23d6bd 100644 --- a/src/engine/settings.rs +++ b/src/engine/settings.rs @@ -1,10 +1,33 @@ use super::geometry::Point; +use super::command::BuildingType; #[derive(Debug)] pub struct GameSettings { pub size: Point, pub energy_income: u16, - pub energy_price: u16, - pub defence_price: u16, - pub attack_price: u16 + pub energy: BuildingSettings, + pub defence: BuildingSettings, + pub attack: BuildingSettings +} + +#[derive(Debug)] +pub struct BuildingSettings { + pub price: u16, + pub health: u16, + pub construction_time: u8, + pub weapon_damage: u16, + pub weapon_speed: u8, + pub weapon_cooldown_period: u8, + pub energy_generated_per_turn: u16 +} + +impl GameSettings { + pub fn building_settings(&self, building: BuildingType) -> &BuildingSettings { + match building { + BuildingType::Defence => &self.defence, + BuildingType::Attack => &self.attack, + BuildingType::Energy => &self.energy + } + } + } -- cgit v1.2.3