Fix mudkip
This commit is contained in:
parent
4ee52e3f1d
commit
95da346344
@ -1439,10 +1439,16 @@ class MudkipMode(GameMode):
|
|||||||
# make a copy in case an event mutates it in recursive calls
|
# make a copy in case an event mutates it in recursive calls
|
||||||
tovote = [p for p, n in evt.data["numvotes"].items() if n == maxv]
|
tovote = [p for p, n in evt.data["numvotes"].items() if n == maxv]
|
||||||
self.recursion_guard = True
|
self.recursion_guard = True
|
||||||
|
gameid = var.GAME_ID
|
||||||
|
last = tovote[-1]
|
||||||
for p in tovote:
|
for p in tovote:
|
||||||
chk_decision(cli, force=p)
|
deadlist = tovote[:]
|
||||||
|
deadlist.remove(p)
|
||||||
|
chk_decision(cli, force=p, deadlist=deadlist, end_game=p is last)
|
||||||
self.recursion_guard = False
|
self.recursion_guard = False
|
||||||
evt.data["transition_night"](cli)
|
# gameid changes if game stops due to us voting someone
|
||||||
|
if var.GAME_ID == gameid:
|
||||||
|
evt.data["transition_night"](cli)
|
||||||
|
|
||||||
def daylight_warning(self, evt, var):
|
def daylight_warning(self, evt, var):
|
||||||
evt.data["message"] = "daylight_warning_killtie"
|
evt.data["message"] = "daylight_warning_killtie"
|
||||||
|
@ -180,7 +180,7 @@ def chk_nightdone(cli):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@proxy.stub
|
@proxy.stub
|
||||||
def chk_decision(cli, force=""):
|
def chk_decision(cli, force="", end_game=True, deadlist=[]):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@proxy.stub
|
@proxy.stub
|
||||||
|
@ -1793,7 +1793,7 @@ def fday(cli, nick, chan, rest):
|
|||||||
|
|
||||||
# Specify force = "nick" to force nick to be lynched
|
# Specify force = "nick" to force nick to be lynched
|
||||||
@proxy.impl
|
@proxy.impl
|
||||||
def chk_decision(cli, force=""):
|
def chk_decision(cli, force="", end_game=True, deadlist=[]):
|
||||||
with var.GRAVEYARD_LOCK:
|
with var.GRAVEYARD_LOCK:
|
||||||
if var.PHASE != "day":
|
if var.PHASE != "day":
|
||||||
return
|
return
|
||||||
@ -1808,7 +1808,7 @@ def chk_decision(cli, force=""):
|
|||||||
avail = len(pl)
|
avail = len(pl)
|
||||||
votesneeded = avail // 2 + 1
|
votesneeded = avail // 2 + 1
|
||||||
not_lynching = set(var.NO_LYNCH)
|
not_lynching = set(var.NO_LYNCH)
|
||||||
deadlist = []
|
deadlist = deadlist[:] # make a copy as events may mutate it
|
||||||
votelist = copy.deepcopy(var.VOTES)
|
votelist = copy.deepcopy(var.VOTES)
|
||||||
|
|
||||||
event = Event("chk_decision", {
|
event = Event("chk_decision", {
|
||||||
@ -1862,6 +1862,7 @@ def chk_decision(cli, force=""):
|
|||||||
not_lynching=not_lynching)
|
not_lynching=not_lynching)
|
||||||
if vote_evt.dispatch(cli, var, voters):
|
if vote_evt.dispatch(cli, var, voters):
|
||||||
votee = vote_evt.data["votee"]
|
votee = vote_evt.data["votee"]
|
||||||
|
deadlist = vote_evt.data["deadlist"]
|
||||||
# roles that end the game upon being lynched
|
# roles that end the game upon being lynched
|
||||||
if votee in get_roles("fool"): # FIXME
|
if votee in get_roles("fool"): # FIXME
|
||||||
# ends game immediately, with fool as only winner
|
# ends game immediately, with fool as only winner
|
||||||
@ -1884,7 +1885,7 @@ def chk_decision(cli, force=""):
|
|||||||
lmsg = random.choice(messages["lynch_no_reveal"]).format(votee)
|
lmsg = random.choice(messages["lynch_no_reveal"]).format(votee)
|
||||||
cli.msg(botconfig.CHANNEL, lmsg)
|
cli.msg(botconfig.CHANNEL, lmsg)
|
||||||
better_deadlist = [users._get(p) for p in deadlist] # FIXME -- convert chk_decision_lynch to be user-aware
|
better_deadlist = [users._get(p) for p in deadlist] # FIXME -- convert chk_decision_lynch to be user-aware
|
||||||
if not del_player(users._get(votee), killer_role="villager", deadlist=better_deadlist): # FIXME
|
if not del_player(users._get(votee), killer_role="villager", deadlist=better_deadlist, end_game=end_game): # FIXME
|
||||||
return
|
return
|
||||||
do_night_transision = True
|
do_night_transision = True
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user