This repository has been archived by the owner on Aug 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
role.py
139 lines (129 loc) · 4.16 KB
/
role.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
from enum import Enum, unique
@unique
class Role(Enum):
Villager = 1
Drunk = 2
Harlot = 3
Seer = 4
Traitor = 5
GuardianAngel = 6
Detective = 7
Wolf = 8
Cursed = 9
Gunner = 10
Tanner = 11
Fool = 12
WildChild = 13
Beholder = 14
ApprenticeSeer = 15
Cultist = 16
CultistHunter = 17
Mason = 18
Doppelganger = 19
Cupid = 20
Hunter = 21
SerialKiller = 22
Sorcerer = 23
AlphaWolf = 24
WolfCub = 25
Blacksmith = 26
ClumsyGuy = 27
Mayor = 28
Prince = 29
def __repr__(self):
return str(self)
def strength(self, ingame_roles):
if(self == Role.Villager):
return 1
elif(self == Role.Drunk):
return 3
elif(self == Role.Harlot):
return 6
elif(self == Role.Seer):
return 7
elif(self == Role.Traitor):
return 0
elif(self == Role.GuardianAngel):
return 7
elif(self == Role.Detective):
return 6
elif(self == Role.Wolf):
return 10
elif(self == Role.Gunner):
return 6
elif(self == Role.Fool):
return 3
elif(self == Role.WildChild):
return 1
elif(self == Role.ApprenticeSeer):
return 6
elif(self == Role.Doppelganger):
return 2
elif(self == Role.Cupid):
return 2
elif(self == Role.Hunter):
return 6
elif(self == Role.SerialKiller):
return 15
elif(self == Role.Sorcerer):
return 2
elif(self == Role.AlphaWolf):
return 12
elif(self == Role.WolfCub):
return 12
elif(self == Role.Blacksmith):
return 5
elif(self == Role.ClumsyGuy):
return -1
elif(self == Role.Mayor):
return 4
elif(self == Role.Prince):
return 3
elif(self == Role.Cursed):
wolves = [role for role in ingame_roles if role in Role.wolves_2()]
return 1 - (len(wolves) / 2)
elif(self == Role.Cultist):
convertibles = [role for role in ingame_roles if role not in
Role.non_convertibles()]
return 10 + len(convertibles)
elif(self == Role.CultistHunter):
return 7 if Role.Cultist in ingame_roles else 1
elif(self == Role.Mason):
mason_count = ingame_roles.count(Role.Mason)
return mason_count + 3 if mason_count > 1 else 1
elif(self == Role.Beholder):
return 2 + (4 if Role.Seer in ingame_roles else 0)
elif(self == Role.Tanner):
return len(ingame_roles) / 2
else:
raise RuntimeError
@staticmethod
def non_villagers():
return [Role.Cultist, Role.SerialKiller, Role.Tanner, Role.Wolf,
Role.AlphaWolf, Role.Sorcerer, Role.WolfCub]
@staticmethod
def wolves():
return [Role.Wolf, Role.WolfCub, Role.AlphaWolf]
# The original wolf roles in their code has 2 WolfCubs and leaves Wolf out.
@staticmethod
def wolves_2():
return [Role.WolfCub, Role.WolfCub, Role.AlphaWolf]
@staticmethod
def non_convertibles():
return [Role.Seer, Role.GuardianAngel, Role.Detective, Role.Cursed,
Role.Harlot, Role.Hunter, Role.Doppelganger, Role.Wolf,
Role.AlphaWolf, Role.WolfCub, Role.SerialKiller]
@staticmethod
def enemies():
return [Role.Wolf, Role.WolfCub, Role.AlphaWolf, Role.SerialKiller,
Role.Cultist]
@staticmethod
def all():
return [Role.Villager, Role.Drunk, Role.Harlot, Role.Seer, Role.Traitor,
Role.GuardianAngel, Role.Detective, Role.Wolf, Role.Cursed,
Role.Gunner, Role.Tanner, Role.Fool, Role.WildChild,
Role.Beholder, Role.ApprenticeSeer, Role.Cultist,
Role.CultistHunter, Role.Mason, Role.Doppelganger, Role.Cupid,
Role.Hunter, Role.SerialKiller, Role.Sorcerer, Role.AlphaWolf,
Role.WolfCub, Role.Blacksmith, Role.ClumsyGuy, Role.Mayor,
Role.Prince]