Module research
[hide private]
[frames] | no frames]

Source Code for Module research

  1  from constants import TEST_SPEEDUP 
  2  import objects 
3 4 -class Research(object):
5 buildTime = 0 6 level = 0 7 dependencies = 1 8 units = [] # units that can be created after this research is done 9 uid = 0 10 11 @classmethod
12 - def on_start(cls, player):
13 #get's called when research starts 14 pass
15 16 @classmethod
17 - def on_cancel(cls,player):
18 #called when the research is cancelled for whatever reason 19 pass
20 21 @classmethod
22 - def on_completion(cls, player):
23 # interface-ish method 24 pass
25 # c = objects.Objects.get_controller()
26 # doesn't work because units are 27 # for obj in c.selectedUnits: 28 # obj.clear_action_menu(c.map, c.cm, c.player) 29 # obj.display_action_menu(c.map, c.cm, c.player) 30 31 32 -class PortScanner(Research):
33 buildTime = 20 / TEST_SPEEDUP 34 level = 1 35 uid = 2 36 37 @classmethod
38 - def on_start(cls, player):
39 player.unitActionLists["SoftwareUpdater"].remove("RPortScanner")
40 41 @classmethod
42 - def on_cancel(cls,player):
43 player.unitActionLists["SoftwareUpdater"].append("RPortScanner")
44 45 @classmethod
46 - def on_completion(cls, player):
47 Research.on_completion(player) 48 player.unitActionLists["Installer"].append("BFirewall") 49 player.unitActionLists["Server"].append("TPing") 50 player.unitActionLists["SoftwareUpdater"].append("RPingResearch")
51
52 53 -class PingResearch(Research):
54 buildTime = 20 / TEST_SPEEDUP 55 level = 1 56 uid = 3 57 58 @classmethod
59 - def on_start(cls, player):
60 player.unitActionLists["SoftwareUpdater"].remove("RPingResearch")
61 62 @classmethod
63 - def on_cancel(cls,player):
64 player.unitActionLists["SoftwareUpdater"].append("RPingResearch")
65 66 @classmethod
67 - def on_completion(cls, player):
68 Research.on_completion(player) 69 player.unitActionLists["Ping"].append("UPingOfDeath") 70 player.unitActionLists["AlgorithmFactory"].append("TBufferOverflow") 71 player.unitActionLists["SoftwareUpdater"].append("RNetworkTopology") 72 player.unitActionLists["SoftwareUpdater"].append("RFPGA")
73
74 -class FPGA(Research):
75 buildTime = 25 / TEST_SPEEDUP 76 level = 1 77 78 @classmethod
79 - def on_start(cls, player):
80 player.unitActionLists["SoftwareUpdater"].remove("RFPGA")
81 82 @classmethod
83 - def on_cancel(cls,player):
84 player.unitActionLists["SoftwareUpdater"].append("RFPGA")
85 86 @classmethod
87 - def on_completion(cls, player):
88 Research.on_completion(player) 89 player.unitActionLists["APTGet"].append("BCPU") 90 player.unitActionLists["Server"].append("TAPTGet") 91 player.unitActionLists["SoftwareUpdater"].append("RAdvancedAlgorithms")
92
93 94 -class BigData(Research):
95 buildTime = 25 / TEST_SPEEDUP 96 level = 1 97 98 @classmethod
99 - def on_start(cls, player):
100 player.unitActionLists["SoftwareUpdater"].remove("RBigData")
101 102 @classmethod
103 - def on_cancel(cls,player):
104 player.unitActionLists["SoftwareUpdater"].append("RBigData")
105 106 @classmethod
107 - def on_completion(cls, player):
108 Research.on_completion(player) 109 player.unitActionLists["APTGet"].append("BDatabase") 110 player.unitActionLists["AlgorithmFactory"].append("TSQLInjection") 111 player.unitActionLists["SoftwareUpdater"].append("RHandshake") 112 player.unitActionLists["SoftwareUpdater"].append("RRSA")
113
114 115 -class ParallelDistributed(Research):
116 buildTime = 20 / TEST_SPEEDUP 117 level = 2 118 dependencies = 6 119 uid = 7 120 121 @classmethod
122 - def on_start(cls, player):
123 pass
124 125 @classmethod
126 - def on_cancel(cls,player):
127 pass
128
129 130 -class Handshake(Research):
131 buildTime = 20 / TEST_SPEEDUP 132 level = 2 133 dependencies = 6 134 uid = 11 135 136 @classmethod
137 - def on_start(cls, player):
138 player.unitActionLists["SoftwareUpdater"].remove("RHandshake")
139 140 @classmethod
141 - def on_cancel(cls,player):
142 player.unitActionLists["SoftwareUpdater"].append("RHandshake")
143 144 @classmethod
145 - def on_completion(cls, player):
146 Research.on_completion(player) 147 player.unitActionLists["AlgorithmFactory"].append("THandshake")
148
149 150 -class AdvancedAlgorithm(Research):
151 buildTime = 30 / TEST_SPEEDUP 152 level = 3 153 dependencies = 385 154 uid = 13 155 156 @classmethod
157 - def on_start(cls, player):
158 player.unitActionLists["SoftwareUpdater"].remove("RAdvancedAlgorithms")
159 160 @classmethod
161 - def on_cancel(cls,player):
162 player.unitActionLists["SoftwareUpdater"].append("RAdvancedAlgorithms")
163 164 @classmethod
165 - def on_completion(cls, player):
166 Research.on_completion(player) 167 player.unitActionLists["AlgorithmFactory"].append("TDNSPoison") 168 player.unitActionLists["AlgorithmFactory"].append("TSpoof")
169
170 -class NetworkTopology(Research):
171 buildTime = 30 / TEST_SPEEDUP 172 level = 3 173 dependencies = 385 174 uid = 17 175 176 @classmethod
177 - def on_start(cls, player):
178 player.unitActionLists["SoftwareUpdater"].remove("RNetworkTopology")
179 180 @classmethod
181 - def on_cancel(cls,player):
182 player.unitActionLists["SoftwareUpdater"].append("RNetworkTopology")
183 184 @classmethod
185 - def on_completion(cls, player):
186 Research.on_completion(player) 187 player.unitActionLists["SoftwareUpdater"].append("RBigData") 188 player.unitActionLists["Firewall"].append("USinkhole")
189
190 191 192 -class RSA(Research):
193 buildTime = 20 / TEST_SPEEDUP 194 level = 3 195 dependencies = 385 196 uid = 19 197 198 @classmethod
199 - def on_start(cls, player):
200 player.unitActionLists["SoftwareUpdater"].remove("RRSA")
201 202 @classmethod
203 - def on_cancel(cls,player):
204 player.unitActionLists["SoftwareUpdater"].append("RRSA")
205 206 @classmethod
207 - def on_completion(cls, player):
208 Research.on_completion(player) 209 player.unitActionLists["APTGet"].append("BRSA")
210
211 212 -class EMP(Research):
213 buildTime = 40 / TEST_SPEEDUP 214 level = 4 215 dependencies = 4199 216 uid = 23 217 218 @classmethod
219 - def on_start(cls, player):
220 pass
221 222 @classmethod
223 - def on_cancel(cls,player):
224 pass
225 226 227 '''RESEARCH_OPTIONS''' 228 229 RESEARCH = { 230 "RPortScanner": PortScanner, "RPingResearch": PingResearch, # level 1 231 "RFPGA": FPGA, "RPandD": ParallelDistributed, "RBigData" : BigData, "RHandshake": Handshake, # level 2 232 "RAdvancedAlgorithms": AdvancedAlgorithm, "RNetworkTopology": NetworkTopology, "RRSA": RSA, # level 3 233 "REMP": EMP # level 4 234 } 235