Mercurial > sypikslang
comparison gamelib/products.py @ 32:00aff02bc6fc
Product categories.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 06 May 2012 20:57:04 +0200 |
parents | 23720d0fd9a0 |
children | 20ed2843adec |
comparison
equal
deleted
inserted
replaced
31:51ff46f42ed2 | 32:00aff02bc6fc |
---|---|
1 from gamelib import research | 1 from gamelib import research |
2 | |
3 | |
4 # Kinds of product. | |
5 HAND_WEAPON = 'hand weapon' | |
6 VEHICLE = 'vehicle' | |
7 DOOMSDAY_DEVICE = 'doomsday device' | |
8 PATHOGEN = 'pathogen' | |
2 | 9 |
3 | 10 |
4 class Product(object): | 11 class Product(object): |
5 NAME = None | 12 NAME = None |
6 PREREQUISITES = () | 13 PREREQUISITES = () |
7 ACQUISITION_CHANCE = 0.8 | 14 ACQUISITION_CHANCE = 0.8 |
8 COST = 0 | 15 COST = None |
9 UPGRADE_REQUIREMENT = 1 | 16 UPGRADE_REQUIREMENT = 1 |
10 STARTING_PRODUCT = False | 17 STARTING_PRODUCT = False |
11 SCIENCE_TYPE = 'product' | 18 SCIENCE_TYPE = 'product' |
19 CATEGORIES = () | |
12 | 20 |
13 def __init__(self, points=0): | 21 def __init__(self, points=0): |
14 self.points = points | 22 self.points = points |
15 | 23 |
16 def spend_point(self): | 24 def spend_point(self): |
22 | 30 |
23 | 31 |
24 class MachineGun(Product): | 32 class MachineGun(Product): |
25 NAME = "Machine gun" | 33 NAME = "Machine gun" |
26 COST = 100 | 34 COST = 100 |
35 CATEGORIES = (HAND_WEAPON,) | |
27 STARTING_PRODUCT = True | 36 STARTING_PRODUCT = True |
28 | 37 |
29 def __init__(self, points=0): | 38 def __init__(self, points=0): |
30 self.points = 1 | 39 self.points = 1 |
31 | 40 |
36 return False | 45 return False |
37 | 46 |
38 | 47 |
39 class LightningGun(Product): | 48 class LightningGun(Product): |
40 NAME = "Lightning gun" | 49 NAME = "Lightning gun" |
50 COST = 300 | |
51 CATEGORIES = (HAND_WEAPON,) | |
41 PREREQUISITES = ( | 52 PREREQUISITES = ( |
42 (research.Tesla, 1), | 53 (research.Tesla, 1), |
43 ) | 54 ) |
44 COST = 300 | |
45 | 55 |
46 | 56 |
47 class TeslaTank(Product): | 57 class TeslaTank(Product): |
48 NAME = "Tesla tank" | 58 NAME = "Tesla tank" |
59 COST = 1000 | |
60 CATEGORIES = (VEHICLE,) | |
49 PREREQUISITES = ( | 61 PREREQUISITES = ( |
50 (research.Tesla, 3), | 62 (research.Tesla, 3), |
51 ) | 63 ) |
52 | 64 |
53 | 65 |
54 class DoomsdayVirus(Product): | 66 class DoomsdayVirus(Product): |
55 NAME = "Doomsday virus" | 67 NAME = "Doomsday virus" |
68 COST = 100000 | |
69 CATEGORIES = (DOOMSDAY_DEVICE, PATHOGEN) | |
56 PREREQUISITES = ( | 70 PREREQUISITES = ( |
57 (research.Biogenetics, 5), | 71 (research.Biogenetics, 5), |
58 ) | 72 ) |
59 COST = 1000 |