make variable inventory slots

This commit is contained in:
2024-10-22 13:39:43 +02:00
parent 5949b2a2d6
commit 9ae713b6c8
3 changed files with 14 additions and 10 deletions

View File

@@ -72,15 +72,21 @@ impl Potion {
was_collected: false,
}
}
pub fn get_health(&self) -> usize {
self.health
}
}
impl Artifact for Potion {
fn get_representation(&self) -> (&str, Color) {
("P", Color::Green)
}
fn get_immutable_position(&self) -> &Position {
&self.position
}
fn collect(&mut self, player: &mut Player, messages: &mut Vec<String>) {
// only consume potion of the player can gain at least one health point
if !player.is_healthy() {
@@ -105,8 +111,3 @@ impl Artifact for Potion {
self.was_collected
}
}
impl Potion {
pub fn get_health(&self) -> usize {
self.health
}
}