diff options
Diffstat (limited to 'dungeon/src/entity.rs')
| -rw-r--r-- | dungeon/src/entity.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/dungeon/src/entity.rs b/dungeon/src/entity.rs index 22d66e0..a0750dd 100644 --- a/dungeon/src/entity.rs +++ b/dungeon/src/entity.rs @@ -310,11 +310,31 @@ impl Entity { } } +/// The current "weapon" level we have +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum Weapon { + RustyKnife, + ShiningBlade, + GodlyBlade, +} +impl Weapon { + /// Returns the number of hit points of damage this weapon does + #[must_use] + pub const fn attack_dmg(self) -> u32 { + match self { + Self::RustyKnife => 2, + Self::ShiningBlade => 3, + Self::GodlyBlade => 5, + } + } +} + /// The `Player` type represents the main player entity #[derive(Clone, Debug, PartialEq)] pub struct Player { pub entity: Entity, pub inventory: Vec<Item>, + pub weapon: Weapon, // How long until we reset potion effects? pub potion_timer: Option<Instant>, } @@ -332,10 +352,12 @@ impl Player { pub const fn new(pos: Pos) -> Self { let entity = Entity::player(pos); let inventory = vec![]; + let weapon = Weapon::RustyKnife; let potion_timer = None; Self { entity, inventory, + weapon, potion_timer, } } |