comparison gamelib/schematics.py @ 85:182fce9f70b6

Propaganda! Also, a fix to blueprint breakthroughs.
author Jeremy Thurgood <firxen@gmail.com>
date Wed, 09 May 2012 20:02:28 +0200
parents 52913ba12988
children c57b5b46d3e0
comparison
equal deleted inserted replaced
84:9d0ad8aeb598 85:182fce9f70b6
2 2
3 from gamelib import research 3 from gamelib import research
4 from gamelib.game_base import Science 4 from gamelib.game_base import Science
5 5
6 6
7 # Kinds of schematic. 7 class SchematicCategorySet(object):
8 HAND_WEAPON = 'hand weapon' 8 def __init__(self, *categories):
9 VEHICLE = 'vehicle' 9 for cat in categories:
10 DOOMSDAY_DEVICE = 'doomsday device' 10 setattr(self, cat, cat.lower().replace('_', ' '))
11 PATHOGEN = 'pathogen' 11
12 cat = SchematicCategorySet(
13 'HAND_WEAPON',
14 'VEHICLE',
15 'DOOMSDAY_DEVICE',
16 'PATHOGEN',
17 'MIND_CONTROL',
18 )
12 19
13 20
14 class Schematic(Science): 21 class Schematic(Science):
15 # For all Schematics 22 # For all Schematics
16 SCIENCE_TYPE = 'schematic' 23 SCIENCE_TYPE = 'schematic'
49 power += self.POWER_INCREMENT * self.points 56 power += self.POWER_INCREMENT * self.points
50 return power 57 return power
51 58
52 59
53 class MachineGun(Schematic): 60 class MachineGun(Schematic):
54 NAME = "Machine gun" 61 NAME = "machine gun"
55 COST = 100 62 COST = 100
56 CATEGORIES = (HAND_WEAPON,) 63 CATEGORIES = (cat.HAND_WEAPON,)
57 STARTING_PRODUCT = True 64 STARTING_PRODUCT = True
58 65
59 def __init__(self, points=0): 66 def __init__(self, points=0):
60 self.points = 1 67 self.points = 1
61 68
65 def can_spend(self, lab, spend): 72 def can_spend(self, lab, spend):
66 return False 73 return False
67 74
68 75
69 class LightningGun(Schematic): 76 class LightningGun(Schematic):
70 NAME = "Lightning gun" 77 NAME = "lightning gun"
71 COST = 300 78 COST = 300
72 CATEGORIES = (HAND_WEAPON,) 79 CATEGORIES = (cat.HAND_WEAPON,)
73 PREREQUISITES = ( 80 PREREQUISITES = (
74 (research.Tesla, 1), 81 (research.Tesla, 1),
75 ) 82 )
76 83
77 84
78 class TeslaTank(Schematic): 85 class TeslaTank(Schematic):
79 NAME = "Tesla tank" 86 NAME = "tesla tank"
80 COST = 1000 87 COST = 1000
81 CATEGORIES = (VEHICLE,) 88 CATEGORIES = (cat.VEHICLE,)
82 PREREQUISITES = ( 89 PREREQUISITES = (
83 (research.Tesla, 3), 90 (research.Tesla, 3),
84 ) 91 )
85 92
86 93
87 class DoomsdayVirus(Schematic): 94 class DoomsdayVirus(Schematic):
88 NAME = "Doomsday virus" 95 NAME = "doomsday virus"
89 COST = 100000 96 COST = 100000
90 CATEGORIES = (DOOMSDAY_DEVICE, PATHOGEN) 97 CATEGORIES = (cat.DOOMSDAY_DEVICE, cat.PATHOGEN)
91 PREREQUISITES = ( 98 PREREQUISITES = (
92 (research.Biogenetics, 5), 99 (research.Biogenetics, 5),
93 ) 100 )
101
102
103 class PropagandaMachine(Schematic):
104 NAME = "propaganda machine"
105 COST = 1000
106 CATEGORIES = (cat.MIND_CONTROL)
107 PREREQUISITES = (
108 (research.Psychology, 2),
109 )