Add check to ensure nightroles only act at night. Closes #39
This commit is contained in:
parent
cc25784ad4
commit
eb299c6232
@ -1243,10 +1243,6 @@ def chk_win(cli, end_game = True):
|
|||||||
stop_game(cli, winner)
|
stop_game(cli, winner)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def del_player(cli, nick, forced_death = False, devoice = True, end_game = True):
|
def del_player(cli, nick, forced_death = False, devoice = True, end_game = True):
|
||||||
"""
|
"""
|
||||||
Returns: False if one side won.
|
Returns: False if one side won.
|
||||||
@ -1815,9 +1811,6 @@ def leave_game(cli, nick, chan, rest):
|
|||||||
|
|
||||||
del_player(cli, nick)
|
del_player(cli, nick)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def begin_day(cli):
|
def begin_day(cli):
|
||||||
chan = botconfig.CHANNEL
|
chan = botconfig.CHANNEL
|
||||||
|
|
||||||
@ -2172,7 +2165,6 @@ def transition_day(cli, gameid=0):
|
|||||||
|
|
||||||
begin_day(cli)
|
begin_day(cli)
|
||||||
|
|
||||||
|
|
||||||
def chk_nightdone(cli):
|
def chk_nightdone(cli):
|
||||||
# TODO: alphabetize and/or arrange sensibly
|
# TODO: alphabetize and/or arrange sensibly
|
||||||
actedcount = len(var.SEEN + list(var.HVISITED.keys()) + list(var.GUARDED.keys()) +
|
actedcount = len(var.SEEN + list(var.HVISITED.keys()) + list(var.GUARDED.keys()) +
|
||||||
@ -2216,8 +2208,6 @@ def chk_nightdone(cli):
|
|||||||
if var.PHASE == "night": # Double check
|
if var.PHASE == "night": # Double check
|
||||||
transition_day(cli)
|
transition_day(cli)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@cmd("lynch", "vote", "v")
|
@cmd("lynch", "vote", "v")
|
||||||
def vote(cli, nick, chann_, rest):
|
def vote(cli, nick, chann_, rest):
|
||||||
"""Use this to vote for a candidate to be lynched"""
|
"""Use this to vote for a candidate to be lynched"""
|
||||||
@ -2294,8 +2284,6 @@ def vote(cli, nick, chann_, rest):
|
|||||||
|
|
||||||
chk_decision(cli)
|
chk_decision(cli)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@cmd("retract")
|
@cmd("retract")
|
||||||
def retract(cli, nick, chann_, rest):
|
def retract(cli, nick, chann_, rest):
|
||||||
"""Takes back your vote during the day (for whom to lynch)"""
|
"""Takes back your vote during the day (for whom to lynch)"""
|
||||||
@ -2620,7 +2608,6 @@ def kill(cli, nick, rest):
|
|||||||
pm(cli, nick, "You are angry tonight and may kill a second target. Use kill <nick1> and <nick2> to select multiple targets.")
|
pm(cli, nick, "You are angry tonight and may kill a second target. Use kill <nick1> and <nick2> to select multiple targets.")
|
||||||
chk_nightdone(cli)
|
chk_nightdone(cli)
|
||||||
|
|
||||||
|
|
||||||
@pmcmd("guard", "protect", "save")
|
@pmcmd("guard", "protect", "save")
|
||||||
def guard(cli, nick, rest):
|
def guard(cli, nick, rest):
|
||||||
if var.PHASE in ("none", "join"):
|
if var.PHASE in ("none", "join"):
|
||||||
@ -2760,7 +2747,6 @@ def observe(cli, nick, rest):
|
|||||||
var.LOGGER.logBare(victim, "OBSERVED", nick)
|
var.LOGGER.logBare(victim, "OBSERVED", nick)
|
||||||
chk_nightdone(cli)
|
chk_nightdone(cli)
|
||||||
|
|
||||||
|
|
||||||
@pmcmd("id")
|
@pmcmd("id")
|
||||||
def investigate(cli, nick, rest):
|
def investigate(cli, nick, rest):
|
||||||
if var.PHASE in ("none", "join"):
|
if var.PHASE in ("none", "join"):
|
||||||
@ -2815,8 +2801,6 @@ def investigate(cli, nick, rest):
|
|||||||
"that \u0002{0}\u0002 is the detective!").format(nick))
|
"that \u0002{0}\u0002 is the detective!").format(nick))
|
||||||
var.LOGGER.logBare(nick, "PAPERDROP")
|
var.LOGGER.logBare(nick, "PAPERDROP")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pmcmd("visit")
|
@pmcmd("visit")
|
||||||
def hvisit(cli, nick, rest):
|
def hvisit(cli, nick, rest):
|
||||||
if var.PHASE in ("none", "join"):
|
if var.PHASE in ("none", "join"):
|
||||||
@ -2868,12 +2852,9 @@ def hvisit(cli, nick, rest):
|
|||||||
var.LOGGER.logBare(var.HVISITED[nick], "VISITED", nick)
|
var.LOGGER.logBare(var.HVISITED[nick], "VISITED", nick)
|
||||||
chk_nightdone(cli)
|
chk_nightdone(cli)
|
||||||
|
|
||||||
|
|
||||||
def is_fake_nick(who):
|
def is_fake_nick(who):
|
||||||
return not(re.search("^[a-zA-Z\\\_\]\[`]([a-zA-Z0-9\\\_\]\[`]+)?", who)) or who.lower().endswith("serv")
|
return not(re.search("^[a-zA-Z\\\_\]\[`]([a-zA-Z0-9\\\_\]\[`]+)?", who)) or who.lower().endswith("serv")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pmcmd("see")
|
@pmcmd("see")
|
||||||
def see(cli, nick, rest):
|
def see(cli, nick, rest):
|
||||||
if var.PHASE in ("none", "join"):
|
if var.PHASE in ("none", "join"):
|
||||||
@ -3150,6 +3131,9 @@ def target(cli, nick, rest):
|
|||||||
if nick not in var.ROLES["assassin"]:
|
if nick not in var.ROLES["assassin"]:
|
||||||
pm(cli, nick, "Only an assassin may use this command.")
|
pm(cli, nick, "Only an assassin may use this command.")
|
||||||
return
|
return
|
||||||
|
if var.PHASE != "night":
|
||||||
|
pm(cli, nick, "You may only target people at night.")
|
||||||
|
return
|
||||||
if nick in var.TARGETED and var.TARGETED[nick] != None:
|
if nick in var.TARGETED and var.TARGETED[nick] != None:
|
||||||
pm(cli, nick, "You have already chosen a target.")
|
pm(cli, nick, "You have already chosen a target.")
|
||||||
return
|
return
|
||||||
@ -3201,6 +3185,9 @@ def hex(cli, nick, rest):
|
|||||||
if nick not in var.ROLES["hag"]:
|
if nick not in var.ROLES["hag"]:
|
||||||
pm(cli, nick, "Only a hag may use this command.")
|
pm(cli, nick, "Only a hag may use this command.")
|
||||||
return
|
return
|
||||||
|
if var.PHASE != "night":
|
||||||
|
pm(cli, nick, "You may only hex at night.")
|
||||||
|
return
|
||||||
if nick in var.HEXED:
|
if nick in var.HEXED:
|
||||||
pm(cli, nick, "You have already hexed someone tonight.")
|
pm(cli, nick, "You have already hexed someone tonight.")
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user