tavern_keeper/src/events/found_town.rs

19 lines
438 B
Rust
Raw Normal View History

2022-12-31 07:54:18 +00:00
use std::rc::Rc;
use crate::{state::Effect, world::{Town, Structure}, state::GameState};
pub struct FoundTown{
pub x: usize,
pub y: usize,
pub town: Rc<Town>,
}
impl Effect for FoundTown {
fn apply(&self, state: &mut GameState) {
state.world.add_structure(self.x, self.y, Structure::Town(self.town.clone()));
}
fn description(&self) -> String {
format!("{} was founded", self.town.name)
}
}