banned/src/roles/mystic.py
Ryan Schmidt 69fa7d377f Split succubus (#284)
* Split + buff succubus

When all succubi die, all entranced people now die along with them. This
should prevent an entranced person from ratting out the succubus early
on so that they go back to their team, as they lose now even if succubus
dies. One exception is if EVERY succubus idles out, then everyone that
is entranced is freed of entrancement, as it isn't their fault that they
didn't protect their friends in that case.

Dullahans now have succubi entirely removed from their list as the
likelihood they get unentranced is low, and it's easier to implement
this way.

Ensure that entranced people can vote along with ANY succubus, even if
that vote isn't the one that succeeded. Before there were cases where
they could vote along with succubus but still end up dying (particularly
in respect to a vote passing when a succubus abstained).

Clear up some message wording with regards to succubi.

Cleaned up chk_win_conditions and eliminated chk_traitor, so they make
much more sense now.

Also fixed minor issues, such as end-game saying "same number" of wolves
even if there are more wolves than villagers, hunter/vigilante dying
during night sometimes not clearing variables correctly (thus causing
premature night end) and some various stupidity going on with some old
code I wrote that doesn't have any visible effects.

* Combine all players into the same succubus death message

* Fix stylistic issues and succubus idling not working
2017-01-27 14:08:41 -05:00

70 lines
3.7 KiB
Python

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):
special = set(list_players(("harlot", "priest", "prophet", "matchmaker",
"doctor", "hag", "sorcerer", "turncoat", "clone", "piper")))
evt2 = Event("get_special", {"special": special})
evt2.dispatch(cli, var)
pl = set(list_players())
wolves = set(list_players(var.WOLFTEAM_ROLES))
neutral = set(list_players(var.TRUE_NEUTRAL_ROLES))
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
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):
# init with all roles that haven't been split yet
special = set(list_players(("harlot", "priest", "prophet", "matchmaker",
"doctor", "hag", "sorcerer", "turncoat", "clone", "piper")))
evt2 = Event("get_special", {"special": special})
evt2.dispatch(cli, var)
pl = set(list_players())
wolves = set(list_players(var.WOLFTEAM_ROLES))
neutral = set(list_players(var.TRUE_NEUTRAL_ROLES))
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
# # 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: