fix error when villagergame kills someone with a retribution totem, fixes #224
This commit is contained in:
parent
f101c62af8
commit
6293b61d83
@ -189,10 +189,12 @@ class VillagergameMode(GameMode):
|
|||||||
def startup(self):
|
def startup(self):
|
||||||
events.add_listener("chk_win", self.chk_win)
|
events.add_listener("chk_win", self.chk_win)
|
||||||
events.add_listener("transition_day_begin", self.transition_day)
|
events.add_listener("transition_day_begin", self.transition_day)
|
||||||
|
events.add_listener("retribution_kill", self.on_retribution_kill, priority=4)
|
||||||
|
|
||||||
def teardown(self):
|
def teardown(self):
|
||||||
events.remove_listener("chk_win", self.chk_win)
|
events.remove_listener("chk_win", self.chk_win)
|
||||||
events.remove_listener("transition_day_begin", self.transition_day)
|
events.remove_listener("transition_day_begin", self.transition_day)
|
||||||
|
events.remove_listener("retribution_kill", self.on_retribution_kill, priority=4)
|
||||||
|
|
||||||
def chk_win(self, evt, var, lpl, lwolves, lrealwolves):
|
def chk_win(self, evt, var, lpl, lwolves, lrealwolves):
|
||||||
# village can only win via unanimous vote on the bot nick
|
# village can only win via unanimous vote on the bot nick
|
||||||
@ -237,6 +239,12 @@ class VillagergameMode(GameMode):
|
|||||||
from src.roles import wolf
|
from src.roles import wolf
|
||||||
wolf.KILLS[botconfig.NICK] = [tgt]
|
wolf.KILLS[botconfig.NICK] = [tgt]
|
||||||
|
|
||||||
|
def on_retribution_kill(self, evt, cli, var, victim, orig_target):
|
||||||
|
# There are no wolves for this totem to kill
|
||||||
|
if orig_target == "@wolves":
|
||||||
|
evt.data["target"] = None
|
||||||
|
evt.stop_processing = True
|
||||||
|
|
||||||
@game_mode("foolish", minp = 8, maxp = 24, likelihood = 8)
|
@game_mode("foolish", minp = 8, maxp = 24, likelihood = 8)
|
||||||
class FoolishMode(GameMode):
|
class FoolishMode(GameMode):
|
||||||
"""Contains the fool, be careful not to lynch them!"""
|
"""Contains the fool, be careful not to lynch them!"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user