diff options
Diffstat (limited to 'dungeon/src/entity.rs')
| -rw-r--r-- | dungeon/src/entity.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/dungeon/src/entity.rs b/dungeon/src/entity.rs index 5b4ac38..22ac3e5 100644 --- a/dungeon/src/entity.rs +++ b/dungeon/src/entity.rs @@ -1,6 +1,6 @@ //! The `entity` module contains structures of all entities including players and enimies. -use std::mem::take; +use std::{fmt::Display, mem::take}; use rand::Rng; @@ -71,6 +71,17 @@ impl Item { matches!(self, Self::HealthPotion | Self::SpeedPotion) } } +impl Display for Item { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::HeartFragment => f.write_str("Heart Fragment"), + Self::HealthPotion => f.write_str("Health Potion"), + Self::SpeedPotion => f.write_str("Speed Potion"), + Self::Bomb => f.write_str("Bomb"), + Self::LargeBomb => f.write_str("Large Bomb"), + } + } +} /// Different speed entities can move #[repr(u8)] |