parent
95fd796953
commit
bcedbd4c65
@ -99,17 +99,19 @@ def on_get_special(evt, var):
|
||||
evt.data["special"].update(get_players(("guardian angel", "bodyguard")))
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
if actor_role in ("bodyguard", "guardian angel"):
|
||||
if actor in GUARDED:
|
||||
pm(cli, GUARDED.pop(actor), messages["protector disappeared"])
|
||||
if actor in LASTGUARDED:
|
||||
del LASTGUARDED[actor]
|
||||
if nick_role in ("bodyguard", "guardian angel"):
|
||||
if nick in GUARDED:
|
||||
pm(cli, GUARDED.pop(nick), messages["protector disappeared"])
|
||||
if nick in LASTGUARDED:
|
||||
del LASTGUARDED[nick]
|
||||
if actor.nick in GUARDED:
|
||||
guarded = users._get(GUARDED.pop(actor.nick)) # FIXME
|
||||
guarded.send(messages["protector disappeared"])
|
||||
if actor.nick in LASTGUARDED:
|
||||
del LASTGUARDED[actor.nick]
|
||||
if target_role in ("bodyguard", "guardian angel"):
|
||||
if target.nick in GUARDED:
|
||||
guarded = users._get(GUARDED.pop(target.nick)) # FIXME
|
||||
guarded.send(messages["protector disappeared"])
|
||||
if target.nick in LASTGUARDED:
|
||||
del LASTGUARDED[target.nick]
|
||||
|
||||
@event_listener("chk_nightdone")
|
||||
def on_chk_nightdone(evt, var):
|
||||
|
@ -70,11 +70,11 @@ def on_get_special(evt, var):
|
||||
evt.data["special"].update(get_players(("detective",)))
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
if actor_role == "detective" and nick_role != "detective":
|
||||
INVESTIGATED.discard(actor)
|
||||
elif nick_role == "detective" and actor_role != "detective":
|
||||
INVESTIGATED.discard(nick)
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
if actor_role == "detective" and target_role != "detective":
|
||||
INVESTIGATED.discard(actor.nick)
|
||||
elif target_role == "detective" and actor_role != "detective":
|
||||
INVESTIGATED.discard(target.nick)
|
||||
|
||||
@event_listener("transition_night_end", priority=2)
|
||||
def on_transition_night_end(evt, var):
|
||||
|
@ -75,16 +75,16 @@ def on_acted(evt, var, user, actor):
|
||||
evt.data["acted"] = True
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
if actor_role == "doomsayer" and nick_role != "doomsayer":
|
||||
SEEN.discard(actor)
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
if actor_role == "doomsayer" and target_role != "doomsayer":
|
||||
SEEN.discard(actor.nick)
|
||||
for name, mapping in _mappings:
|
||||
mapping.pop(actor, None)
|
||||
mapping.pop(actor.nick, None)
|
||||
|
||||
elif nick_role == "doomsayer" and actor_role != "doomsayer":
|
||||
SEEN.discard(nick)
|
||||
elif target_role == "doomsayer" and actor_role != "doomsayer":
|
||||
SEEN.discard(target.nick)
|
||||
for name, mapping in _mappings:
|
||||
mapping.pop(nick, None)
|
||||
mapping.pop(target.nick, None)
|
||||
|
||||
@event_listener("del_player")
|
||||
def on_del_player(evt, var, user, mainrole, allroles, death_triggers):
|
||||
|
@ -142,16 +142,16 @@ def on_transition_day(evt, var):
|
||||
evt.data["killers"][d].append(k)
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
for k in set(KILLS):
|
||||
if k.nick == actor or k.nick == nick:
|
||||
if k is actor or k is target:
|
||||
del KILLS[k]
|
||||
|
||||
for k in set(TARGETS):
|
||||
if actor_role == "dullahan" and nick_role != "dullahan" and k.nick == actor:
|
||||
TARGETS[users._get(nick)] = TARGETS.pop(k) - {users._get(nick)} # FIXME
|
||||
elif nick_role == "dullahan" and actor_role != "dullahan" and k.nick == nick:
|
||||
TARGET[users._get(actor)] = TARGETS.pop(k) - {users._get(actor)} # FIXME
|
||||
if actor_role == "dullahan" and target_role != "dullahan" and k is actor:
|
||||
TARGETS[target] = TARGETS.pop(k) - {target}
|
||||
elif target_role == "dullahan" and actor_role != "dullahan" and k is target:
|
||||
TARGET[actor] = TARGETS.pop(k) - {actor}
|
||||
|
||||
@event_listener("chk_nightdone")
|
||||
def on_chk_nightdone(evt, var):
|
||||
|
@ -112,17 +112,19 @@ def on_chk_nightdone(evt, var):
|
||||
evt.data["nightroles"].extend(get_all_players(("harlot",)))
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange_roles(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
def on_exchange_roles(evt, var, actor, target, actor_role, target_role):
|
||||
if actor_role == "harlot":
|
||||
if actor in VISITED:
|
||||
if VISITED[actor] is not None:
|
||||
pm(cli, VISITED[actor], messages["harlot_disappeared"].format(actor))
|
||||
del VISITED[actor]
|
||||
if nick_role == "harlot":
|
||||
if nick in VISITED:
|
||||
if VISITED[nick] is not None:
|
||||
pm(cli, VISITED[nick], messages["harlot_disappeared"].format(nick))
|
||||
del VISITED[nick]
|
||||
if actor.nick in VISITED:
|
||||
if VISITED[actor.nick] is not None:
|
||||
visited = users._get(VISITED[actor.nick]) # FIXME
|
||||
visited.send(messages["harlot_disappeared"].format(actor))
|
||||
del VISITED[actor.nick]
|
||||
if target_role == "harlot":
|
||||
if target.nick in VISITED:
|
||||
if VISITED[target.nick] is not None:
|
||||
visited = users._get(VISITED[target.nick]) # FIXME
|
||||
visited.send(messages["harlot_disappeared"].format(target))
|
||||
del VISITED[target.nick]
|
||||
|
||||
@event_listener("transition_night_end", priority=2)
|
||||
def on_transition_night_end(evt, var):
|
||||
|
@ -113,14 +113,12 @@ def on_transition_day(evt, var):
|
||||
del KILLS[k]
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
user = users._get(actor) # FIXME
|
||||
target = users._get(nick) # FIXME
|
||||
KILLS.pop(user, None)
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
KILLS.pop(actor, None)
|
||||
KILLS.pop(target, None)
|
||||
HUNTERS.discard(user)
|
||||
HUNTERS.discard(actor)
|
||||
HUNTERS.discard(target)
|
||||
PASSED.discard(user)
|
||||
PASSED.discard(actor)
|
||||
PASSED.discard(target)
|
||||
|
||||
@event_listener("chk_nightdone")
|
||||
|
@ -10,8 +10,8 @@ from src.messages import messages
|
||||
from src.events import Event
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
if nick_role not in ("mystic", "wolf mystic") and actor_role not in ("mystic", "wolf mystic"):
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
if actor_role not in ("mystic", "wolf mystic") and target_role not in ("mystic", "wolf mystic"):
|
||||
return
|
||||
|
||||
special = set(get_players(("harlot", "priest", "prophet", "matchmaker",
|
||||
@ -23,21 +23,21 @@ def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
neutral = set(get_players(var.TRUE_NEUTRAL_ROLES))
|
||||
special = evt2.data["special"]
|
||||
|
||||
if nick_role == "wolf mystic" and actor_role != "wolf mystic":
|
||||
if target_role == "wolf mystic" and actor_role != "wolf mystic":
|
||||
# # of special villagers = # of players - # of villagers - # of wolves - # of neutrals
|
||||
numvills = len(special & (pl - wolves - neutral))
|
||||
evt.data["actor_messages"].append(messages["wolf_mystic_info"].format("are" if numvills != 1 else "is", numvills, "s" if numvills != 1 else ""))
|
||||
elif nick_role == "mystic" and actor_role != "mystic":
|
||||
elif target_role == "mystic" and actor_role != "mystic":
|
||||
numevil = len(wolves)
|
||||
evt.data["actor_messages"].append(messages["mystic_info"].format("are" if numevil != 1 else "is", numevil, "s" if numevil != 1 else ""))
|
||||
|
||||
if actor_role == "wolf mystic" and nick_role != "wolf mystic":
|
||||
if actor_role == "wolf mystic" and target_role != "wolf mystic":
|
||||
# # of special villagers = # of players - # of villagers - # of wolves - # of neutrals
|
||||
numvills = len(special & (pl - wolves - neutral))
|
||||
evt.data["nick_messages"].append(messages["wolf_mystic_info"].format("are" if numvills != 1 else "is", numvills, "s" if numvills != 1 else ""))
|
||||
elif actor_role == "mystic" and nick_role != "mystic":
|
||||
evt.data["target_messages"].append(messages["wolf_mystic_info"].format("are" if numvills != 1 else "is", numvills, "s" if numvills != 1 else ""))
|
||||
elif actor_role == "mystic" and target_role != "mystic":
|
||||
numevil = len(wolves)
|
||||
evt.data["nick_messages"].append(messages["mystic_info"].format("are" if numevil != 1 else "is", numevil, "s" if numevil != 1 else ""))
|
||||
evt.data["target_messages"].append(messages["mystic_info"].format("are" if numevil != 1 else "is", numevil, "s" if numevil != 1 else ""))
|
||||
|
||||
@event_listener("transition_night_end", priority=2.01)
|
||||
def on_transition_night_end(evt, var):
|
||||
|
@ -95,9 +95,9 @@ def on_get_special(evt, var):
|
||||
evt.data["special"].update(get_players(("seer", "oracle", "augur")))
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
if actor_role in ("seer", "oracle", "augur"):
|
||||
SEEN.discard(actor)
|
||||
SEEN.discard(actor.nick)
|
||||
|
||||
@event_listener("chk_nightdone")
|
||||
def on_chk_nightdone(evt, var):
|
||||
|
@ -151,29 +151,29 @@ def on_get_special(evt, var):
|
||||
evt.data["special"].update(get_players(("shaman", "crazed shaman", "wolf shaman")))
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
actor_totem = None
|
||||
nick_totem = None
|
||||
target_totem = None
|
||||
if actor_role in var.TOTEM_ORDER:
|
||||
actor_totem = TOTEMS.pop(actor)
|
||||
if actor in SHAMANS:
|
||||
del SHAMANS[actor]
|
||||
if actor in LASTGIVEN:
|
||||
del LASTGIVEN[actor]
|
||||
if nick_role in var.TOTEM_ORDER:
|
||||
nick_totem = TOTEMS.pop(nick)
|
||||
if nick in SHAMANS:
|
||||
del SHAMANS[nick]
|
||||
if nick in LASTGIVEN:
|
||||
del LASTGIVEN[nick]
|
||||
if nick_totem:
|
||||
if nick_role != "crazed shaman":
|
||||
evt.data["actor_messages"].append(messages["shaman_totem"].format(nick_totem))
|
||||
TOTEMS[actor] = nick_totem
|
||||
actor_totem = TOTEMS.pop(actor.nick)
|
||||
if actor.nick in SHAMANS:
|
||||
del SHAMANS[actor.nick]
|
||||
if actor.nick in LASTGIVEN:
|
||||
del LASTGIVEN[actor.nick]
|
||||
if target_role in var.TOTEM_ORDER:
|
||||
target_totem = TOTEMS.pop(target.nick)
|
||||
if target.nick in SHAMANS:
|
||||
del SHAMANS[target.nick]
|
||||
if target.nick in LASTGIVEN:
|
||||
del LASTGIVEN[target.nick]
|
||||
if target_totem:
|
||||
if target_role != "crazed shaman":
|
||||
evt.data["actor_messages"].append(messages["shaman_totem"].format(target_totem))
|
||||
TOTEMS[actor.nick] = target_totem
|
||||
if actor_totem:
|
||||
if actor_role != "crazed shaman":
|
||||
evt.data["nick_messages"].append(messages["shaman_totem"].format(actor_totem))
|
||||
TOTEMS[nick] = actor_totem
|
||||
evt.data["target_messages"].append(messages["shaman_totem"].format(actor_totem))
|
||||
TOTEMS[target.nick] = actor_totem
|
||||
|
||||
@event_listener("chk_nightdone")
|
||||
def on_chk_nightdone(evt, var):
|
||||
|
@ -158,8 +158,8 @@ def on_chk_win(evt, cli, var, rolemap, mainroles, lpl, lwolves, lrealwolves):
|
||||
evt.data["message"] = messages["succubus_win"].format(plural("succubus", lsuccubi), plural("has", lsuccubi), plural("master's", lsuccubi))
|
||||
|
||||
@event_listener("can_exchange")
|
||||
def on_can_exchange(evt, var, actor, nick):
|
||||
if actor in var.ROLES["succubus"] or nick in var.ROLES["succubus"]:
|
||||
def on_can_exchange(evt, var, user, target):
|
||||
if user.nick in var.ROLES["succubus"] or target.nick in var.ROLES["succubus"]:
|
||||
evt.prevent_default = True
|
||||
evt.stop_processing = True
|
||||
|
||||
|
@ -111,13 +111,13 @@ def on_transition_day(evt, var):
|
||||
var.DYING.add(killer)
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
if actor in KILLS:
|
||||
del KILLS[actor]
|
||||
if nick in KILLS:
|
||||
del KILLS[nick]
|
||||
PASSED.discard(actor)
|
||||
PASSED.discard(nick)
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
if actor.nick in KILLS:
|
||||
del KILLS[actor.nick]
|
||||
if target.nick in KILLS:
|
||||
del KILLS[target.nick]
|
||||
PASSED.discard(actor.nick)
|
||||
PASSED.discard(target.nick)
|
||||
|
||||
@event_listener("chk_nightdone")
|
||||
def on_chk_nightdone(evt, var):
|
||||
|
@ -54,27 +54,25 @@ def on_rename(evt, cli, var, prefix, nick):
|
||||
IDOLS[wildchild] = nick
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
if actor_role == "wolf" and actor in WILD_CHILDREN and nick not in WILD_CHILDREN:
|
||||
WILD_CHILDREN.discard(actor)
|
||||
WILD_CHILDREN.add(nick)
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
if actor_role == "wolf" and actor.nick in WILD_CHILDREN and target.nick not in WILD_CHILDREN:
|
||||
WILD_CHILDREN.discard(actor.nick)
|
||||
WILD_CHILDREN.add(target.nick)
|
||||
elif actor_role == "wild child":
|
||||
if nick_role == "wild child":
|
||||
temp = IDOLS[nick]
|
||||
IDOLS[nick] = IDOLS[actor]
|
||||
IDOLS[actor] = temp
|
||||
evt.data["actor_messages"].append(messages["wild_child_idol"].format(IDOLS[actor]))
|
||||
evt.data["nick_messages"].append(messages["wild_child_idol"].format(IDOLS[nick]))
|
||||
if target_role == "wild child":
|
||||
IDOLS[actor.nick], IDOLS[target.nick] = IDOLS[target.nick], IDOLS[actor.nick]
|
||||
evt.data["actor_messages"].append(messages["wild_child_idol"].format(IDOLS[actor.nick]))
|
||||
evt.data["target_messages"].append(messages["wild_child_idol"].format(IDOLS[target.nick]))
|
||||
else:
|
||||
IDOLS[nick] = IDOLS.pop(actor)
|
||||
evt.data["nick_messages"].append(messages["wild_child_idol"].format(IDOLS[nick]))
|
||||
if nick_role == "wolf" and nick in WILD_CHILDREN and actor not in WILD_CHILDREN:
|
||||
WILD_CHILDREN.discard(nick)
|
||||
WILD_CHILDREN.add(actor)
|
||||
elif nick_role == "wild child" and actor_role != "wild child":
|
||||
IDOLS[target.nick] = IDOLS.pop(actor.nick)
|
||||
evt.data["target_messages"].append(messages["wild_child_idol"].format(IDOLS[target.nick]))
|
||||
if target_role == "wolf" and target.nick in WILD_CHILDREN and actor.nick not in WILD_CHILDREN:
|
||||
WILD_CHILDREN.discard(target.nick)
|
||||
WILD_CHILDREN.add(actor.nick)
|
||||
elif target_role == "wild child" and actor_role != "wild child":
|
||||
# if they're both wild children, already swapped idols above
|
||||
IDOLS[actor] = IDOLS.pop(nick)
|
||||
evt.data["actor_messages"].append(messages["wild_child_idol"].format(IDOLS[actor]))
|
||||
IDOLS[actor.nick] = IDOLS.pop(target.nick)
|
||||
evt.data["actor_messages"].append(messages["wild_child_idol"].format(IDOLS[actor.nick]))
|
||||
|
||||
@event_listener("myrole")
|
||||
def on_myrole(evt, var, user):
|
||||
|
@ -222,7 +222,7 @@ def on_retribution_kill(evt, var, victim, orig_target):
|
||||
evt.data["target"] = random.choice(wolves)
|
||||
|
||||
@event_listener("exchange_roles", priority=2)
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
wcroles = var.WOLFCHAT_ROLES
|
||||
if var.RESTRICT_WOLFCHAT & var.RW_REM_NON_WOLVES:
|
||||
if var.RESTRICT_WOLFCHAT & var.RW_TRAITOR_NON_WOLF:
|
||||
@ -230,63 +230,77 @@ def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
else:
|
||||
wcroles = var.WOLF_ROLES | {"traitor"}
|
||||
|
||||
if nick_role in wcroles and actor_role not in wcroles:
|
||||
pl = list_players()
|
||||
if target_role in wcroles and actor_role not in wcroles:
|
||||
pl = get_players()
|
||||
random.shuffle(pl)
|
||||
pl.remove(actor) # remove self from list
|
||||
notify = []
|
||||
for i, player in enumerate(pl):
|
||||
prole = get_role(player)
|
||||
if player == nick:
|
||||
to_send = []
|
||||
for player in pl:
|
||||
prole = get_main_role(player)
|
||||
if player is target:
|
||||
prole = actor_role
|
||||
wevt = Event("wolflist", {"tags": set()})
|
||||
wevt.dispatch(cli, var, player, actor)
|
||||
wevt.dispatch(actor.client, var, player.nick, actor.nick)
|
||||
tags = " ".join(wevt.data["tags"])
|
||||
if prole in wcroles:
|
||||
if tags:
|
||||
tags += " "
|
||||
pl[i] = "\u0002{0}\u0002 ({1}{2})".format(player, tags, prole)
|
||||
to_send.append("\u0002{0}\u0002 ({1}{2})".format(player, tags, prole))
|
||||
notify.append(player)
|
||||
elif tags:
|
||||
pl[i] = "{0} ({1})".format(player, tags)
|
||||
to_send.append("{0} ({1})".format(player, tags))
|
||||
else:
|
||||
to_send.append(player.nick)
|
||||
|
||||
mass_privmsg(cli, notify, messages["players_exchanged_roles"].format(nick, actor))
|
||||
evt.data["actor_messages"].append("Players: " + ", ".join(pl))
|
||||
if nick_role in CAN_KILL and var.DISEASED_WOLVES:
|
||||
for player in notify:
|
||||
player.queue_message(messages["players_exchanged_roles"].format(target, actor))
|
||||
if notify:
|
||||
player.send_messages()
|
||||
|
||||
evt.data["actor_messages"].append("Players: " + ", ".join(to_send))
|
||||
if target_role in CAN_KILL and var.DISEASED_WOLVES:
|
||||
evt.data["actor_messages"].append(messages["ill_wolves"])
|
||||
if var.ALPHA_ENABLED and nick_role == "alpha wolf" and actor not in var.ALPHA_WOLVES:
|
||||
if var.ALPHA_ENABLED and target_role == "alpha wolf" and actor.nick not in var.ALPHA_WOLVES:
|
||||
evt.data["actor_messages"].append(messages["wolf_bite"])
|
||||
elif actor_role in wcroles and nick_role not in wcroles:
|
||||
pl = list_players()
|
||||
elif actor_role in wcroles and target_role not in wcroles:
|
||||
pl = get_players()
|
||||
random.shuffle(pl)
|
||||
pl.remove(nick) # remove self from list
|
||||
pl.remove(target) # remove self from list
|
||||
notify = []
|
||||
for i, player in enumerate(pl):
|
||||
prole = get_role(player)
|
||||
if player == actor:
|
||||
prole = nick_role
|
||||
to_send = []
|
||||
for player in pl:
|
||||
prole = get_main_role(player)
|
||||
if player is actor:
|
||||
prole = target_role
|
||||
wevt = Event("wolflist", {"tags": set()})
|
||||
wevt.dispatch(cli, var, player, nick)
|
||||
wevt.dispatch(actor.client, var, player.nick, target.nick)
|
||||
tags = " ".join(wevt.data["tags"])
|
||||
if prole in wcroles:
|
||||
if tags:
|
||||
tags += " "
|
||||
pl[i] = "\u0002{0}\u0002 ({1}{2})".format(player, tags, prole)
|
||||
to_send.append("\u0002{0}\u0002 ({1}{2})".format(player, tags, prole))
|
||||
notify.append(player)
|
||||
elif tags:
|
||||
pl[i] = "{0} ({1})".format(player, tags)
|
||||
to_send.append("{0} ({1})".format(player, tags))
|
||||
else:
|
||||
to_send.append(player.nick)
|
||||
|
||||
mass_privmsg(cli, notify, messages["players_exchanged_roles"].format(actor, nick))
|
||||
evt.data["nick_messages"].append("Players: " + ", ".join(pl))
|
||||
for player in notify:
|
||||
player.queue_message(messages["players_exchanged_roles"].format(actor, target))
|
||||
if notify:
|
||||
player.send_messages()
|
||||
|
||||
evt.data["target_messages"].append("Players: " + ", ".join(to_send))
|
||||
if actor_role in CAN_KILL and var.DISEASED_WOLVES:
|
||||
evt.data["nick_messages"].append(messages["ill_wolves"])
|
||||
if var.ALPHA_ENABLED and actor_role == "alpha wolf" and nick not in var.ALPHA_WOLVES:
|
||||
evt.data["nick_messages"].append(messages["wolf_bite"])
|
||||
evt.data["target_messages"].append(messages["ill_wolves"])
|
||||
if var.ALPHA_ENABLED and actor_role == "alpha wolf" and target.nick not in var.ALPHA_WOLVES:
|
||||
evt.data["target_messages"].append(messages["wolf_bite"])
|
||||
|
||||
if actor in KILLS:
|
||||
del KILLS[actor]
|
||||
if nick in KILLS:
|
||||
del KILLS[nick]
|
||||
if actor.nick in KILLS:
|
||||
del KILLS[actor.nick]
|
||||
if target.nick in KILLS:
|
||||
del KILLS[target.nick]
|
||||
|
||||
@event_listener("chk_nightdone", priority=3)
|
||||
def on_chk_nightdone(evt, var):
|
||||
|
@ -27,7 +27,7 @@ def on_del_player(evt, var, user, mainrole, allroles, death_triggers):
|
||||
|
||||
# wolf fires on priority 2, so we can add our extra messages now (at default priority 5)
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
def on_exchange(evt, var, actor, target, actor_role, target_role):
|
||||
if not ANGRY_WOLVES:
|
||||
return
|
||||
|
||||
@ -38,11 +38,10 @@ def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
else:
|
||||
wcroles = var.WOLF_ROLES | {"traitor"}
|
||||
|
||||
# FIXME: once nick and actor are users themselves, change the below calls to wolf_can_kill()
|
||||
if nick_role in wcroles and actor_role not in wcroles and wolf.wolf_can_kill(var, users._get(nick)):
|
||||
if target_role in wcroles and actor_role not in wcroles and wolf.wolf_can_kill(var, target):
|
||||
evt.data["actor_messages"].append(messages["angry_wolves"])
|
||||
elif actor_role in wcroles and nick_role not in wcroles and wolf.wolf_can_kill(var, users._get(actor)):
|
||||
evt.data["nick_messages"].append(messages["angry_wolves"])
|
||||
elif actor_role in wcroles and target_role not in wcroles and wolf.wolf_can_kill(var, actor):
|
||||
evt.data["target_messages"].append(messages["angry_wolves"])
|
||||
|
||||
@event_listener("transition_night_end", priority=3)
|
||||
def on_transition_night_end(evt, var):
|
||||
|
@ -4058,8 +4058,12 @@ def check_exchange(cli, actor, nick):
|
||||
#some roles can act on themselves, ignore this
|
||||
if actor == nick:
|
||||
return False
|
||||
|
||||
user = users._get(actor) # FIXME
|
||||
target = users._get(nick) # FIXME
|
||||
|
||||
event = Event("can_exchange", {})
|
||||
if not event.dispatch(var, actor, nick):
|
||||
if not event.dispatch(var, user, target):
|
||||
return False # some roles such as succubus cannot be affected by exchange totem
|
||||
if nick in var.EXCHANGED:
|
||||
var.EXCHANGED.remove(nick)
|
||||
@ -4135,11 +4139,11 @@ def check_exchange(cli, actor, nick):
|
||||
elif nick_role == "turncoat":
|
||||
del var.TURNCOATS[nick]
|
||||
|
||||
evt = Event("exchange_roles", {"actor_messages": [], "nick_messages": []})
|
||||
evt.dispatch(cli, var, actor, nick, actor_role, nick_role)
|
||||
evt = Event("exchange_roles", {"actor_messages": [], "target_messages": []})
|
||||
evt.dispatch(var, user, target, actor_role, nick_role)
|
||||
|
||||
change_role(users._get(actor), actor_role, nick_role) # FIXME
|
||||
change_role(users._get(nick), nick_role, actor_role) # FIXME
|
||||
change_role(user, actor_role, nick_role)
|
||||
change_role(target, nick_role, actor_role)
|
||||
if actor in var.BITTEN_ROLES.keys():
|
||||
if nick in var.BITTEN_ROLES.keys():
|
||||
var.BITTEN_ROLES[actor], var.BITTEN_ROLES[nick] = var.BITTEN_ROLES[nick], var.BITTEN_ROLES[actor]
|
||||
@ -4174,13 +4178,10 @@ def check_exchange(cli, actor, nick):
|
||||
|
||||
# don't say who, since misdirection/luck totem may have switched it
|
||||
# and this makes life far more interesting
|
||||
pm(cli, actor, messages["role_swap"].format(nick_rev_role))
|
||||
pm(cli, nick, messages["role_swap"].format(actor_rev_role))
|
||||
|
||||
for msg in evt.data["actor_messages"]:
|
||||
pm(cli, actor, msg)
|
||||
for msg in evt.data["nick_messages"]:
|
||||
pm(cli, nick, msg)
|
||||
user.send(messages["role_swap"].format(nick_rev_role))
|
||||
target.send(messages["role_swap"].format(actor_rev_role))
|
||||
user.send(*evt.data["actor_messages"])
|
||||
target.send(*evt.data["target_messages"])
|
||||
|
||||
wcroles = var.WOLFCHAT_ROLES
|
||||
if var.RESTRICT_WOLFCHAT & var.RW_REM_NON_WOLVES:
|
||||
|
Loading…
x
Reference in New Issue
Block a user