Mercurial > sypikslang
comparison gamelib/schematics.py @ 94:245ef50de84d
Sanity-check research, schematic and mission classes. (Ironic, no?)
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Wed, 09 May 2012 21:22:10 +0200 |
parents | c57b5b46d3e0 |
children | ef63532cac13 |
comparison
equal
deleted
inserted
replaced
93:f0bf77787d1e | 94:245ef50de84d |
---|---|
54 power = self.BASE_POWER | 54 power = self.BASE_POWER |
55 if None not in (power, self.POWER_INCREMENT): | 55 if None not in (power, self.POWER_INCREMENT): |
56 power += self.POWER_INCREMENT * self.points | 56 power += self.POWER_INCREMENT * self.points |
57 return power | 57 return power |
58 | 58 |
59 @classmethod | |
60 def sanity_check(cls): | |
61 for science, points in cls.PREREQUISITES: | |
62 assert issubclass(science, Science) | |
63 assert isinstance(points, int) | |
64 assert isinstance(cls.CATEGORIES, tuple) | |
65 | |
59 | 66 |
60 class MachineGun(Schematic): | 67 class MachineGun(Schematic): |
61 NAME = "machine gun" | 68 NAME = "machine gun" |
62 COST = 100 | 69 COST = 100 |
63 CATEGORIES = (cat.HAND_WEAPON,) | 70 CATEGORIES = (cat.HAND_WEAPON,) |