First pass on the logs

The newly-added logs manage a list of messages. Entities do register a
message to it when hitting each other. Display is created, but not yet
added to the layout actually displayed.
This commit is contained in:
Nicolas Margulies
2020-11-19 12:03:05 +01:00
parent 9b00863891
commit 6e71146aa2
6 changed files with 54 additions and 7 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

@ -70,7 +70,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