fix formatting
This commit is contained in:
parent
94c787d8c7
commit
530067f743
@ -147,7 +147,9 @@ impl Level {
|
|||||||
if player.get_immutable_position().get_x() == new_x
|
if player.get_immutable_position().get_x() == new_x
|
||||||
&& player.get_immutable_position().get_y() == new_y
|
&& 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));
|
player.change_life(-(monster_dmg as i16));
|
||||||
if player.is_dead() {
|
if player.is_dead() {
|
||||||
messages.insert(
|
messages.insert(
|
||||||
@ -172,7 +174,9 @@ impl Level {
|
|||||||
// player not dead => monster can occupy new position
|
// player not dead => monster can occupy new position
|
||||||
self.monsters[index].get_position().change(-dx, -dy);
|
self.monsters[index].get_position().change(-dx, -dy);
|
||||||
// player fights back
|
// 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);
|
self.monsters[index].decrease_life(player_dmg);
|
||||||
if self.monsters[index].is_dead() {
|
if self.monsters[index].is_dead() {
|
||||||
let level_up: bool = player
|
let level_up: bool = player
|
||||||
|
Loading…
Reference in New Issue
Block a user