diff --git a/src/game.rs b/src/game.rs index 75bb119..f7729f4 100644 --- a/src/game.rs +++ b/src/game.rs @@ -192,7 +192,7 @@ impl Game { 0, format!("you hit {} for {} damage.", m.get_name(), player_dmg).to_string(), ); - let monster_dmg =m.damage().saturating_sub(self.player.defense()); + let monster_dmg = m.damage().saturating_sub(self.player.defense()); self.player.change_life(-(monster_dmg as i16)); self.messages.insert( diff --git a/src/level.rs b/src/level.rs index 8189438..01a2065 100644 --- a/src/level.rs +++ b/src/level.rs @@ -147,7 +147,9 @@ impl Level { if player.get_immutable_position().get_x() == new_x && player.get_immutable_position().get_y() == new_y { - let monster_dmg =self.monsters[index].damage().saturating_sub(player.defense()); + let monster_dmg = self.monsters[index] + .damage() + .saturating_sub(player.defense()); player.change_life(-(monster_dmg as i16)); if player.is_dead() { messages.insert( @@ -172,7 +174,9 @@ impl Level { // player not dead => monster can occupy new position self.monsters[index].get_position().change(-dx, -dy); // player fights back - let player_dmg = player.damage().saturating_sub(self.monsters[index].defense()); + let player_dmg = player + .damage() + .saturating_sub(self.monsters[index].defense()); self.monsters[index].decrease_life(player_dmg); if self.monsters[index].is_dead() { let level_up: bool = player