tavern_keeper/src/events/item.rs

21 lines
484 B
Rust

use crate::{entity::EntityId, item::Item, state::{Action, GameState, self}};
pub struct ItemCrafted {
pub crafter: EntityId,
pub item: Item,
}
impl Action for ItemCrafted {
fn apply(&self, state: &mut GameState) {
let item_id = state.add_item(self.item.clone());
state.claim_item(self.crafter, item_id);
}
fn description(&self) -> String {
format!("{} crafted", self.item.name)
}
fn notable(&self) -> bool {
true
}
}