-
Notifications
You must be signed in to change notification settings - Fork 1
/
totemfire.py
101 lines (90 loc) · 4.25 KB
/
totemfire.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
from src.gamemodes import game_mode, GameMode
from src.functions import get_players, get_main_role, change_role
from src.messages import messages
from src.events import EventListener
import math
messages.messages["totemroyale_win"] = "Game over! Standing among their dead companions, the remaining crazed shaman learns a valuable lesson: the real totems were the friends we made along the way."
messages.messages["_gamemodes"]["totemfire"] = "totemfire"
messages.messages["_gamemodes"]["toteminferno"] = "toteminferno"
messages.messages["_gamemodes"]["totemroyale"] = "totemroyale"
class TotemMode(GameMode):
def __init__(self, arg=""):
super().__init__(arg)
self.CUSTOM_SETTINGS.limit_abstain = False
self.CUSTOM_SETTINGS.default_role = "crazed shaman"
self.EVENTS = {
"transition_night_begin": EventListener(self.on_transition_night_begin),
"num_totems": EventListener(self.on_num_totems)
}
self.ROLE_GUIDE = {
4: ["wolf shaman"],
6: ["jester", "gunner"],
8: ["shaman", "minion"],
10: ["wolf shaman(2)"],
14: ["wolf shaman(3)", "jester(2)"],
16: ["gunner(2)"]
}
def on_num_totems(self, evt, var, player, role):
if role == "crazed shaman":
evt.data["num"] = round(math.sqrt(len(get_players(var))))
def on_transition_night_begin(self, evt, var):
from src.roles.crazedshaman import LASTGIVEN
LASTGIVEN.clear()
@game_mode("totemfire", minp=4, maxp=24, likelihood=10)
class PlebTotemMode(TotemMode):
def __init__(self, arg=""):
super().__init__(arg)
for totem in ("narcolepsy", "impatience", "pacifism"):
self.TOTEM_CHANCES[totem]["crazed shaman"] = 0
@game_mode("toteminferno", minp=4, maxp=24, likelihood=10)
class PlebTotemMode(TotemMode):
def __init__(self, arg=""):
super().__init__(arg)
self.TOTEM_CHANCES["luck"]["crazed shaman"] = 30
self.TOTEM_CHANCES["death"]["crazed shaman"] = 40
self.TOTEM_CHANCES["retribution"]["crazed shaman"] = 20
self.TOTEM_CHANCES["exchange"]["crazed shaman"] = 20
self.TOTEM_CHANCES["lycanthropy"]["crazed shaman"] = 60
self.TOTEM_CHANCES["misdirection"]["crazed shaman"] = 0
@game_mode("totemroyale", minp=2, maxp=24, likelihood=10)
class TotemRoyaleMode(TotemMode):
def __init__(self, arg=""):
super().__init__(arg)
# reset default to villager so !roles doesn't get confused, we ignore ROLE_GUIDE anyway
self.CUSTOM_SETTINGS.default_role = "villager"
self.CUSTOM_SETTINGS.stats_type = "disabled"
self.ROLE_GUIDE = {
2: ["crazed shaman"]
}
self.EVENTS = {
"chk_win": EventListener(self.on_chk_win, priority=0),
"role_attribution": EventListener(self.on_role_attribution),
}
self.TOTEM_CHANCES = {
"death" : {"crazed shaman": 10},
"protection" : {"crazed shaman": 0},
"silence" : {"crazed shaman": 0},
"revealing" : {"crazed shaman": 25},
"desperation" : {"crazed shaman": 20},
"impatience" : {"crazed shaman": 0},
"pacifism" : {"crazed shaman": 0},
"influence" : {"crazed shaman": 40},
"narcolepsy" : {"crazed shaman": 0},
"exchange" : {"crazed shaman": 0},
"lycanthropy" : {"crazed shaman": 0},
"luck" : {"crazed shaman": 5},
"pestilence" : {"crazed shaman": 0},
"retribution" : {"crazed shaman": 0},
"misdirection" : {"crazed shaman": 0},
"deceit" : {"crazed shaman": 0},
}
self.set_default_totem_chances()
def on_role_attribution(self, evt, var, villagers):
# add crazed shamans equal to the number of players and ignore ROLE_GUIDE
evt.data["addroles"]["crazed shaman"] = len(villagers)
evt.prevent_default = True
def on_chk_win(self, evt, var, rolemap, mainroles, lpl, lwolves, lrealwolves, lvampires):
evt.stop_processing = True
if len(get_players(var)) == 1:
evt.data["winner"] = "no_team_wins"
evt.data["message"] = messages["totemroyale_win"]