diff gamelib/gamestate.py @ 41:e285b1e31a08

Add can_attempt method for future flexibility
author Neil Muller <drnlmuller@gmail.com>
date Mon, 07 May 2012 13:59:50 +0200
parents 12c33aac7684
children 47c7e96cf9c8
line wrap: on
line diff
--- a/gamelib/gamestate.py	Mon May 07 00:27:59 2012 +0200
+++ b/gamelib/gamestate.py	Mon May 07 13:59:50 2012 +0200
@@ -41,9 +41,7 @@
 
     def get_available_missions(self):
         """Return a list of missions we can feasibly attempt"""
-        available = [x for x in self.missions
-                     if (x.MINIMUM_REPUTATION is None
-                         or x.MINIMUM_REPUTATION <= self.reputation)]
+        available = [x for x in self.missions if x.can_attempt(self)]
         return available
 
     def end_turn(self):
@@ -51,9 +49,6 @@
         mission_results = []
         for mission, equipment in self.cur_missions:
             mission_results.append(mission.attempt(equipment, self))
-            if not mission.available:
-                # Mission no longer available, so we clean up
-                self.missions.remove(mission)
         # Do the science
         self.points -= len(self.cur_allocation)
         if self.points < 0: