From c8557f3de67d71848a7a4f793405a077b51ee62e Mon Sep 17 00:00:00 2001 From: Mateusz Date: Sat, 30 May 2020 20:30:09 +0200 Subject: [PATCH] good console messages --- src/entities/Interactable.py | 6 ++---- src/entities/Player.py | 7 ++++--- src/game/EventManager.py | 14 +++++++++++--- src/game/Game.py | 2 ++ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/entities/Interactable.py b/src/entities/Interactable.py index f9e53bf..688a242 100644 --- a/src/entities/Interactable.py +++ b/src/entities/Interactable.py @@ -44,10 +44,8 @@ class Interactable(Entity): player.herbs += 1 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) + player.readyToCrafting = True + def __str__(self): return "Entity - ID:{}, pos:({}x, {}y), {}".format(self.id, self.x, self.y, self.classifier.name) diff --git a/src/entities/Player.py b/src/entities/Player.py index f71c946..1ab3f28 100644 --- a/src/entities/Player.py +++ b/src/entities/Player.py @@ -23,6 +23,7 @@ class Player(Entity): self.statistics = Statistics(100, 0, 0, 100) self.herbs = 0 + self.readyToCrafting = False # How many steps has the player taken through its lifetime self.movePoints = 0 # Tracks how much time has passed since the player is alive @@ -58,16 +59,16 @@ class Player(Entity): self.statistics.set_hunger(0.5) # gets more thirsty # self.statistics.set_thirst(2.2) - self.statistics.set_thirst(0.5) + self.statistics.set_thirst(0.8) # gets tired # self.statistics.set_stamina(-1.9) - self.statistics.set_stamina(-0.5) + self.statistics.set_stamina(-0.7) def applyTimeFatigue(self): """ A separate method to lower the statistics. Invoked every frame. """ - self.statistics.set_thirst(0.002) + self.statistics.set_thirst(0.006) self.statistics.set_hunger(0.003) self.statistics.set_stamina(-0.001) diff --git a/src/game/EventManager.py b/src/game/EventManager.py index 2f2a921..a1aa0be 100644 --- a/src/game/EventManager.py +++ b/src/game/EventManager.py @@ -122,11 +122,18 @@ class EventManager: 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 self.player.readyToCrafting: + self.game.screen.ui.console.printToConsole("Eliksir został utworzony i spożyty!") + self.player.statistics.set_hp(100) + self.player.statistics.set_stamina(100) + self.player.statistics.set_thirst(-100) + self.player.statistics.set_hunger(-100) + self.player.readyToCrafting = False + if keys[pygame.K_r]: self.game.map.respawn() @@ -138,8 +145,9 @@ class EventManager: from src.entities.Interactable import Interactable playerPickType = pickWeightedAffinity(self.player.affinities) UiConsole.printToConsole("player picked" + str(playerPickType)) - self.player.gotoToTarget(Random().choice(self.game.map.getInteractablesByClassifier(playerPickType)), - self.game.map) + self.player.gotoToTarget( + Random().choice(self.game.map.getInteractablesByClassifier(playerPickType)), + self.game.map) break except IndexError: pass diff --git a/src/game/Game.py b/src/game/Game.py index 5238747..c5c6758 100644 --- a/src/game/Game.py +++ b/src/game/Game.py @@ -437,6 +437,8 @@ class Game: for i in self.movementList: self.entityToVisitList.append(self.map.getEntityOnCoord(i)) + self.screen.ui.console.printToConsole("First generation: " + str(firstGeneration[0])) self.entityToVisitList.remove(self.entityToVisitList[0]) + self.screen.ui.console.printToConsole("The best generation: " + str(self.entityToVisitList)) self.mainLoop()