pub trait Building: Send + Sync {
Show 32 methods
// Required methods
fn id(&self) -> BuildingId;
fn is_enabled(&self) -> bool;
fn toggle(&mut self, enabled: bool);
fn level(&self) -> BuildingLevel;
fn min_level(&self) -> BuildingLevel;
fn max_level(&self) -> BuildingLevel;
fn set_level(&mut self, level: BuildingLevel);
fn increase_level_by(&mut self, amount: u8);
fn decrease_level_by(&mut self, amount: u8);
fn min_cost(&self) -> Cost;
fn max_cost(&self) -> Cost;
fn wood_ratio(&self) -> ResourceRatio;
fn stone_ratio(&self) -> ResourceRatio;
fn iron_ratio(&self) -> ResourceRatio;
fn maintenance(&self, stats: &BuildingStatsTable) -> Result<Maintenance>;
fn maintenance_ratio(&self) -> MaintenanceRatio;
fn min_workforce(&self) -> Workforce;
fn max_workforce(&self) -> Workforce;
fn score(&self, stats: &BuildingStatsTable) -> Result<Score>;
fn min_score(&self) -> Score;
fn max_score(&self) -> Score;
fn infrastructure_requirements(&self) -> &InfrastructureRequirements;
// Provided methods
fn set_min_level(&mut self) { ... }
fn set_max_level(&mut self) { ... }
fn increase_level(&mut self) { ... }
fn decrease_level(&mut self) { ... }
fn is_min_level(&self) -> bool { ... }
fn is_max_level(&self) -> bool { ... }
fn is_civil(&self) -> bool { ... }
fn is_military(&self) -> bool { ... }
fn is_mine(&self) -> bool { ... }
fn is_storage(&self) -> bool { ... }
}Required Methods§
fn id(&self) -> BuildingId
Sourcefn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Checks whether the building is enabled.
Sourcefn level(&self) -> BuildingLevel
fn level(&self) -> BuildingLevel
Current building level.
Sourcefn min_level(&self) -> BuildingLevel
fn min_level(&self) -> BuildingLevel
Minimum building level.
Sourcefn max_level(&self) -> BuildingLevel
fn max_level(&self) -> BuildingLevel
Maximum building level.
Sourcefn set_level(&mut self, level: BuildingLevel)
fn set_level(&mut self, level: BuildingLevel)
Sets the building’s level while ensuring it remains within the level limit.
Sourcefn increase_level_by(&mut self, amount: u8)
fn increase_level_by(&mut self, amount: u8)
Increases the level of the building by a certain amount, if possible.
Sourcefn decrease_level_by(&mut self, amount: u8)
fn decrease_level_by(&mut self, amount: u8)
Decreases the level of the building by a certain amount, if possible.
Sourcefn wood_ratio(&self) -> ResourceRatio
fn wood_ratio(&self) -> ResourceRatio
Percentage of the total cost related to wood.
Sourcefn stone_ratio(&self) -> ResourceRatio
fn stone_ratio(&self) -> ResourceRatio
Percentage of the total cost related to stone.
Sourcefn iron_ratio(&self) -> ResourceRatio
fn iron_ratio(&self) -> ResourceRatio
Percentage of the total cost related to iron.
Sourcefn maintenance(&self, stats: &BuildingStatsTable) -> Result<Maintenance>
fn maintenance(&self, stats: &BuildingStatsTable) -> Result<Maintenance>
Building maintenance tax at its current level.
Sourcefn maintenance_ratio(&self) -> MaintenanceRatio
fn maintenance_ratio(&self) -> MaintenanceRatio
Proportion of the base cost used as a maintenance tax.
Sourcefn min_workforce(&self) -> Workforce
fn min_workforce(&self) -> Workforce
Workforce required for the minimum level of the building.
Sourcefn max_workforce(&self) -> Workforce
fn max_workforce(&self) -> Workforce
Workforce required for the maximum level of the building.
fn score(&self, stats: &BuildingStatsTable) -> Result<Score>
fn min_score(&self) -> Score
fn max_score(&self) -> Score
Sourcefn infrastructure_requirements(&self) -> &InfrastructureRequirements
fn infrastructure_requirements(&self) -> &InfrastructureRequirements
Levels required to construct the building.
Provided Methods§
Sourcefn set_min_level(&mut self)
fn set_min_level(&mut self)
Sets the building to its minimum level.
Sourcefn set_max_level(&mut self)
fn set_max_level(&mut self)
Sets the building to its maximum level.
Sourcefn increase_level(&mut self)
fn increase_level(&mut self)
Increases the building level by one, if possible.
Sourcefn decrease_level(&mut self)
fn decrease_level(&mut self)
Decreases the building level by one, if possible.
Sourcefn is_min_level(&self) -> bool
fn is_min_level(&self) -> bool
Checks whether the building is at its minimum level.
Sourcefn is_max_level(&self) -> bool
fn is_max_level(&self) -> bool
Checks whether the building is at its maximum level.