Initial commit, implements most of the static_data side.

This commit is contained in:
2021-01-30 22:29:59 +01:00
commit 2a08fb2645
33 changed files with 1237 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
use super::item_category::{BattleItemCategory, ItemCategory};
use derive_getters::Getters;
use std::collections::HashSet;
#[derive(Getters, Debug)]
pub struct Item {
name: String,
category: ItemCategory,
battle_category: BattleItemCategory,
price: i32,
flags: HashSet<String>,
}
impl Item {
pub fn new(
name: &str,
category: ItemCategory,
battle_category: BattleItemCategory,
price: i32,
flags: HashSet<String>,
) -> Item {
Item {
name: name.to_string(),
category,
battle_category,
price,
flags,
}
}
pub fn has_flag(&self, key: &str) -> bool {
self.flags.contains(key)
}
}