Mercurial > sypikslang
diff gamelib/products.py @ 17:10d3db1f1e08
Set up initial research and rework breakthroughs.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 06 May 2012 17:39:37 +0200 |
parents | 8865ba0c9c38 |
children | 718d1ec382f7 |
line wrap: on
line diff
--- a/gamelib/products.py Sun May 06 17:12:40 2012 +0200 +++ b/gamelib/products.py Sun May 06 17:39:37 2012 +0200 @@ -6,27 +6,50 @@ PREREQUISITES = () ACQUISITION_CHANCE = 0.8 COST = 0 + UPGRADE_REQUIREMENT = 1 + STARTING_PRODUCT = False - def __init__(self): - self.points = 0 + def __init__(self, points=0): + self.points = points - def spend_points(self, points): - self.points += points + def spend_point(self): + self.points += 1 + + def can_spend(self, lab): + extra = self.UPGRADE_REQUIREMENT * self.points + 1 + return lab.meet_requirements(self, extra) class MachineGun(Product): NAME = "Machine gun" COST = 100 + STARTING_PRODUCT = True + + def __init__(self): + self.points = 1 + + def spend_point(self): + raise NotImplementedError() + + def can_spend(self, lab): + return False -class TeslaGun(Product): - NAME = "Tesla gun" +class LightningGun(Product): + NAME = "Lightning gun" PREREQUISITES = ( (research.Tesla, 1), ) COST = 300 +class TeslaTank(Product): + NAME = "Tesla tank" + PREREQUISITES = ( + (research.Tesla, 3), + ) + + class DoomsdayVirus(Product): NAME = "Doomsday virus" PREREQUISITES = (