copy/deepcopy didn't know what to do with user objects due to custom
__new__. Since __new__ returns an existing user if possible anyway, just
have copy/deepcopy return the same user instance that is being copied.
Was already mostly in wolf.py, but this takes it out and lays groundwork
for splitting out var.DISEASED_WOLVES and base events that the new
berserker wolf can use.
* Split Mad Scientist
Related changes:
- MS now honors all protections instead of only caring about blessed
villagers
- Allow FA to bypass protection even if FA is applied as a template
- Make bodyguard swap themselves in as the assassination target rather
than blocking the attempt outright and suiciding. This means that
active protections on the bodyguard have a chance to save them as well.
- Redo some messages to make the above sound nice in the bot.
- Add some additional params to the assassinate event to see WHY the
assassination is happening (source) and WHO is doing the assassination
(killer; currently a nick but should be a user sometime in the future).
- Add a target data item to teh assassinate event so that listeners can
change who is being assassinated. Protection boilerplate has been
adjusted to account for this.
- Add helper function to get the targets, avoiding code duplication
8-9p has only one safe, 2 wolves, and a dullahan. Usually this means
dulla controls the game and the winner is entirely determined by whether
or not both wolves are on the kill list. Aka it sucks.
Many of these aliases are words that begin sentences. Saying them in
wolfchat/deadchat then makes the bot pm random people with stuff. Let's
NOT do that, kthx. fact is also a word, so replacing that with fdo.
The dead player is already removed from var.ROLES by the time the event
fires. Also, tweak del_player event to make it much easier to support
arbitrary roles as not being the player's main role by changing nicktpls
to allroles (which is a set that includes mainrole). The assassinate
event is similarly tweaked.
They can't be shot during day, so they can't be shot at night either.
Add an event so that it can be easily handled once split (using the new
API, Vgr would be so proud of me).
If with_host() is called before we fully know our ident and host, we'll
set the host but keep ident as None, which breaks everything down the
line. I could've fixed this in general in users._add, but that would
require more extensive changes than this patch (aka may break other
things).
Instead of trying to guess what format a token is based on its content,
hardcode a list of known tokens and what formats their parameters take.
Any unknown token will therefore be kept as a string, instead of
potentially blowing up parsing due to unexpected values (such as
multiple colons).
Also fix parsing for colon-separated lists. MAXLIST=beI:100 is *VERY*
different from MAXLIST=b:100,e:100,I:100 but our previous processing
made the two identical in terms of what the structure looked like.
Templates are still applied on game start according to
var.TEMPLATE_RESTRICTIONS, but now any arbitrary role can be applied as
a template during gameplay without breaking things horribly.
Speaking of breaking things horribly, things are probably broken
horribly due to this. It was lightly tested, but there's a lot of
fundamental stuff that changed.
mm = matchmaker, ms = mad scientist, vg = vengeful ghost
Additionally, allow all special keys to be queried via pstats in an
extensible manner (used for vg activated and vg driven off)
Also allow prefixing commands by their role name to remove ambiguity
should a person be multiple roles. For example, "seer see foo" and
"augur see foo" will now work if a person is both seer and augur
(whereas normal see foo would be ambiguous). A player will be directed
to use the unambiguous prefixed version if we detect that a role command
will fire multiple times for them (note: coming soon).
For sanity reasons, these role prefixes are implemented as exclusive
commands, meaning no other commands or command aliases may use the same
name. Clone needs to be special-cased in this regard, as clone is both a
role name and a command name.