annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
1 from gamelib import research
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
2
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
3
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
4 class Product(object):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
5 NAME = None
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
6 PREREQUISITES = ()
6
826b44731323 Start of basic lab implementation.
Jeremy Thurgood <firxen@gmail.com>
parents: 3
diff changeset
7 ACQUISITION_CHANCE = 0.8
15
8865ba0c9c38 Add cost to products
Neil Muller <drnlmuller@gmail.com>
parents: 14
diff changeset
8 COST = 0
3
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
9
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
10 def __init__(self):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
11 self.points = 0
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
12
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
13 def spend_points(self, points):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
14 self.points += points
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
15
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
16
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
17 class MachineGun(Product):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
18 NAME = "Machine gun"
15
8865ba0c9c38 Add cost to products
Neil Muller <drnlmuller@gmail.com>
parents: 14
diff changeset
19 COST = 100
3
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
20
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
21
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
22 class TeslaGun(Product):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
23 NAME = "Tesla gun"
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
24 PREREQUISITES = (
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
25 (research.Tesla, 1),
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
26 )
15
8865ba0c9c38 Add cost to products
Neil Muller <drnlmuller@gmail.com>
parents: 14
diff changeset
27 COST = 300
3
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
28
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
29
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
30 class DoomsdayVirus(Product):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
31 NAME = "Doomsday virus"
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
32 PREREQUISITES = (
14
9d61abb3cfaf Better subclass handling.
Jeremy Thurgood <firxen@gmail.com>
parents: 6
diff changeset
33 (research.Biogenetics, 5),
3
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
34 )
15
8865ba0c9c38 Add cost to products
Neil Muller <drnlmuller@gmail.com>
parents: 14
diff changeset
35 COST = 1000