Merge branch 'game-logs' into 'master'

Game logs, see #12

See merge request ynerant/squirrel-battle!18
This commit is contained in:
ynerant
2020-11-19 22:48:39 +01:00
9 changed files with 86 additions and 12 deletions

View File

@ -44,7 +44,7 @@ class Monster(FightingEntity):
next_y, next_x = target.paths[(self.y, self.x)]
moved = self.check_move(next_y, next_x, True)
if not moved and self.distance_squared(target) <= 1:
self.hit(target)
self.map.logs.add_message(self.hit(target))
else:
for _ in range(100):
if choice([self.move_up, self.move_down,

View File

@ -72,7 +72,7 @@ class Player(FightingEntity):
for entity in self.map.entities:
if entity.y == y and entity.x == x:
if entity.is_fighting_entity():
self.hit(entity)
self.map.logs.add_message(self.hit(entity))
if entity.dead:
self.add_xp(randint(3, 7))
return True