nil_core/infrastructure/building/
iron_mine.rs1use crate::check_total_resource_ratio;
5use crate::infrastructure::building::{BuildingId, BuildingLevel, MineId};
6use crate::infrastructure::mine::MineProduction;
7use crate::infrastructure::requirements::InfrastructureRequirements;
8use crate::ranking::score::Score;
9use crate::resources::cost::{Cost, ResourceRatio};
10use crate::resources::maintenance::MaintenanceRatio;
11use crate::resources::workforce::Workforce;
12use nil_core_macros::{Building, Mine};
13use serde::{Deserialize, Serialize};
14
15#[derive(Building, Mine, Clone, Debug, Deserialize, Serialize)]
16#[serde(rename_all = "camelCase")]
17pub struct IronMine {
18 level: BuildingLevel,
19 enabled: bool,
20}
21
22impl IronMine {
23 pub const ID: BuildingId = BuildingId::IronMine;
24 pub const MINE_ID: MineId = MineId::IronMine;
25
26 pub const MIN_LEVEL: BuildingLevel = BuildingLevel::ZERO;
27 pub const MAX_LEVEL: BuildingLevel = BuildingLevel::new(30);
28
29 pub const MIN_COST: Cost = Cost::new(100);
30 pub const MAX_COST: Cost = Cost::new(72_000);
31
32 pub const WOOD_RATIO: ResourceRatio = ResourceRatio::new(0.35);
33 pub const STONE_RATIO: ResourceRatio = ResourceRatio::new(0.45);
34 pub const IRON_RATIO: ResourceRatio = ResourceRatio::new(0.2);
35 pub const MAINTENANCE_RATIO: MaintenanceRatio = MaintenanceRatio::new(0.005);
36
37 pub const MIN_WORKFORCE: Workforce = Workforce::new(1);
38 pub const MAX_WORKFORCE: Workforce = Workforce::new(150);
39
40 pub const MIN_PRODUCTION: MineProduction = MineProduction::new(30);
41 pub const MAX_PRODUCTION: MineProduction = MineProduction::new(2400);
42
43 pub const MIN_SCORE: Score = Score::new(6);
44 pub const MAX_SCORE: Score = Score::new(1187);
45
46 pub const INFRASTRUCTURE_REQUIREMENTS: InfrastructureRequirements =
47 InfrastructureRequirements::none();
48}
49
50impl Default for IronMine {
51 fn default() -> Self {
52 Self {
53 level: BuildingLevel::new(1),
54 enabled: true,
55 }
56 }
57}
58
59check_total_resource_ratio!(
60 IronMine::WOOD_RATIO,
61 IronMine::STONE_RATIO,
62 IronMine::IRON_RATIO,
63);