good console messages

This commit is contained in:
Mateusz 2020-05-30 20:30:09 +02:00
parent 5c8a48e30d
commit c8557f3de6
4 changed files with 19 additions and 10 deletions

View File

@ -44,10 +44,8 @@ class Interactable(Entity):
player.herbs += 1 player.herbs += 1
if player.herbs == 10 and self.classifier == Classifiers.REST: if player.herbs == 10 and self.classifier == Classifiers.REST:
player.statistics.set_hp(100) player.readyToCrafting = True
player.statistics.set_stamina(100)
player.statistics.set_thirst(-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)

View File

@ -23,6 +23,7 @@ class Player(Entity):
self.statistics = Statistics(100, 0, 0, 100) self.statistics = Statistics(100, 0, 0, 100)
self.herbs = 0 self.herbs = 0
self.readyToCrafting = False
# How many steps has the player taken through its lifetime # How many steps has the player taken through its lifetime
self.movePoints = 0 self.movePoints = 0
# Tracks how much time has passed since the player is alive # Tracks how much time has passed since the player is alive
@ -58,16 +59,16 @@ class Player(Entity):
self.statistics.set_hunger(0.5) self.statistics.set_hunger(0.5)
# gets more thirsty # gets more thirsty
# self.statistics.set_thirst(2.2) # self.statistics.set_thirst(2.2)
self.statistics.set_thirst(0.5) self.statistics.set_thirst(0.8)
# gets tired # gets tired
# self.statistics.set_stamina(-1.9) # self.statistics.set_stamina(-1.9)
self.statistics.set_stamina(-0.5) self.statistics.set_stamina(-0.7)
def applyTimeFatigue(self): def applyTimeFatigue(self):
""" """
A separate method to lower the statistics. Invoked every frame. 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_hunger(0.003)
self.statistics.set_stamina(-0.001) self.statistics.set_stamina(-0.001)

View File

@ -122,11 +122,18 @@ class EventManager:
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: if self.player.herbs > self.takenHerbs:
self.game.screen.ui.console.printToConsole("Ziele zebrane! Ilość: " + str(self.player.herbs)) self.game.screen.ui.console.printToConsole("Ziele zebrane! Ilość: " + str(self.player.herbs))
self.takenHerbs = 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]: if keys[pygame.K_r]:
self.game.map.respawn() self.game.map.respawn()
@ -138,7 +145,8 @@ class EventManager:
from src.entities.Interactable import Interactable from src.entities.Interactable import Interactable
playerPickType = pickWeightedAffinity(self.player.affinities) playerPickType = pickWeightedAffinity(self.player.affinities)
UiConsole.printToConsole("player picked" + str(playerPickType)) UiConsole.printToConsole("player picked" + str(playerPickType))
self.player.gotoToTarget(Random().choice(self.game.map.getInteractablesByClassifier(playerPickType)), self.player.gotoToTarget(
Random().choice(self.game.map.getInteractablesByClassifier(playerPickType)),
self.game.map) self.game.map)
break break
except IndexError: except IndexError:

View File

@ -437,6 +437,8 @@ class Game:
for i in self.movementList: for i in self.movementList:
self.entityToVisitList.append(self.map.getEntityOnCoord(i)) self.entityToVisitList.append(self.map.getEntityOnCoord(i))
self.screen.ui.console.printToConsole("First generation: " + str(firstGeneration[0]))
self.entityToVisitList.remove(self.entityToVisitList[0]) self.entityToVisitList.remove(self.entityToVisitList[0])
self.screen.ui.console.printToConsole("The best generation: " + str(self.entityToVisitList))
self.mainLoop() self.mainLoop()