Mercurial > sypikslang
changeset 161:6fdc985429a7
Display research advice.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Fri, 11 May 2012 22:29:23 +0200 |
parents | 7eead0d85497 |
children | 16e64557d85c |
files | gamelib/gamegui.py gamelib/gamestate.py |
diffstat | 2 files changed, 20 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/gamegui.py Fri May 11 22:26:39 2012 +0200 +++ b/gamelib/gamegui.py Fri May 11 22:29:23 2012 +0200 @@ -261,9 +261,9 @@ class ValueLabel(TextLabel): - def __init__(self, pos, description): + def __init__(self, pos, description, width=300): self.description = description - rect = (pos[0], pos[1], 300, 20) + rect = (pos[0], pos[1], width, 20) super(ValueLabel, self).__init__(rect, '%s : 0' % description, font_medium, (255, 255, 0)) @@ -448,7 +448,7 @@ self.points = ValueLabel((10, 75), 'Available Human Resources') self.add_child(self.points) - self.minions = ValueLabel((310, 75), 'Minions available: ') + self.minions = ValueLabel((310, 75), 'Minions available') self.add_child(self.minions) self.money = ValueLabel((510, 75), 'Money') self.add_child(self.money) @@ -458,12 +458,16 @@ self.reputation = ValueLabel((310, 95), 'Reputation') self.add_child(self.reputation) + self.advice = ValueLabel((10, 115), 'Research advice', width=780) + self.add_child(self.advice) + def update_labels(self): self.points.set_value(self.game.get_available_points()) self.money.set_value(self.game.money) self.minions.set_value(self.game.minions) self.milestone.set_value(self.game.milestone) self.reputation.set_value(_lookup_reputation(self.game.reputation)) + self.advice.set_value(self.game.advice) class ActivityWindow(GameStateWindow):
--- a/gamelib/gamestate.py Fri May 11 22:26:39 2012 +0200 +++ b/gamelib/gamestate.py Fri May 11 22:29:23 2012 +0200 @@ -3,6 +3,8 @@ """The actual game state object""" +from random import choice + from gamelib import missions, lab from gamelib.game_base import get_subclasses from gamelib.constants import M_VALS, INFO @@ -39,6 +41,17 @@ self.turn += 1 self.cur_missions = [] self.cur_allocation = [] + # Suggest research + basic_research, suggestions = self.lab.suggest_research() + if basic_research: + suggestions.append(None) + self.advice = choice(suggestions) + if self.advice is None: + self.advice = ("Leave some researchers unassigned." + " They might turn up something cool.") + else: + self.advice = "Our work in %s is looking promising." % ( + self.advice.NAME,) def get_available_equipment(self): """Return a list of equipment we can produce and afford"""