Mercurial > sypikslang
comparison 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 |
comparison
equal
deleted
inserted
replaced
14:9d61abb3cfaf | 15:8865ba0c9c38 |
---|---|
3 | 3 |
4 class Product(object): | 4 class Product(object): |
5 NAME = None | 5 NAME = None |
6 PREREQUISITES = () | 6 PREREQUISITES = () |
7 ACQUISITION_CHANCE = 0.8 | 7 ACQUISITION_CHANCE = 0.8 |
8 COST = 0 | |
8 | 9 |
9 def __init__(self): | 10 def __init__(self): |
10 self.points = 0 | 11 self.points = 0 |
11 | 12 |
12 def spend_points(self, points): | 13 def spend_points(self, points): |
13 self.points += points | 14 self.points += points |
14 | 15 |
15 | 16 |
16 class MachineGun(Product): | 17 class MachineGun(Product): |
17 NAME = "Machine gun" | 18 NAME = "Machine gun" |
19 COST = 100 | |
18 | 20 |
19 | 21 |
20 class TeslaGun(Product): | 22 class TeslaGun(Product): |
21 NAME = "Tesla gun" | 23 NAME = "Tesla gun" |
22 PREREQUISITES = ( | 24 PREREQUISITES = ( |
23 (research.Tesla, 1), | 25 (research.Tesla, 1), |
24 ) | 26 ) |
27 COST = 300 | |
25 | 28 |
26 | 29 |
27 class DoomsdayVirus(Product): | 30 class DoomsdayVirus(Product): |
28 NAME = "Doomsday virus" | 31 NAME = "Doomsday virus" |
29 PREREQUISITES = ( | 32 PREREQUISITES = ( |
30 (research.Biogenetics, 5), | 33 (research.Biogenetics, 5), |
31 ) | 34 ) |
35 COST = 1000 |