summaryrefslogtreecommitdiff
path: root/dungeon/src/entity.rs
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-11-20 20:27:50 -0500
committerFreya Murphy <freya@freyacat.org>2025-11-20 20:27:50 -0500
commitff627e369f83fdaab8e90016529521b0e07d5e34 (patch)
tree68a416a471af35334ed4a4b743eb8823ac67a00d /dungeon/src/entity.rs
parentgame: fix inv slot select (diff)
downloadDungeonCrawl-ff627e369f83fdaab8e90016529521b0e07d5e34.tar.gz
DungeonCrawl-ff627e369f83fdaab8e90016529521b0e07d5e34.tar.bz2
DungeonCrawl-ff627e369f83fdaab8e90016529521b0e07d5e34.zip
dungeon: add chest usage/textures
Diffstat (limited to 'dungeon/src/entity.rs')
-rw-r--r--dungeon/src/entity.rs13
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)]