Mercurial > sypikslang
comparison gamelib/lab.py @ 36:efc4f90cfd63
Mission refactoring and research fix.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Mon, 07 May 2012 00:18:16 +0200 |
parents | 23720d0fd9a0 |
children | 1e8f7e694f0c |
comparison
equal
deleted
inserted
replaced
35:2754c453b39b | 36:efc4f90cfd63 |
---|---|
98 return False | 98 return False |
99 base_points += level | 99 base_points += level |
100 total_points += my_science.points | 100 total_points += my_science.points |
101 return total_points - base_points >= extra | 101 return total_points - base_points >= extra |
102 | 102 |
103 def find_new_products(self, research_area): | 103 def find_new_products(self): |
104 available_products = [] | 104 available_products = [] |
105 for product_class in self.new_products: | 105 for product_class in self.new_products: |
106 if self.meet_requirements(product_class): | 106 if self.meet_requirements(product_class): |
107 available_products.append(product_class) | 107 available_products.append(product_class) |
108 return available_products | 108 return available_products |
113 if self.meet_requirements(research_class): | 113 if self.meet_requirements(research_class): |
114 available_research.append(research_class) | 114 available_research.append(research_class) |
115 return available_research | 115 return available_research |
116 | 116 |
117 def apply_area_research(self, research): | 117 def apply_area_research(self, research): |
118 options = self.find_new_products(research) | 118 options = [product for product in self.find_new_products() |
119 if type(research) in [p[0] for p in product.PREREQUISITES]] | |
119 breakthroughs = [product for product in options | 120 breakthroughs = [product for product in options |
120 if random() < product.ACQUISITION_CHANCE] | 121 if random() < product.ACQUISITION_CHANCE] |
121 if breakthroughs: | 122 if breakthroughs: |
122 breakthrough = choice(breakthroughs)() | 123 breakthrough = choice(breakthroughs)() |
123 self._gain_science(breakthrough) | 124 self._gain_science(breakthrough) |