1 '''
2 updated version of player, to be used in multiplayer mode
3 '''
4
5 from pyglet.event import EventDispatcher
6 from cocos.layer import Layer
7 from models import CPU
8 from constants import *
9
10 -class Player(EventDispatcher, Layer):
11
13 super(Player, self).__init__()
14
15 self.pid = pid
16
17 self.color = PLAYER_COLORS[self.pid]
18
19
20 self.uid = 0
21
22 self.units = {}
23
24
25 self.underConstruction = {}
26
27
28 self.completedResearch = 1
29
30
31 self.availableResearch = []
32
33
34 self.unitActionLists = {
35 "Ping": ["Ping"],
36 "PingOfDeath": ["Attack"],
37 "DOS": ["Attack"],
38 "DNSPoison":["Attack"],
39 "NMap": ["NMap"],
40 "SQLInjection": ["Attack"],
41 "Handshake": ["Shake"],
42 "BufferOverflow": ["Attack"],
43 "APTGet": [],
44 "Installer": ["BAlgorithmFactory","BSoftwareUpdater"],
45 "Firewall": [],
46 "Sinkhole": [],
47 "Server": ["TInstaller"],
48 "Spoof": ["BSpoofedBuilding"],
49 "SpoofedBuilding": ["DSpoof"],
50 "RSA": [],
51 "Database": [],
52 "SoftwareUpdater": ["RPortScanner"],
53 "AlgorithmFactory": ["TDOS"],
54 "EncryptedTroop": ["Decrypt"],
55 "CPU": []
56 }
57
58 self.idleCPUs = []
59
60 self.busyCPUs = []
61
72