tavern_keeper/src/events/found_town.rs

22 lines
489 B
Rust
Raw Normal View History

2022-12-31 07:54:18 +00:00
use std::rc::Rc;
2023-01-04 13:37:25 +00:00
use crate::{state::Action, world::{Town, Structure}, state::GameState, entity::Location};
2022-12-31 07:54:18 +00:00
pub struct FoundTown{
2023-01-04 13:37:25 +00:00
pub loc: Location,
2022-12-31 07:54:18 +00:00
pub town: Rc<Town>,
}
2023-01-04 13:37:25 +00:00
impl Action for FoundTown {
2022-12-31 07:54:18 +00:00
fn apply(&self, state: &mut GameState) {
2023-01-04 13:37:25 +00:00
state.world.add_structure(self.loc, Structure::Town(self.town.clone()));
2022-12-31 07:54:18 +00:00
}
fn description(&self) -> String {
format!("{} was founded", self.town.name)
}
2023-01-04 13:37:25 +00:00
fn notable(&self) -> bool {
true
}
2022-12-31 07:54:18 +00:00
}