Mercurial > sypikslang
view gamelib/schematics.py @ 49:373c57ab4140
Product -> Schematic.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Mon, 07 May 2012 21:24:23 +0200 |
parents | gamelib/products.py@1e8f7e694f0c |
children | 168cfac9a445 |
line wrap: on
line source
from gamelib import research from gamelib.game_base import Science # Kinds of schematic. HAND_WEAPON = 'hand weapon' VEHICLE = 'vehicle' DOOMSDAY_DEVICE = 'doomsday device' PATHOGEN = 'pathogen' class Schematic(Science): ACQUISITION_CHANCE = 0.8 COST = None UPGRADE_REQUIREMENT = 1 STARTING_PRODUCT = False SCIENCE_TYPE = 'schematic' CATEGORIES = () def can_spend(self, lab): extra = self.UPGRADE_REQUIREMENT * self.points + 1 return lab.meet_requirements(self, extra) def is_a(self, category): return category in self.CATEGORIES class MachineGun(Schematic): NAME = "Machine gun" COST = 100 CATEGORIES = (HAND_WEAPON,) STARTING_PRODUCT = True def __init__(self, points=0): self.points = 1 def spend_point(self): raise NotImplementedError() def can_spend(self, lab): return False class LightningGun(Schematic): NAME = "Lightning gun" COST = 300 CATEGORIES = (HAND_WEAPON,) PREREQUISITES = ( (research.Tesla, 1), ) class TeslaTank(Schematic): NAME = "Tesla tank" COST = 1000 CATEGORIES = (VEHICLE,) PREREQUISITES = ( (research.Tesla, 3), ) class DoomsdayVirus(Schematic): NAME = "Doomsday virus" COST = 100000 CATEGORIES = (DOOMSDAY_DEVICE, PATHOGEN) PREREQUISITES = ( (research.Biogenetics, 5), )