From 0fa76645263def0102b3150a3b1548cc3d328d59 Mon Sep 17 00:00:00 2001 From: skizzerz Date: Thu, 11 Jan 2018 10:02:05 -0700 Subject: [PATCH] Voting fixes for mudkip and succubus - Remove short-circuit in chk_decision event on day timeout. No idea why I put that there to begin with... - Don't make succubus remove voters from the list, rather just set their weight to 0. This causes their vote to not count while still letting stuff interact with the fact they voted succ (such as desperation totem) - Ensure that mudkip's vote change works on day timeout as well --- src/gamemodes.py | 2 +- src/roles/shaman.py | 5 ----- src/roles/succubus.py | 5 +++-- src/wolfgame.py | 4 +--- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/gamemodes.py b/src/gamemodes.py index a16b518..14ec55b 100644 --- a/src/gamemodes.py +++ b/src/gamemodes.py @@ -1339,7 +1339,7 @@ class MudkipMode(GameMode): avail = len(evt.params.voters) voted = sum(map(len, evt.data["votelist"].values())) - if avail != voted: + if avail != voted and not evt.params.timeout: return majority = avail // 2 + 1 diff --git a/src/roles/shaman.py b/src/roles/shaman.py index 4689ac1..e40f1e5 100644 --- a/src/roles/shaman.py +++ b/src/roles/shaman.py @@ -229,11 +229,6 @@ def on_chk_decision(evt, cli, var, force): evt.data["weights"][votee][v] = weight evt.data["numvotes"][votee] = numvotes -@event_listener("chk_decision", priority=1.1) -def on_hurry_up(evt, cli, var, force): - if evt.params.timeout: - evt.stop_processing = True - @event_listener("chk_decision_abstain") def on_chk_decision_abstain(evt, cli, var, nl): for p in nl: diff --git a/src/roles/succubus.py b/src/roles/succubus.py index d34513a..45063e7 100644 --- a/src/roles/succubus.py +++ b/src/roles/succubus.py @@ -101,13 +101,14 @@ def on_get_random_totem_targets(evt, var, shaman): if succubus in evt.data["targets"]: evt.data["targets"].remove(succubus) -@event_listener("chk_decision", priority=0) +@event_listener("chk_decision") def on_chk_decision(evt, cli, var, force): for votee, voters in evt.data["votelist"].items(): if users._get(votee) in get_all_players(("succubus",)): # FIXME for vtr in ENTRANCED: if vtr.nick in voters: - voters.remove(vtr.nick) + evt.data["numvotes"][votee] -= evt.data["weights"][votee][vtr.nick] + evt.data["weights"][votee][vtr.nick] = 0 def _kill_entranced_voters(var, votelist, not_lynching, votee): if not {p.nick for p in get_all_players(("succubus",))} & (set(itertools.chain(*votelist.values())) | not_lynching): # FIXME diff --git a/src/wolfgame.py b/src/wolfgame.py index 9bfbfb9..ca890c2 100644 --- a/src/wolfgame.py +++ b/src/wolfgame.py @@ -1748,9 +1748,7 @@ def hurry_up(cli, gameid, change): votelist = copy.deepcopy(var.VOTES) # Note: this event can be differentiated between regular chk_decision - # by checking evt.param.timeout. A priority 1.1 event stops event - # propagation, so your priority should be between 1 and 1.1 if you wish - # to handle this event + # by checking evt.params.timeout. event = Event("chk_decision", { "not_lynching": not_lynching, "votelist": votelist,