# HG changeset patch # User Neil Muller # Date 1336815763 -7200 # Node ID 52cc28b429b7922cdde2360d611ff785373b43c4 # Parent 4bbd4a1879f88e87ff6bdf77028ae5dcb18ae94f Debugging diff -r 4bbd4a1879f8 -r 52cc28b429b7 gamelib/gamestate.py --- a/gamelib/gamestate.py Sat May 12 11:23:22 2012 +0200 +++ b/gamelib/gamestate.py Sat May 12 11:42:43 2012 +0200 @@ -94,14 +94,16 @@ self.points -= len(self.cur_allocation) if self.points < 0: raise RuntimeError('Spent too many points') - new_stuff = self.lab.spend_points(self.cur_allocation, self.points) - self.points = 0 - self.minions = 0 # Process mission results messages = [] for result in mission_results: result.apply(self) messages.append((result.outcome, result.text, result.loot)) + # Missions may give us science breakthroughs, so handle this after + # mission results + new_stuff = self.lab.spend_points(self.cur_allocation, self.points) + self.points = 0 + self.minions = 0 for science in new_stuff: # FIXME: Update UI better. messages.append((INFO, "SCIENCE breakthrough!", { diff -r 4bbd4a1879f8 -r 52cc28b429b7 gamelib/lab.py --- a/gamelib/lab.py Sat May 12 11:23:22 2012 +0200 +++ b/gamelib/lab.py Sat May 12 11:42:43 2012 +0200 @@ -195,8 +195,9 @@ self.new_schematics.remove(type(science)) def steal_science(self, science): - self._gain_science(science) - self._stolen.append(science) + stolen = science() + self._gain_science(stolen) + self._stolen.append(stolen) def spend_points(self, things, basic_research): breakthroughs = [] diff -r 4bbd4a1879f8 -r 52cc28b429b7 gamelib/missions.py --- a/gamelib/missions.py Sat May 12 11:23:22 2012 +0200 +++ b/gamelib/missions.py Sat May 12 11:42:43 2012 +0200 @@ -483,7 +483,7 @@ self.use_equipment(categorised) - if cat.DOOM in categorised: + if cat.DOOMSDAY_DEVICE in categorised: self.data['completed'] = True self.succeed( "The fools cower in terror at your display of power. Finally" @@ -536,19 +536,20 @@ " of view. If only everything were so simple", rep=randint(5, 15)) - if cat.AU in categorised: + if cat.AI in categorised: self.succeed( "Your AI has complete control of the broadcasters computer" " system. After all, it's not censorship if you're stopping" " them broadcasting blatant lies, now is it?", rep=randint(5, 10)) - if any(c in categorised for c in (cat.VEHICLE, cat.DOOM, cat.BEAST)): + if any(c in categorised for c in (cat.VEHICLE, cat.DOOMSDAY_DEVICE, + cat.BEAST)): self.succeed( "Cowering in fear, the broadcaster agrees to change the" " tone of their stories.", rep=randint(2, 5)) - if cat.HAND_WEAPONS in categorised: + if cat.HAND_WEAPON in categorised: self.fail( "The news station's security is surprisingly well prepared." " Prehaps you should rethink your approach?", @@ -585,7 +586,7 @@ elif reward == 'schematic': msg = msg + (" You find the plans for a new device. How did" " these fools stumble upon this?") - raise Result(SUCCESS, msg, meoney=0, repo=randint(2, 5), + raise Result(SUCCESS, msg, money=0, rep=randint(2, 5), new_schematic=choice(state.lab.new_schematics)) # New science msg = msg + (" Their notes are most illuminating. You realise you have" @@ -597,7 +598,7 @@ self.use_equipment(categorised) - if cat.DOOM in categorised: + if cat.DOOMSDAY_DEVICE in categorised: self.fail( "While overwhelming force is always a tempting choice," " total destruction of the lab will not help you cause.")