# HG changeset patch # User Jeremy Thurgood # Date 1336768163 -7200 # Node ID 6fdc985429a7ccb0637bf1505f91b58ed43c2b5a # Parent 7eead0d854973bc2f6db18d1b69b7e6ee8d4836c Display research advice. diff -r 7eead0d85497 -r 6fdc985429a7 gamelib/gamegui.py --- 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): diff -r 7eead0d85497 -r 6fdc985429a7 gamelib/gamestate.py --- 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"""