Mercurial > sypikslang
comparison gamelib/gamestate.py @ 137:fb8037bc22f1
More flexible (and less boilerplatey) mission stuff.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Thu, 10 May 2012 20:56:40 +0200 |
parents | 8d1cf98e39b5 |
children | 14917385a0fd |
comparison
equal
deleted
inserted
replaced
136:1a648d07d67e | 137:fb8037bc22f1 |
---|---|
63 | 63 |
64 def end_turn(self): | 64 def end_turn(self): |
65 # Attempt the missions | 65 # Attempt the missions |
66 mission_results = [] | 66 mission_results = [] |
67 for mission, equipment in self.cur_missions: | 67 for mission, equipment in self.cur_missions: |
68 mission_results.append(mission.attempt(equipment, self)) | 68 mission_results.append(mission.attempt_mission(equipment, self)) |
69 if not self.cur_missions and self.reputation > 0: | 69 if not self.cur_missions and self.reputation > 0: |
70 # If you're not doing stuff, you're not in the news | 70 # If you're not doing stuff, you're not in the news |
71 self.reputation -= M_VALS[self.milestone] | 71 self.reputation -= M_VALS[self.milestone] |
72 # Do the science | 72 # Do the science |
73 self.points -= len(self.cur_allocation) | 73 self.points -= len(self.cur_allocation) |
78 self.minions = 0 | 78 self.minions = 0 |
79 # Process mission results | 79 # Process mission results |
80 messages = [] | 80 messages = [] |
81 for result in mission_results: | 81 for result in mission_results: |
82 result.apply(self) | 82 result.apply(self) |
83 messages.append((result.outcome, result.message)) | 83 messages.append((result.outcome, result.text)) |
84 if result.outcome == NEW_MILESTONE: | 84 if result.outcome == NEW_MILESTONE: |
85 self.milestone = MILESTONES[M_VALS[self.milestone] + 1] | 85 self.milestone = MILESTONES[M_VALS[self.milestone] + 1] |
86 for science in new_stuff: | 86 for science in new_stuff: |
87 # FIXME: Update UI better. | 87 # FIXME: Update UI better. |
88 if science.SCIENCE_TYPE == 'research': | 88 if science.SCIENCE_TYPE == 'research': |