print message to console when agent take the herb works
This commit is contained in:
parent
14850cd230
commit
5c8a48e30d
@ -29,27 +29,25 @@ class Interactable(Entity):
|
|||||||
elif classifier == "herb":
|
elif classifier == "herb":
|
||||||
self.classifier = Classifiers.HERB
|
self.classifier = Classifiers.HERB
|
||||||
|
|
||||||
def on_interaction(self, Player):
|
def on_interaction(self, player):
|
||||||
"""
|
"""
|
||||||
Applies outcome to the Player
|
Applies outcome to the Player
|
||||||
|
|
||||||
:param Player: Player object
|
:param Player: Player object
|
||||||
"""
|
"""
|
||||||
Player.statistics.set_hp(self.Statistics.hp)
|
player.statistics.set_hp(self.Statistics.hp)
|
||||||
Player.statistics.set_stamina(self.Statistics.stamina)
|
player.statistics.set_stamina(self.Statistics.stamina)
|
||||||
Player.statistics.set_thirst(self.Statistics.thirst)
|
player.statistics.set_thirst(self.Statistics.thirst)
|
||||||
Player.statistics.set_hunger(self.Statistics.hunger)
|
player.statistics.set_hunger(self.Statistics.hunger)
|
||||||
|
|
||||||
if self.classifier == Classifiers.HERB:
|
if self.classifier == Classifiers.HERB:
|
||||||
Player.herbs += 1
|
player.herbs += 1
|
||||||
print(Player.herbs)
|
|
||||||
|
|
||||||
if Player.herbs == 10 and self.classifier == Classifiers.REST:
|
if player.herbs == 10 and self.classifier == Classifiers.REST:
|
||||||
print("Should reset")
|
player.statistics.set_hp(100)
|
||||||
Player.statistics.set_hp(100)
|
player.statistics.set_stamina(100)
|
||||||
Player.statistics.set_stamina(100)
|
player.statistics.set_thirst(-100)
|
||||||
Player.statistics.set_thirst(-100)
|
player.statistics.set_hunger(-100)
|
||||||
Player.statistics.set_hunger(-100)
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Entity - ID:{}, pos:({}x, {}y), {}".format(self.id, self.x, self.y, self.classifier.name)
|
return "Entity - ID:{}, pos:({}x, {}y), {}".format(self.id, self.x, self.y, self.classifier.name)
|
||||||
|
@ -26,6 +26,8 @@ class EventManager:
|
|||||||
|
|
||||||
self.iterator = 0
|
self.iterator = 0
|
||||||
|
|
||||||
|
self.takenHerbs = self.player.herbs
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
def loadKeyboardSettings(self):
|
def loadKeyboardSettings(self):
|
||||||
pass
|
pass
|
||||||
@ -115,11 +117,16 @@ class EventManager:
|
|||||||
self.player.gotoToTarget(target, self.game.map)
|
self.player.gotoToTarget(target, self.game.map)
|
||||||
|
|
||||||
if keys[pygame.K_t]:
|
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]
|
target = self.game.entityToVisitList[self.iterator]
|
||||||
self.player.gotoToTarget(target, self.game.map)
|
self.player.gotoToTarget(target, self.game.map)
|
||||||
self.iterator += 1
|
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]:
|
if keys[pygame.K_r]:
|
||||||
self.game.map.respawn()
|
self.game.map.respawn()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user