2019-07-26 21:01:41 +00:00
|
|
|
use specs::{Component, FlaggedStorage};
|
2019-07-29 19:54:48 +00:00
|
|
|
use specs_idvs::IDVStorage;
|
2019-05-18 16:46:14 +00:00
|
|
|
|
2019-06-28 23:42:51 +00:00
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
|
|
pub enum Weapon {
|
|
|
|
Daggers,
|
|
|
|
SwordShield,
|
|
|
|
Sword,
|
|
|
|
Axe,
|
|
|
|
Hammer,
|
|
|
|
Bow,
|
|
|
|
Staff,
|
|
|
|
}
|
|
|
|
pub const ALL_WEAPONS: [Weapon; 7] = [
|
|
|
|
Weapon::Daggers,
|
|
|
|
Weapon::SwordShield,
|
|
|
|
Weapon::Sword,
|
|
|
|
Weapon::Axe,
|
|
|
|
Weapon::Hammer,
|
|
|
|
Weapon::Bow,
|
|
|
|
Weapon::Staff,
|
|
|
|
];
|
|
|
|
|
2019-05-18 16:46:14 +00:00
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
|
|
pub enum Armor {
|
2019-06-06 14:48:41 +00:00
|
|
|
// TODO: Don't make armor be a body part. Wearing enemy's head is funny but also creepy thing to do.
|
2019-06-28 08:24:13 +00:00
|
|
|
Helmet,
|
2019-06-28 23:42:51 +00:00
|
|
|
Shoulders,
|
|
|
|
Chestplate,
|
|
|
|
Belt,
|
|
|
|
Gloves,
|
|
|
|
Pants,
|
|
|
|
Boots,
|
2019-05-18 16:46:14 +00:00
|
|
|
Back,
|
|
|
|
Tabard,
|
|
|
|
Gem,
|
|
|
|
Necklace,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
|
|
pub enum Item {
|
|
|
|
Weapon {
|
2019-07-25 22:52:28 +00:00
|
|
|
kind: Weapon,
|
2019-05-18 16:46:14 +00:00
|
|
|
damage: i32,
|
|
|
|
strength: i32,
|
|
|
|
},
|
|
|
|
Armor {
|
2019-07-25 22:52:28 +00:00
|
|
|
kind: Armor,
|
2019-05-18 16:46:14 +00:00
|
|
|
defense: i32,
|
|
|
|
health_bonus: i32,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2019-07-25 22:52:28 +00:00
|
|
|
impl Default for Item {
|
|
|
|
fn default() -> Self {
|
|
|
|
Item::Weapon {
|
|
|
|
kind: Weapon::Hammer,
|
|
|
|
damage: 0,
|
|
|
|
strength: 0,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-18 16:46:14 +00:00
|
|
|
impl Component for Item {
|
2019-07-26 21:01:41 +00:00
|
|
|
type Storage = FlaggedStorage<Self, IDVStorage<Self>>;
|
2019-05-18 16:46:14 +00:00
|
|
|
}
|