view gamelib/products.py @ 15:8865ba0c9c38

Add cost to products
author Neil Muller <drnlmuller@gmail.com>
date Sun, 06 May 2012 17:04:10 +0200
parents 9d61abb3cfaf
children 10d3db1f1e08
line wrap: on
line source

from gamelib import research


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

    def __init__(self):
        self.points = 0

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


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


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


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