comparison gamelib/gamestate.py @ 81:59afe9f92383

Hook up basic results screen
author Neil Muller <drnlmuller@gmail.com>
date Wed, 09 May 2012 13:03:39 +0200
parents a40a76012bd7
children b0d97d51df51
comparison
equal deleted inserted replaced
80:a40a76012bd7 81:59afe9f92383
13 def __init__(self, init_data=None): 13 def __init__(self, init_data=None):
14 self.money = 1000 14 self.money = 1000
15 # Will be updated on the next turn 15 # Will be updated on the next turn
16 self.points = 0 16 self.points = 0
17 self.reputation = 0 17 self.reputation = 0
18 self.turn = 0
18 # Missions being attempted 19 # Missions being attempted
19 self.cur_missions = [] 20 self.cur_missions = []
20 # Science allocation for the current turn 21 # Science allocation for the current turn
21 self.cur_allocation = [] 22 self.cur_allocation = []
22 self.lab = None 23 self.lab = None
30 self.missions.append(cls()) 31 self.missions.append(cls())
31 32
32 def start_turn(self): 33 def start_turn(self):
33 # Make more flexible? 34 # Make more flexible?
34 self.points += 3 35 self.points += 3
36 self.turn += 1
35 self.cur_missions = [] 37 self.cur_missions = []
36 self.cur_allocation = [] 38 self.cur_allocation = []
37 39
38 def get_available_equipment(self): 40 def get_available_equipment(self):
39 """Return a list of equipment we can produce and afford""" 41 """Return a list of equipment we can produce and afford"""
62 self.points = 0 64 self.points = 0
63 # Process mission results 65 # Process mission results
64 messages = [] 66 messages = []
65 for result in mission_results: 67 for result in mission_results:
66 result.apply(self) 68 result.apply(self)
67 messages.append((result.outcome, result.msg)) 69 messages.append((result.outcome, result.message))
68 for science in new_stuff: 70 for science in new_stuff:
69 # FIXME: Update UI better. 71 # FIXME: Update UI better.
70 if science.SCIENCE_TYPE == 'research': 72 if science.SCIENCE_TYPE == 'research':
71 messages.append((NEW_SCIENCE, 73 messages.append((NEW_SCIENCE,
72 "You've started a new line of research in %s" 74 "You've started a new line of research in %s"