- var.SHAMANS now properly stores who is actually receiving totem, as it
should. It now holds a tuple so it can still track the original target
for purposes of letting shaman know if target changed.
- properly reset all totem vars before handing them out so totems don't
last for multiple days.
- luck/misdirection now applies before exchange totem is checked, making
it consistent with every other role ever.
completely untested, but should be fine :)
A game mode is considered "hidden" if it doesn't have a `ROLE_GUIDE`
attribute. The `default` game mode was modified to have those
attributes, and is not hidden.
This change negatively impacts balance, assassin should in general never
be applied to any role the other team is required to kill in order to
win. Alpha wolf is the exception here, not the rule, since there is
counterplay involved with alpha biting GA (GA is likely immunized, can
guard self, game might end before turning, etc.) that simply does not
exist in other instances.
This reverts commit 3eb437fad6.
Not just from getting bitten by alpha wolf, but also from turning from
amnesiac, and also if in the default role rotation (this one currently
doesn't affect any game modes, but in the future it might).
This allows for things like making ADMINS/OWNERS take a full hostmask,
or fallowing/fdenying a full hostmask with wildcards. It also allows for
a distinction between two people that share a hostmask but have a
different ident.
stasis now checks all matching stasis and returns the highest amount
fallow/fdeny have two new options -acc and -host to explicitly specify
what type the argument is
-cmds in fallow/fdeny show commands from all matching masks, to bring it
in line with how actual allow/deny parsing works, before it would only
show the first match
All exceptions, if not caught, are unconditionally sent to `sys.stderr`.
We only need to use our own custom class with some modifications and we
can intercept all errors, even those in threads (which #151 was about).
The only real downside from this practice is that `cli` is not
accessible to us when the errors happen, so I used a hack to set it on
an instance variable. If anyone can find a better solution, please step
forward. For the time being, this will have to do.
If for some obscure reason this class breaks, `sys.__stderr__` holds the
original `sys.stderr`
This allows people to swap out an existing player from the game, and
join instead. Useful if, say, your home connection dropped, but your ZNC
is still online and you want to keep playing through your phone for
example. The player swapping and the one being swapped must be
identified to the same account for this to work. After the command has
been used, an implicit !myrole is performed, informing the player of
their role and templates. The on_nick handler has been decoupled into
two functions, where most of the logic is now in rename_player (which
swap uses).
Known issues: Hard drive space is left untouched.
Now `!roles` while in a game will have the same effect as `!roles n`
where n is the number of players that joined. Also got rid of string
concatenation.
Concatenating strings repeatedly slows down the program and eats up
memory. It's not too bad for the number of players we have, but if you
get 10k players that makes a significant difference
Now restricted to adding/removing 900 seconds (15 minutes). There are no
valid reasons I can think of or that were given in -dev that would
require more time than this. 15 minutes is still likely too much and
from previous experience such long forced waits generally trigger a mass
exodus of players who would rather play a game than doing absolutely
nothing.
Apparently having multiple hooks on the same thing is just horribly
broken, even though we do it in other places. This only fixes the issue
on connecting as that one is the most severe, but the other cases will
need to be fixed as well (or the underlying issue preventing it from
working needs to be fixed).
- Now possible to use the bot without it having a registered account by
blanking NICKSERV_IDENTIFY_COMMAND
- Now possible to configure who ChanServ is as well as the command it
uses to op up in channel (blank to prevent it from auto-opping).
Example configuration provided for undernet
- Properly autojoin channels even if there isn't an MOTD
Alpha now can choose to either bite or kill, but not both. If other
wolves are alive, they can still kill as normal allowing both to happen
that night. Additional interactions were added to deal with visiting
harlots and to not accidentally kill bodyguards/GAs in the event that
they are bitten and would die from wolves (if
BODYGUARD/GUARDIAN_ANGEL_DIES_AT_NIGHT_CHANCE is set).
Things to consider for the future but didn't have time to do yet:
- Should we play a message in channel if alpha wolf successfully bites
someone at night?
- Avoid killing a bodyguard/GA if Fallen Angel is in play and said
bodyguard/GA was bitten that night.
- Should wolves avoid automatically killing people bitten on previous
nights (e.g. a bitten harlot wouldn't get nommed visiting wolves or
victims, bitten bodyguards/GAs wouldn't die from fallen angel, etc.)?
This way it's immediately obvious if it was a legit command or not. The
result of werecrow's observation is not announced, because it's possible
for the crow to be killed at night and this would take away that
strategy. For sorcerer, it does not even bother announcing the fact that
they observed, since they can tell the result immediately if they are
alive, so the message is pretty much redundant.
Also, minor fixes:
* Log kill by angry wolves properly, instead of the non-obvious hack
that @Vgr255 used.
* Add missing quotes in angry wolves wolfchat message.
Right now the only thing that still tracks accounts if DISABLE_ACCOUNTS
is True is stats stuff (in sqlite), as I'm unsure of how we want to
handle that for when accounts aren't enabled; likely track by nick but
unsure on that right now.
This further implements issue #112 but doesn't fix it entirely yet.
Decoupled ROLE_REVEAL from impacting !stats, added new STATS_TYPE.
ROLE_REVEAL is now a string:
- on = roles revealed on death
- off = roles not revealed on death
- team = user's team revealed on death but not their role
STATS_TYPE is also a string:
- default = stats are calculated as if a villager or nonplayer was
manually tracking who was what; this leads to !stats not revealing
any information that is not publicly known
- accurate = what it used to be with a couple modifications; all roles
are shown (VG and time lord are no longer lumped with villager),
alpha wolf and lycans turning are hidden, nothing else is hidden
(so you can see what amnesiac turned into or when clone turns)
- team = only shows number of people on each team, calculated the same
way as accurate
- disabled = stats are disabled, doing !stats only serves as a mass-ping
of alive players
Removed random_reveal/random_noreveal hack
- !fgame random=role reveal:on|off does the same thing as the hack used
to do.
Allow all game modes to take arguments (aka the blah in roles=blah).
- Allowed arguments are "role reveal" (on/off/team), "stats type"
(default/accurate/team/disabled), and "abstain"
(enabled/restricted/disabled).
- roles obviously still allows for taking individual roles as arguments
as well as specifying a default role, however this functionality is
not available for any other gamemode.
- if any custom options are set as a result of this or changing them in
game mode constructors, players will be informed of which options are
in play.
Performing !frole will force STATS_TYPE from default to accurate, this
is done because the default logic is based not on what roles are
currently in existence, but rather what roles the game was started with
and what transformations could have applied to them. !frole throws a
complete monkey wrench in that to the point where it is impossible to
nicely recover.
Clone and Traitor are now unconditionally blacklisted for amnesiac, as
the additional logic to support them in default !stats is incredibly
complex and as such was not done for this PR.
Matchmaker is conditionally blacklisted for amnesiac if amnesiacs turn
after the first night. It is an allowed choice (unless it appears on the
config blacklist) if amnesiacs turn night 1.
Turncoats initially start off village-aligned, but can change which team
they're on by using the !side command. Turncoats cannot change sides two
nights in a row, and can use !pass if they don't wish to change sides on
any given night.
Seers and detectives see turncoats as turncoats, augurs see them as
having a grey aura. I was initially toying with det and augur seeing
them as their currently-chosen side and for mystics of the opposite team
to detect them, but since they can flip-flop an unlimited number of
times a night that info would be useless at best and misleading at
worst.
These commands are completely useless, they just confuse people. I just
had someone ask me whether it would bring them back to the game, with
their role and everything. If an op wants to talk in the middle of the
game, there are other ways to do that. This isn't even being used
anymore.
Roles are revealed upon death, but not shown in !stats.
This will be used for the random game mode with a 50% chance.
The variant used is displayed when the game is started, and
admins can force a specific variant with !fgame.
Also, ignore conceal_roles in !stats, because partial role reveal
handles that now.
It will now return as soon as it finds the role for the player,
instead of calling var.list_players_and_roles every single time.
I haven't tested in a real-world scenario, but in a test game
with 10000 players (don't ask), the speed improvement is very clear
(~1-2s per player when sending out nighttime PMs instead of ~10s).
!fsend is a very dangerous command if abused (up there with exec), and
should be properly admin-only instead of allowed to be given out to
non-admins. Unlike fsay/fact, there is no easy way to restrict fsend
when a non-admin uses it.
_collections is the C implementation (and where defaultdict lies), and
is as such already loaded when the interpreter is launched. collections
imports a bunch of other useless stuff we're not interested in.
- You can now use "-cmds" to group by command rather than user. This is
useful to, say, check who is allowed to use !revealroles.
- The output is now sorted alphabetically, which should make visual
navigation much easier.
- The command character is no longer prefixed to the commands, as I feel
like it's just a waste of space.
- Long messages are now broken properly, using var.break_long_message().
After a discussion in ##werewolf-dev, we've decided that if a majority
of the players wants a game mode, there's no reason not to allow it.
If a game mode is broken, it can be commented out in the code.
It's been found that larger game sizes heavily favors the village, this
reduces the village power significantly by removing obvious "claim"
roles and shifting more powerful roles later into the rotation where
they are less effective. This may be too much of a shift but that is
currently unknown.
- Shaman removed entirely
- Hunter now at 10p (from 15)
- GA now at 12p (from 10)
- Detective now at 15p (from 12)
This commit adds 3 new roles and changes the semantics of
kills/protections to work more like the impatience and pacifism totems.
- Add mystic and wolf mystic roles which can divine the number of
players still alive on the opposing team each night. These roles are
meant for games where role reveal is off as !stats gives the same info
otherwise.
- Add fallen angel which is a corrupted version of the guardian angel,
created when a guardian angel is bitten by alpha wolf. This role is
incredibly potent as they bypass all forms of protection on their
target. GAs corrupted this way also automatically gain the assassin
template.
- Protections/kills now stack and cancel each other out. As such, 2
kills but only 1 protection will result in the kill still happening.
- Fix help text for active alpha wolf to show the reworked bite command.
- If alpha bites someone who is going to die via other means that night,
refund the bite.
- If the bite was unsuccessful due to whatever reason and was refunded,
give a different message to alpha wolf to let them know that.
- Make adding more wolf roles in the future easier to do by replacing
some hardcoded lists with var.WOLF_ROLES.
Modify game over messages to read better
Modify win conds to remove unneeded ones and to also add in some "nobody
wins" conds that happen due to MAD or stalemates.
- Piper can now only win during daytime (this includes transition_day as
well as chk_decision)
- There is now at most 1 piper in charming regardless of player count,
more than 1 is simply overpowered and impossible to balance
- Replaced all \XX, \XXX and \xXX syntax by \uXXXX syntax
- Replaced all single-quotes messages by double-quotes ones where it
makes sense
- Replace all {} in string literals by {0} syntax (explicit over
implicit)
- Use x.startswith(("a", "e", "i", "o", "u")) instead of x[0] in ("a",
"e", "i", "o", "u")
- Remove list comprehensions where a simple generator would work
(reduces memory consumption where we can)
This fixes the bug where bot would crash on endgame through faftergame
without sending all messages, but introduces a new bug where someone can
quit between endgame and the bot's own quit, crashing it. This is an
extremely tight race condition, and shouldn't matter most of the time.
Further explanation in the big wall of text.
This adds the new piper role, whose goal is to charm all the other
players to win. The charmed players are told who else is charmed, every
night, and must find out the piper and lynch him to win. The piper is a
win stealer, and takes precedence over monster. They can select either
one or two targets, but unless there is exactly one person left to be
charmed, they must pick two targets.
Adds "warlock" role, which is wolf-aligned and in wolfchat. They cannot
kill, but they get to turn someone into a cursed villager each night
(the curse remains in place for the rest of the game). If they act
quickly enough, they can even impact the seer or oracle for the current
night!
Added werekitten role, which is seen villager by seer and is always
missed when shot (even by sharpshooter!). They can still nom tasty
villagers at night, including pesky visiting harlots.
Also fix minor bug with alpha wolf being roleswapped where night may end
prematurely due to not removing their kill selection.
If someone sets it to something other than a function (well, callable
object) or None, it's a programming mistake and we want that to raise an
exception rather than be silently ignored.
This makes up for removing the wait effect of !ping.
Default settings are one !wait every 240 seconds, initially two !wait
tokens, maximum (burst) of three tokens.
Villagers win if the wolves die, wolves win if all villagers are dead
(removes the stupid way of wolves winning for cultists to elect
themselves to be voted).
Also swap shaman and hunter so villagers always have a means of getting
a kill no matter the game size.
Lycans and people with lycanthropy totem now properly show up as wolves
if they turned during the game by removing special-case tracking for
them (var.LYCANS) and opting for the generic role-change tracking
(var.FINAL_ROLES) instead. Also, make it so that wolves don't "turn
into" wolves if they are afflicted with lycanthropy and then
subsequently targeted by wolves (which can happen with luck/misdirection
totem).
I'd prefer not using the same hook ID for anything, but it's convenient
to be able to unhook multiple related things at once, so we'll just
change the hook IDs again if it's ever needed. Nothing should be
hardcoding them anyway, so changing them shouldn't cause issues.