diff --git a/src/entities/Interactable.py b/src/entities/Interactable.py index 076bd9c..f9e53bf 100644 --- a/src/entities/Interactable.py +++ b/src/entities/Interactable.py @@ -29,27 +29,25 @@ class Interactable(Entity): elif classifier == "herb": self.classifier = Classifiers.HERB - def on_interaction(self, Player): + def on_interaction(self, player): """ Applies outcome to the Player :param Player: Player object """ - Player.statistics.set_hp(self.Statistics.hp) - Player.statistics.set_stamina(self.Statistics.stamina) - Player.statistics.set_thirst(self.Statistics.thirst) - Player.statistics.set_hunger(self.Statistics.hunger) + player.statistics.set_hp(self.Statistics.hp) + player.statistics.set_stamina(self.Statistics.stamina) + player.statistics.set_thirst(self.Statistics.thirst) + player.statistics.set_hunger(self.Statistics.hunger) if self.classifier == Classifiers.HERB: - Player.herbs += 1 - print(Player.herbs) + player.herbs += 1 - if Player.herbs == 10 and self.classifier == Classifiers.REST: - print("Should reset") - Player.statistics.set_hp(100) - Player.statistics.set_stamina(100) - Player.statistics.set_thirst(-100) - Player.statistics.set_hunger(-100) + if player.herbs == 10 and self.classifier == Classifiers.REST: + player.statistics.set_hp(100) + player.statistics.set_stamina(100) + player.statistics.set_thirst(-100) + player.statistics.set_hunger(-100) def __str__(self): return "Entity - ID:{}, pos:({}x, {}y), {}".format(self.id, self.x, self.y, self.classifier.name) diff --git a/src/game/EventManager.py b/src/game/EventManager.py index 8789821..2f2a921 100644 --- a/src/game/EventManager.py +++ b/src/game/EventManager.py @@ -26,6 +26,8 @@ class EventManager: self.iterator = 0 + self.takenHerbs = self.player.herbs + # TODO def loadKeyboardSettings(self): pass @@ -115,11 +117,16 @@ class EventManager: self.player.gotoToTarget(target, self.game.map) if keys[pygame.K_t]: - if self.player.movementTarget is None: + if self.player.movementTarget is None and self.iterator <= 10: target = self.game.entityToVisitList[self.iterator] self.player.gotoToTarget(target, self.game.map) self.iterator += 1 + + if self.player.herbs > self.takenHerbs: + self.game.screen.ui.console.printToConsole("Ziele zebrane! Ilość: " + str(self.player.herbs)) + self.takenHerbs = self.player.herbs + if keys[pygame.K_r]: self.game.map.respawn()