Fix exchange totem not firing

This commit is contained in:
skizzerz 2016-08-17 17:06:27 -05:00
parent ebb3bdccfb
commit af2fef5ea9
3 changed files with 28 additions and 24 deletions

View File

@ -10,12 +10,12 @@ from src.events import Event
@event_listener("exchange_roles")
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
evt = Event("get_special", {"special": set()})
evt.dispatch(cli, var)
evt2 = Event("get_special", {"special": set()})
evt2.dispatch(cli, var)
pl = set(list_players())
wolves = set(list_players(var.WOLFTEAM_ROLES))
neutral = set(list_players(var.TRUE_NEUTRAL_ROLES))
special = evt.data["special"]
special = evt2.data["special"]
if nick_role == "wolf mystic" and actor_role != "wolf mystic":
# # of special villagers = # of players - # of villagers - # of wolves - # of neutrals
@ -35,12 +35,12 @@ def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
@event_listener("transition_night_end", priority=2.01)
def on_transition_night_end(evt, cli, var):
evt = Event("get_special", {"special": set()})
evt.dispatch(cli, var)
evt2 = Event("get_special", {"special": set()})
evt2.dispatch(cli, var)
pl = set(list_players())
wolves = set(list_players(var.WOLFTEAM_ROLES))
neutral = set(list_players(var.TRUE_NEUTRAL_ROLES))
special = evt.data["special"]
special = evt2.data["special"]
for wolf in var.ROLES["wolf mystic"]:
# if adding this info to !myrole, you will need to save off this count so that they can't get updated info until the next night

View File

@ -223,6 +223,8 @@ def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
notify = []
for i, player in enumerate(pl):
prole = get_role(player)
if player == nick:
prole = actor_role
if prole in wcroles:
cursed = ""
if player in var.ROLES["cursed villager"]:
@ -232,14 +234,14 @@ def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
elif player in var.ROLES["cursed villager"]:
pl[i] = player + " (cursed)"
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:
evt.data["actor_messages"].append(messages["ill_wolves"])
if not var.DISEASED_WOLVES and var.ANGRY_WOLVES and nick_role in CAN_KILL:
evt.data["actor_messages"].append(messages["angry_wolves"])
if var.ALPHA_ENABLED and nick_role == "alpha wolf" and actor not in var.ALPHA_WOLVES:
evt.data["actor_messages"].append(messages["wolf_bite"])
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:
evt.data["actor_messages"].append(messages["ill_wolves"])
if not var.DISEASED_WOLVES and var.ANGRY_WOLVES and nick_role in CAN_KILL:
evt.data["actor_messages"].append(messages["angry_wolves"])
if var.ALPHA_ENABLED and nick_role == "alpha wolf" and actor 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()
random.shuffle(pl)
@ -247,6 +249,8 @@ def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
notify = []
for i, player in enumerate(pl):
prole = get_role(player)
if player == actor:
prole = nick_role
if prole in wcroles:
cursed = ""
if player in var.ROLES["cursed villager"]:
@ -256,14 +260,14 @@ def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
elif player in var.ROLES["cursed villager"]:
pl[i] = player + " (cursed)"
mass_privmsg(cli, notify, messages["players_exchanged_roles"].format(actor, nick))
evt.data["nick_messages"].append("Players: " + ", ".join(pl))
if actor_role in CAN_KILL and var.DISEASED_WOLVES:
evt.data["nick_messages"].append(messages["ill_wolves"])
if not var.DISEASED_WOLVES and var.ANGRY_WOLVES and actor_role in CAN_KILL:
evt.data["nick_messages"].append(messages["angry_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"])
mass_privmsg(cli, notify, messages["players_exchanged_roles"].format(actor, nick))
evt.data["nick_messages"].append("Players: " + ", ".join(pl))
if actor_role in CAN_KILL and var.DISEASED_WOLVES:
evt.data["nick_messages"].append(messages["ill_wolves"])
if not var.DISEASED_WOLVES and var.ANGRY_WOLVES and actor_role in CAN_KILL:
evt.data["nick_messages"].append(messages["angry_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"])
if actor in KILLS:
del KILLS[actor]

View File

@ -5921,8 +5921,8 @@ def charm(cli, nick, chan, rest):
chk_nightdone(cli)
@event_listener("targeted_cmd", priority=9)
def on_targeted_cmd(evt, cli, var, cmd, actor, orig_target, tags):
@event_listener("targeted_command", priority=9)
def on_targeted_command(evt, cli, var, cmd, actor, orig_target, tags):
# TODO: move beneficial command check into roles/succubus.py
if "beneficial" not in tags and is_safe(actor, evt.data["target"]):
pm(cli, actor, messages["no_acting_on_succubus"].format(cmd))