view gamelib/products.py @ 14:9d61abb3cfaf

Better subclass handling.
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 06 May 2012 15:58:03 +0200
parents 826b44731323
children 8865ba0c9c38
line wrap: on
line source

from gamelib import research


class Product(object):
    NAME = None
    PREREQUISITES = ()
    ACQUISITION_CHANCE = 0.8

    def __init__(self):
        self.points = 0

    def spend_points(self, points):
        self.points += points


class MachineGun(Product):
    NAME = "Machine gun"


class TeslaGun(Product):
    NAME = "Tesla gun"
    PREREQUISITES = (
        (research.Tesla, 1),
        )


class DoomsdayVirus(Product):
    NAME = "Doomsday virus"
    PREREQUISITES = (
        (research.Biogenetics, 5),
        )