Mercurial > sypikslang
diff gamelib/gamestate.py @ 138:14917385a0fd
Better handling of mission results and turn-end messages.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Thu, 10 May 2012 22:33:26 +0200 |
parents | fb8037bc22f1 |
children | f4601492020b |
line wrap: on
line diff
--- a/gamelib/gamestate.py Thu May 10 20:56:40 2012 +0200 +++ b/gamelib/gamestate.py Thu May 10 22:33:26 2012 +0200 @@ -5,8 +5,7 @@ from gamelib import missions, lab from gamelib.game_base import get_subclasses -from gamelib.constants import (NEW_SCIENCE, NEW_SCHEMATIC, M_VALS, MILESTONES, - NEW_MILESTONE) +from gamelib.constants import M_VALS, INFO class Game(object): @@ -61,6 +60,10 @@ def get_available_points(self): return self.points - len(self.cur_allocation) + def apply_mission_special(self, new_milestone=None): + if new_milestone: + self.milestone = new_milestone + def end_turn(self): # Attempt the missions mission_results = [] @@ -80,18 +83,11 @@ messages = [] for result in mission_results: result.apply(self) - messages.append((result.outcome, result.text)) - if result.outcome == NEW_MILESTONE: - self.milestone = MILESTONES[M_VALS[self.milestone] + 1] + messages.append((result.outcome, result.text, result.loot)) for science in new_stuff: # FIXME: Update UI better. - if science.SCIENCE_TYPE == 'research': - messages.append((NEW_SCIENCE, - "You've started a new line of research in %s" - % science.NAME)) - else: - messages.append((NEW_SCHEMATIC, - "You've developed blueprints for a %s" % science.NAME)) + messages.append((INFO, "SCIENCE breakthrough!", { + science.SCIENCE_TYPE: science})) return messages def save_data(self):