If, during effect activation, a Pokemon isn't where it's supposed to
be, we search the rest of the player's team for it.
For instance, when Destiny Bond activates, Deoxys has already fainted,
so it's not where we expect it to be. Normally, we search the player's
team for Deoxys, find the Deoxys, and Destiny Bond activates as normal.
The problem comes in formats without Species Clause. We might find the
wrong Deoxys! Normally, this isn't a big problem. For a Pokemon to
match, it has to have the exact same name, so the message displayed is
still "Deoxys took the foe's Blaziken down with it!" and everything
goes on normally.
The problem comes in Doubles formats without Species Clause. Finding
the wrong Deoxys overwrites its slot number, which, if it's an active
Deoxys, puts it in an inconsistent state, causing crashes later on.
This fix changes it so if a Pokemon isn't where it's supposed to be,
we search the rest of the player's team, excluding other active
Pokemon, for it.
This renames the previous isInactive flag in getPokemon to isSwitch,
which more accurately describes how its matching works.
For the most part, this isn't really a big deal: If you send a message,
you usually have the window open, so you can see that you've sent a
message.
This is mainly for things like if you send a message and switch rooms
before it appears in the roomlog, but it's really mainly for things
like /hotpatch where you don't need to be notified about all the
rooms that notify you.
Previously, you could search by the first or last word in a three-word
phrase, but not the middle so "High" and "Kick" but not "Jump" in
"High Jump Kick". This lets you search by all three.
The new /log syntax is analogous to /me and /announce
Doing it this way makes it easier to support by bots, and also makes
it not highlight the initiator but still highlight others which is
usually desired.
Closes#760
We already limit message length in various ways, but this helps save
some bandwidth by doing a basic check before anything is sent.
The limit is very high (80 KB) mostly so certain long commands like
/eval can go through.