comparison gamelib/gamestate.py @ 178:52cc28b429b7

Debugging
author Neil Muller <drnlmuller@gmail.com>
date Sat, 12 May 2012 11:42:43 +0200
parents 4bbd4a1879f8
children ed25c335fd67
comparison
equal deleted inserted replaced
177:4bbd4a1879f8 178:52cc28b429b7
92 self.reputation -= M_VALS[self.milestone] 92 self.reputation -= M_VALS[self.milestone]
93 # Do the science 93 # Do the science
94 self.points -= len(self.cur_allocation) 94 self.points -= len(self.cur_allocation)
95 if self.points < 0: 95 if self.points < 0:
96 raise RuntimeError('Spent too many points') 96 raise RuntimeError('Spent too many points')
97 new_stuff = self.lab.spend_points(self.cur_allocation, self.points)
98 self.points = 0
99 self.minions = 0
100 # Process mission results 97 # Process mission results
101 messages = [] 98 messages = []
102 for result in mission_results: 99 for result in mission_results:
103 result.apply(self) 100 result.apply(self)
104 messages.append((result.outcome, result.text, result.loot)) 101 messages.append((result.outcome, result.text, result.loot))
102 # Missions may give us science breakthroughs, so handle this after
103 # mission results
104 new_stuff = self.lab.spend_points(self.cur_allocation, self.points)
105 self.points = 0
106 self.minions = 0
105 for science in new_stuff: 107 for science in new_stuff:
106 # FIXME: Update UI better. 108 # FIXME: Update UI better.
107 messages.append((INFO, "SCIENCE breakthrough!", { 109 messages.append((INFO, "SCIENCE breakthrough!", {
108 science.SCIENCE_TYPE: science})) 110 science.SCIENCE_TYPE: science}))
109 return messages 111 return messages