annotate gamelib/products.py @ 3:6ab4f1ab9eab

Very basics of research and products.
author Jeremy Thurgood <firxen@gmail.com>
date Sun, 06 May 2012 11:59:20 +0200
parents
children 826b44731323
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 = ()
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
7
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
8 def __init__(self):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
9 self.points = 0
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
10
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
11 def spend_points(self, points):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
12 self.points += points
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
13
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
14
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
15 class MachineGun(Product):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
16 NAME = "Machine gun"
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
17
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
18
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
19 class TeslaGun(Product):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
20 NAME = "Tesla gun"
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
21 PREREQUISITES = (
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
22 (research.Tesla, 1),
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
23 )
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
24
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
25
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
26 class DoomsdayVirus(Product):
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
27 NAME = "Doomsday virus"
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
28 PREREQUISITES = (
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
29 (research.BioGenetics, 5),
6ab4f1ab9eab Very basics of research and products.
Jeremy Thurgood <firxen@gmail.com>
parents:
diff changeset
30 )