updated deps

fixed clippy remarks
This commit is contained in:
2024-10-20 14:59:20 +02:00
parent 210d590e38
commit efc4cdd363
12 changed files with 515 additions and 221 deletions

View File

@@ -23,7 +23,7 @@ impl Player {
}
}
pub fn get_name(&self) -> String {
return self.name.clone();
self.name.clone()
}
pub fn change_life(&mut self, by: i16) {
self.life = max(0, min(self.max_life, self.life + by));
@@ -32,22 +32,34 @@ impl Player {
self.life
}
/// returns true if the player is dead (life <= 0)
pub fn is_dead(&self) -> bool { self.life <= 0 }
pub fn is_dead(&self) -> bool {
self.life <= 0
}
/// returns true if the player's life is at maximum
pub fn is_healthy(&self) -> bool { self.life == self.max_life }
pub fn is_healthy(&self) -> bool {
self.life == self.max_life
}
pub fn get_max_life(&self) -> i16 {
self.max_life
}
/// add the given amount to the players gold stash
pub fn retrieve_gold(&mut self, amount: usize) { self.gold += amount }
pub fn retrieve_gold(&mut self, amount: usize) {
self.gold += amount
}
/// return the size of the players gold stash
pub fn get_gold(&self) -> usize { self.gold }
pub fn get_gold(&self) -> usize {
self.gold
}
pub fn gain_experience(&mut self, amount: usize) { self.experience += amount }
pub fn gain_experience(&mut self, amount: usize) {
self.experience += amount
}
pub fn get_experience(&self) -> usize { self.experience }
pub fn get_experience(&self) -> usize {
self.experience
}
}
impl HasPosition for Player {