Skip to main content

Building

Trait Building 

Source
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§

Source

fn id(&self) -> BuildingId

Source

fn is_enabled(&self) -> bool

Checks whether the building is enabled.

Source

fn toggle(&mut self, enabled: bool)

Enables or disables the building.

Source

fn level(&self) -> BuildingLevel

Current building level.

Source

fn min_level(&self) -> BuildingLevel

Minimum building level.

Source

fn max_level(&self) -> BuildingLevel

Maximum building level.

Source

fn set_level(&mut self, level: BuildingLevel)

Sets the building’s level while ensuring it remains within the level limit.

Source

fn increase_level_by(&mut self, amount: u8)

Increases the level of the building by a certain amount, if possible.

Source

fn decrease_level_by(&mut self, amount: u8)

Decreases the level of the building by a certain amount, if possible.

Source

fn min_cost(&self) -> Cost

Total cost for the minimum level of the building.

Source

fn max_cost(&self) -> Cost

Total cost for the maximum level of the building.

Source

fn wood_ratio(&self) -> ResourceRatio

Percentage of the total cost related to wood.

Source

fn stone_ratio(&self) -> ResourceRatio

Percentage of the total cost related to stone.

Source

fn iron_ratio(&self) -> ResourceRatio

Percentage of the total cost related to iron.

Source

fn maintenance(&self, stats: &BuildingStatsTable) -> Result<Maintenance>

Building maintenance tax at its current level.

Source

fn maintenance_ratio(&self) -> MaintenanceRatio

Proportion of the base cost used as a maintenance tax.

Source

fn min_workforce(&self) -> Workforce

Workforce required for the minimum level of the building.

Source

fn max_workforce(&self) -> Workforce

Workforce required for the maximum level of the building.

Source

fn score(&self, stats: &BuildingStatsTable) -> Result<Score>

Source

fn min_score(&self) -> Score

Source

fn max_score(&self) -> Score

Source

fn infrastructure_requirements(&self) -> &InfrastructureRequirements

Levels required to construct the building.

Provided Methods§

Source

fn set_min_level(&mut self)

Sets the building to its minimum level.

Source

fn set_max_level(&mut self)

Sets the building to its maximum level.

Source

fn increase_level(&mut self)

Increases the building level by one, if possible.

Source

fn decrease_level(&mut self)

Decreases the building level by one, if possible.

Source

fn is_min_level(&self) -> bool

Checks whether the building is at its minimum level.

Source

fn is_max_level(&self) -> bool

Checks whether the building is at its maximum level.

Source

fn is_civil(&self) -> bool

Source

fn is_military(&self) -> bool

Source

fn is_mine(&self) -> bool

Source

fn is_storage(&self) -> bool

Implementors§