Add proper death message when food recognition failed

This commit is contained in:
Michał Czekański 2020-06-15 14:52:55 +02:00
parent e132a1ceaf
commit c5497ff291
2 changed files with 5 additions and 0 deletions

View File

@ -192,6 +192,7 @@ class Game:
self.spritesList.draw(self.screen.pygameScreen) self.spritesList.draw(self.screen.pygameScreen)
pygame.display.flip() pygame.display.flip()
self.running = False self.running = False
continue
# Choose target for player using decision tree # Choose target for player using decision tree
if self.player.movementTarget is None: if self.player.movementTarget is None:
@ -205,6 +206,7 @@ class Game:
else: else:
self.screen.ui.console.printToConsole("I was wrong") self.screen.ui.console.printToConsole("I was wrong")
self.player.alive = False self.player.alive = False
self.player.deathReason = "Wrong food recognition"
continue continue
self.player.gotoToTarget(survivalDecisionTree.pickEntity(self.player, self.map), self.map) self.player.gotoToTarget(survivalDecisionTree.pickEntity(self.player, self.map), self.map)
@ -433,6 +435,7 @@ class Game:
self.spritesList.draw(self.screen.pygameScreen) self.spritesList.draw(self.screen.pygameScreen)
pygame.display.flip() pygame.display.flip()
self.running = False self.running = False
continue
# Choose target for player using decision tree # Choose target for player using decision tree
if self.player.movementTarget is None: if self.player.movementTarget is None:

View File

@ -187,6 +187,8 @@ class Ui:
deathReasonString = "Exhaustion" deathReasonString = "Exhaustion"
elif deathReason is StatisticNames.THIRST: elif deathReason is StatisticNames.THIRST:
deathReasonString = "Dehydration" deathReasonString = "Dehydration"
else:
deathReasonString = "Wrong food recognition"
consoleLines.append("Death reason: " + deathReasonString) consoleLines.append("Death reason: " + deathReasonString)