Fix mudkip day timeouts breaking things if game ends during them

This commit is contained in:
skizzerz 2018-01-11 11:08:57 -07:00
parent 4a7dd390e5
commit 965b230f64
3 changed files with 10 additions and 5 deletions

View File

@ -167,6 +167,7 @@
"daylight_warning": "\u0002As the sun sinks inexorably toward the horizon, turning the lanky pine trees into fire-edged silhouettes, the villagers are reminded that very little time remains for them to reach a decision; if darkness falls before they have done so, the majority will win the vote. No one will be lynched if there are no votes or an even split.\u0002",
"daylight_warning_killtie": "\u0002As the sun sinks inexorably toward the horizon, turning the lanky pine trees into fire-edged silhouettes, the villagers are reminded that very little time remains for them to reach a decision; if darkness falls before they have done so, the plurality will win the vote. Ties for plurality will cause all tied players to be lynched, but no one will be lynched if there are no votes.\u0002",
"sunset": "As the sun sets, the villagers agree to retire to their beds and wait for morning.",
"sunset_lynch": "The sun sets.",
"twilight_warning": "\u0002A few villagers awake early and notice it is still dark outside. The night is almost over and there are still whispers heard in the village.\u0002",
"sunrise": "Night lasted \u0002{0:0>2}:{1:0>2}\u0002. It is now daytime. The villagers awake, thankful for surviving the night, and search the village... ",
"not_daytime": "It is not daytime.",

View File

@ -1355,6 +1355,9 @@ class MudkipMode(GameMode):
gameid = var.GAME_ID
last = tovote[-1]
if evt.params.timeout:
channels.Main.send(messages["sunset_lynch"])
from src.wolfgame import chk_decision
for p in tovote:
deadlist = tovote[:]
@ -1367,8 +1370,7 @@ class MudkipMode(GameMode):
evt.data["transition_night"](cli)
# make original chk_decision that called us no-op
evt.data["votelist"] = {}
evt.data["numvotes"] = {}
evt.prevent_default = True
def daylight_warning(self, evt, var):
evt.data["message"] = "daylight_warning_killtie"

View File

@ -1758,7 +1758,8 @@ def hurry_up(cli, gameid, change):
"weights": {}, # filled as part of a priority 1 event
"transition_night": transition_night
}, voters=pl, timeout=True)
event.dispatch(cli, var, "")
if not event.dispatch(cli, var, ""):
return
not_lynching = event.data["not_lynching"]
votelist = event.data["votelist"]
numvotes = event.data["numvotes"]
@ -1772,7 +1773,7 @@ def hurry_up(cli, gameid, change):
elif numvotes[votee] == maxfound[0]:
found_dup = True
if maxfound[0] > 0 and not found_dup:
cli.msg(chan, "The sun sets.")
cli.msg(chan, messages["sunset_lynch"])
chk_decision(cli, force=maxfound[1]) # Induce a lynch
else:
cli.msg(chan, messages["sunset"])
@ -1821,7 +1822,8 @@ def chk_decision(cli, force="", end_game=True, deadlist=[]):
"weights": {}, # filled as part of a priority 1 event
"transition_night": transition_night
}, voters=pl, timeout=False)
event.dispatch(cli, var, force)
if not event.dispatch(cli, var, force):
return
not_lynching = event.data["not_lynching"]
votelist = event.data["votelist"]
numvotes = event.data["numvotes"]