Split mystic/wolf mystic
This commit is contained in:
parent
32dc611acf
commit
ebb3bdccfb
@ -64,6 +64,10 @@ def on_rename(evt, cli, var, prefix, nick):
|
||||
def on_del_player(evt, cli, var, nick, nickrole, nicktpls, death_triggers):
|
||||
INVESTIGATED.discard(nick)
|
||||
|
||||
@event_listener("get_special")
|
||||
def on_get_special(evt, cli, var):
|
||||
evt.data["special"].update(list_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":
|
||||
|
@ -137,6 +137,10 @@ def on_acted(evt, cli, var, nick, sender):
|
||||
if nick in KILLS:
|
||||
evt.data["acted"] = True
|
||||
|
||||
@event_listener("get_special")
|
||||
def on_get_special(evt, cli, var):
|
||||
evt.data["special"].update(list_players(("dullahan",)))
|
||||
|
||||
@event_listener("transition_day", priority=2)
|
||||
def on_transition_day(evt, cli, var):
|
||||
for k, d in list(KILLS.items()):
|
||||
|
@ -105,6 +105,10 @@ def on_acted(evt, cli, var, nick, sender):
|
||||
if nick in KILLS:
|
||||
evt.data["acted"] = True
|
||||
|
||||
@event_listener("get_special")
|
||||
def on_get_special(evt, cli, var):
|
||||
evt.data["special"].update(list_players(("hunter",)))
|
||||
|
||||
@event_listener("transition_day", priority=2)
|
||||
def on_transition_day(evt, cli, var):
|
||||
for k, d in list(KILLS.items()):
|
||||
|
64
src/roles/mystic.py
Normal file
64
src/roles/mystic.py
Normal file
@ -0,0 +1,64 @@
|
||||
import re
|
||||
import random
|
||||
|
||||
import src.settings as var
|
||||
from src.utilities import *
|
||||
from src import debuglog, errlog, plog
|
||||
from src.decorators import cmd, event_listener
|
||||
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):
|
||||
evt = Event("get_special", {"special": set()})
|
||||
evt.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"]
|
||||
|
||||
if nick_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":
|
||||
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":
|
||||
# # 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":
|
||||
numevil = len(wolves)
|
||||
evt.data["nick_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, cli, var):
|
||||
evt = Event("get_special", {"special": set()})
|
||||
evt.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"]
|
||||
|
||||
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
|
||||
# # of special villagers = # of players - # of villagers - # of wolves - # of neutrals
|
||||
numvills = len(special & (pl - wolves - neutral))
|
||||
pm(cli, wolf, messages["wolf_mystic_info"].format("are" if numvills != 1 else "is", numvills, "s" if numvills != 1 else ""))
|
||||
for mystic in var.ROLES["mystic"]:
|
||||
if mystic in var.PLAYERS and not is_user_simple(mystic):
|
||||
pm(cli, mystic, messages["mystic_notify"])
|
||||
else:
|
||||
pm(cli, mystic, messages["mystic_simple"])
|
||||
# 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
|
||||
numevil = len(wolves)
|
||||
pm(cli, mystic, messages["mystic_info"].format("are" if numevil != 1 else "is", numevil, "s" if numevil != 1 else ""))
|
||||
|
||||
@event_listener("get_special")
|
||||
def on_get_special(evt, cli, var):
|
||||
# mystics count as special even though they don't have any commands
|
||||
evt.data["special"].update(list_players(("mystic",)))
|
||||
|
||||
# vim: set sw=4 expandtab:
|
@ -96,6 +96,10 @@ def on_acted(evt, cli, var, nick, sender):
|
||||
if nick in SEEN:
|
||||
evt.data["acted"] = True
|
||||
|
||||
@event_listener("get_special")
|
||||
def on_get_special(evt, cli, var):
|
||||
evt.data["special"].update(list_players(("seer", "oracle", "augur")))
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
if actor_role in ("seer", "oracle", "augur"):
|
||||
|
@ -92,6 +92,10 @@ def on_acted(evt, cli, var, nick, sender):
|
||||
if nick in KILLS:
|
||||
evt.data["acted"] = True
|
||||
|
||||
@event_listener("get_special")
|
||||
def on_get_special(evt, cli, var):
|
||||
evt.data["special"].update(list_players(("vigilante",)))
|
||||
|
||||
@event_listener("transition_day", priority=2)
|
||||
def on_transition_day(evt, cli, var):
|
||||
for k, d in list(KILLS.items()):
|
||||
|
@ -131,6 +131,10 @@ def on_acted(evt, cli, var, nick, sender):
|
||||
if nick in KILLS:
|
||||
evt.data["acted"] = True
|
||||
|
||||
@event_listener("get_special")
|
||||
def on_get_special(evt, cli, var):
|
||||
evt.data["special"].update(list_players(CAN_KILL))
|
||||
|
||||
@event_listener("transition_day", priority=1)
|
||||
def on_transition_day(evt, cli, var):
|
||||
# figure out wolf target
|
||||
@ -203,8 +207,64 @@ def on_retribution_kill(evt, cli, var, victim, orig_target):
|
||||
wolves.remove(crow)
|
||||
evt.data["target"] = random.choice(wolves)
|
||||
|
||||
@event_listener("exchange_roles")
|
||||
@event_listener("exchange_roles", priority=2)
|
||||
def on_exchange(evt, cli, var, actor, nick, actor_role, nick_role):
|
||||
wcroles = var.WOLFCHAT_ROLES
|
||||
if var.RESTRICT_WOLFCHAT & var.RW_REM_NON_WOLVES:
|
||||
if var.RESTRICT_WOLFCHAT & var.RW_TRAITOR_NON_WOLF:
|
||||
wcroles = var.WOLF_ROLES
|
||||
else:
|
||||
wcroles = var.WOLF_ROLES | {"traitor"}
|
||||
|
||||
if nick_role in wcroles and actor_role not in wcroles:
|
||||
pl = list_players()
|
||||
random.shuffle(pl)
|
||||
pl.remove(actor) # remove self from list
|
||||
notify = []
|
||||
for i, player in enumerate(pl):
|
||||
prole = get_role(player)
|
||||
if prole in wcroles:
|
||||
cursed = ""
|
||||
if player in var.ROLES["cursed villager"]:
|
||||
cursed = "cursed "
|
||||
pl[i] = "\u0002{0}\u0002 ({1}{2})".format(player, cursed, prole)
|
||||
notify.append(player)
|
||||
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"])
|
||||
elif actor_role in wcroles and nick_role not in wcroles:
|
||||
pl = list_players()
|
||||
random.shuffle(pl)
|
||||
pl.remove(nick) # remove self from list
|
||||
notify = []
|
||||
for i, player in enumerate(pl):
|
||||
prole = get_role(player)
|
||||
if prole in wcroles:
|
||||
cursed = ""
|
||||
if player in var.ROLES["cursed villager"]:
|
||||
cursed = "cursed "
|
||||
pl[i] = "\u0002{0}\u0002 ({1}{2})".format(player, cursed, prole)
|
||||
notify.append(player)
|
||||
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"])
|
||||
|
||||
if actor in KILLS:
|
||||
del KILLS[actor]
|
||||
if nick in KILLS:
|
||||
@ -314,12 +374,7 @@ def on_transition_night_end(evt, cli, var):
|
||||
pm(cli, wolf, "Players: " + ", ".join(pl))
|
||||
if role in CAN_KILL and var.DISEASED_WOLVES:
|
||||
pm(cli, wolf, messages["ill_wolves"])
|
||||
# TODO: split the following out into their own files (mystic, cub and alpha)
|
||||
if role == "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
|
||||
# # of special villagers = # of players - # of villagers - # of wolves - # of neutrals
|
||||
numvills = len(ps) - len(list_players(var.WOLFTEAM_ROLES)) - len(list_players(("villager", "vengeful ghost", "time lord", "amnesiac", "lycan"))) - len(list_players(var.TRUE_NEUTRAL_ROLES))
|
||||
pm(cli, wolf, messages["wolf_mystic_info"].format("are" if numvills != 1 else "is", numvills, "s" if numvills != 1 else ""))
|
||||
# TODO: split the following out into their own files (cub and alpha)
|
||||
if not var.DISEASED_WOLVES and var.ANGRY_WOLVES and role in CAN_KILL:
|
||||
pm(cli, wolf, messages["angry_wolves"])
|
||||
if var.ALPHA_ENABLED and role == "alpha wolf" and wolf not in var.ALPHA_WOLVES:
|
||||
|
@ -4961,36 +4961,7 @@ def check_exchange(cli, actor, nick):
|
||||
if nick_role == "shaman":
|
||||
pm(cli, actor, messages["shaman_totem"].format(nick_totem))
|
||||
var.TOTEMS[actor] = nick_totem
|
||||
elif nick_role == "mystic":
|
||||
numevil = len(list_players(var.WOLFTEAM_ROLES))
|
||||
pm(cli, actor, messages["mystic_info"].format("are" if numevil != 1 else "is", numevil, "s" if numevil != 1 else ""))
|
||||
elif nick_role in wcroles and actor_role not in wcroles:
|
||||
pl = list_players()
|
||||
random.shuffle(pl)
|
||||
pl.remove(actor) # remove self from list
|
||||
for i, player in enumerate(pl):
|
||||
prole = get_role(player)
|
||||
if prole in wcroles:
|
||||
cursed = ""
|
||||
if player in var.ROLES["cursed villager"]:
|
||||
cursed = "cursed "
|
||||
pl[i] = "\u0002{0}\u0002 ({1}{2})".format(player, cursed, prole)
|
||||
pm(cli, player, messages["players_exchanged_roles"].format(nick, actor))
|
||||
elif player in var.ROLES["cursed villager"]:
|
||||
pl[i] = player + " (cursed)"
|
||||
|
||||
pm(cli, actor, "Players: " + ", ".join(pl))
|
||||
if actor_role == "wolf mystic":
|
||||
# # of special villagers = # of players - # of villagers - # of wolves - # of neutrals
|
||||
numvills = len(ps) - len(list_players(var.WOLFTEAM_ROLES)) - len(list_players(("villager", "vengeful ghost", "time lord", "amnesiac", "lycan"))) - len(list_players(var.TRUE_NEUTRAL_ROLES))
|
||||
pm(cli, actor, messages["wolf_mystic_info"].format("are" if numvills != 1 else "is", numvills, "s" if numvills != 1 else ""))
|
||||
if actor_role in var.WOLF_ROLES - {"wolf cub"} and var.DISEASED_WOLVES:
|
||||
pm(cli, actor, messages["ill_wolves"])
|
||||
if not var.DISEASED_WOLVES and var.ANGRY_WOLVES and actor_role in var.WOLF_ROLES - {"wolf cub"}:
|
||||
pm(cli, actor, messages["angry_wolves"])
|
||||
if var.ALPHA_ENABLED and actor_role == "alpha wolf" and actor not in var.ALPHA_WOLVES:
|
||||
pm(cli, actor, messages["wolf_bite"])
|
||||
elif nick_role == "warlock":
|
||||
elif nick_role not in wcroles and nick_role == "warlock":
|
||||
# this means warlock isn't in wolfchat, so only give cursed list
|
||||
pl = list_players()
|
||||
random.shuffle(pl)
|
||||
@ -5012,36 +4983,7 @@ def check_exchange(cli, actor, nick):
|
||||
if actor_role == "shaman":
|
||||
pm(cli, nick, messages["shaman_totem"].format(actor_totem))
|
||||
var.TOTEMS[nick] = actor_totem
|
||||
elif actor_role == "mystic":
|
||||
numevil = len(list_players(var.WOLFTEAM_ROLES))
|
||||
pm(cli, nick, messages["mystic_info"].format("are" if numevil != 1 else "is", numevil, "s" if numevil != 1 else ""))
|
||||
elif actor_role in wcroles and nick_role not in wcroles:
|
||||
pl = list_players()
|
||||
random.shuffle(pl)
|
||||
pl.remove(actor) # remove self from list
|
||||
for i, player in enumerate(pl):
|
||||
prole = get_role(player)
|
||||
if prole in wcroles:
|
||||
cursed = ""
|
||||
if player in var.ROLES["cursed villager"]:
|
||||
cursed = "cursed "
|
||||
pl[i] = "\u0002{0}\u0002 ({1}{2})".format(player, cursed, prole)
|
||||
pm(cli, player, messages["players_exchanged_roles"].format(actor, nick))
|
||||
elif player in var.ROLES["cursed villager"]:
|
||||
pl[i] = player + " (cursed)"
|
||||
|
||||
pm(cli, nick, "Players: " + ", ".join(pl))
|
||||
if nick_role == "wolf mystic":
|
||||
# # of special villagers = # of players - # of villagers - # of wolves - # of neutrals
|
||||
numvills = len(ps) - len(list_players(var.WOLFTEAM_ROLES)) - len(list_players(("villager", "vengeful ghost", "time lord", "amnesiac", "lycan"))) - len(list_players(var.TRUE_NEUTRAL_ROLES))
|
||||
pm(cli, nick, messages["wolf_mystic_info"].format("are" if numvills != 1 else "is", numvills, "s" if numvills != 1 else ""))
|
||||
if nick_role in var.WOLF_ROLES - {"wolf cub"} and var.DISEASED_WOLVES:
|
||||
pm(cli, nick, messages["ill_wolves"])
|
||||
if not var.DISEASED_WOLVES and var.ANGRY_WOLVES and nick_role in var.WOLF_ROLES - {"wolf cub"}:
|
||||
pm(cli, nick, messages["angry_wolves"])
|
||||
if var.ALPHA_ENABLED and nick_role == "alpha wolf" and nick not in var.ALPHA_WOLVES:
|
||||
pm(cli, nick, messages["wolf_bite"])
|
||||
elif actor_role == "warlock":
|
||||
elif actor_role not in wcroles and actor_role == "warlock":
|
||||
# this means warlock isn't in wolfchat, so only give cursed list
|
||||
pl = list_players()
|
||||
random.shuffle(pl)
|
||||
@ -6319,15 +6261,6 @@ def transition_night(cli):
|
||||
else:
|
||||
pm(cli, drunk, messages["drunk_simple"])
|
||||
|
||||
for mystic in var.ROLES["mystic"]:
|
||||
if mystic in var.PLAYERS and not is_user_simple(mystic):
|
||||
pm(cli, mystic, messages["mystic_notify"])
|
||||
else:
|
||||
pm(cli, mystic, messages["mystic_simple"])
|
||||
# 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
|
||||
numevil = len(list_players(var.WOLFTEAM_ROLES))
|
||||
pm(cli, mystic, messages["mystic_info"].format("are" if numevil != 1 else "is", numevil, "s" if numevil != 1 else ""))
|
||||
|
||||
max_totems = defaultdict(int)
|
||||
for ix in range(len(var.TOTEM_ORDER)):
|
||||
for c in var.TOTEM_CHANCES.values():
|
||||
|
Loading…
x
Reference in New Issue
Block a user