Mercurial > sypikslang
view gamelib/game_base.py @ 45:1e8f7e694f0c
Refactor missions and sciences a bit to reduce duplication.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Mon, 07 May 2012 20:44:27 +0200 |
parents | |
children | d3d277a42ac6 |
line wrap: on
line source
def get_subclasses(base_class, leaf_only=True): subclasses = [] for cls in base_class.__subclasses__(): if leaf_only and cls.__subclasses__(): # Not a leaf class, and only want leaves continue subclasses.append(cls) return subclasses class Science(object): NAME = None PREREQUISITES = () ACQUISITION_CHANCE = 1.0 SCIENCE_TYPE = None def __init__(self, points=0): self.points = points def spend_point(self): self.points += 1 def can_spend(self, lab): return True