# HG changeset patch # User Rizmari Versfeld # Date 1336516126 -7200 # Node ID e3143d711e26b23531b2af7b739ac6b4bad32ea7 # Parent 9ebce976a6832b610b3e45b67ef2867446f8df72# Parent b503ccb0a86e746d1b02c8b83e4259f9a6ffc509 merge diff -r 9ebce976a683 -r e3143d711e26 data/images/mission_selected.png Binary file data/images/mission_selected.png has changed diff -r 9ebce976a683 -r e3143d711e26 gamelib/game_base.py --- a/gamelib/game_base.py Wed May 09 00:27:08 2012 +0200 +++ b/gamelib/game_base.py Wed May 09 00:28:46 2012 +0200 @@ -26,6 +26,13 @@ return True @classmethod + def depends_on(self, sciences): + for science_class, _ in self.PREREQUISITES: + if any(isinstance(science, science_class) for science in sciences): + return True + return False + + @classmethod def save_name(cls): return "%s.%s" % (cls.SCIENCE_TYPE, cls.__name__) diff -r 9ebce976a683 -r e3143d711e26 gamelib/lab.py --- a/gamelib/lab.py Wed May 09 00:27:08 2012 +0200 +++ b/gamelib/lab.py Wed May 09 00:28:46 2012 +0200 @@ -70,9 +70,9 @@ thing.spend_point() # Next, check for schematic breakthroughs and upgrades - for thing in things: - if isinstance(thing, research.ResearchArea): - breakthroughs.extend(self.apply_area_research(thing)) + breakthroughs.extend(self.apply_area_research( + thing for thing in things + if isinstance(thing, research.ResearchArea))) # Finally, check for research breakthroughs. breakthroughs.extend(self.apply_basic_research(basic_research)) @@ -112,9 +112,9 @@ available_research.append(research_class) return available_research - def apply_area_research(self, research): + def apply_area_research(self, researches): options = [schema for schema in self.find_new_schematics() - if type(research) in [p[0] for p in schema.PREREQUISITES]] + if schema.depends_on(researches)] breakthroughs = [schematic for schematic in options if random() < schematic.ACQUISITION_CHANCE] if breakthroughs: