comparison gamelib/gamestate.py @ 130:8f717b2b3378

Advance milestone
author Neil Muller <drnlmuller@gmail.com>
date Thu, 10 May 2012 16:46:18 +0200
parents 685301e35f88
children 31ab0af26bb5
comparison
equal deleted inserted replaced
129:be79e113d494 130:8f717b2b3378
3 3
4 """The actual game state object""" 4 """The actual game state object"""
5 5
6 from gamelib import missions, lab 6 from gamelib import missions, lab
7 from gamelib.game_base import get_subclasses 7 from gamelib.game_base import get_subclasses
8 from gamelib.constants import NEW_SCIENCE, NEW_SCHEMATIC, M_VALS 8 from gamelib.constants import (NEW_SCIENCE, NEW_SCHEMATIC, M_VALS, MILESTONES,
9 NEW_MILESTONE)
9 10
10 11
11 class Game(object): 12 class Game(object):
12 13
13 def __init__(self, init_data=None): 14 def __init__(self, init_data=None):
75 # Process mission results 76 # Process mission results
76 messages = [] 77 messages = []
77 for result in mission_results: 78 for result in mission_results:
78 result.apply(self) 79 result.apply(self)
79 messages.append((result.outcome, result.message)) 80 messages.append((result.outcome, result.message))
81 if result.outcome == NEW_MILESTONE:
82 self.milestone = MILESTONES[M_VALS[self.milestone] + 1]
80 for science in new_stuff: 83 for science in new_stuff:
81 # FIXME: Update UI better. 84 # FIXME: Update UI better.
82 if science.SCIENCE_TYPE == 'research': 85 if science.SCIENCE_TYPE == 'research':
83 messages.append((NEW_SCIENCE, 86 messages.append((NEW_SCIENCE,
84 "You've started a new line of research in %s" 87 "You've started a new line of research in %s"