

The Showdown protocol.

Changes from old protocol:

- "ally" renamed "p1", "foe" renamed "p2"
- Dashes in commands are no longer used, and abbreviations are used more liberally. It's still human-readable _enough_, and saves a tiny bit of bandwidth.
- "r-" and "residual " were merged into "-"

The main thing is that stuff that previously like:

	stealth-rock-damage foe-Excadrill 3.125
	residual foe-Rotom-W item-heal Leftovers
	r-volatile ally-Seviper leech-seed

will look something like:

	-damage p2-Excadrill 3.125 e:StealthRock
	-heal p2-Rotom-W 6.25 i:Leftovers
	-start p1-Seviper e:LeechSeed


Out-of-game
------------------------------------------------------------------------

p1 [user full]
p2 [user full]
	Initialize a Side associated with [user], in the corresponding slot.

	If [side full] is empty, remove the Side in that slot.

p3 [user full]
p4 [user full]
	The same as p1 and p2. Can be ignored by clients that don't support 3-player and 4-player.

	In 2v2, alliances are p1 and p3 against p2 and p4.

chat [user] [message full]
	The log records that [user] says [message full].

join [user]
	The log records that [user] joins the room.

leave [user]
	The log records that [user] leaves the room.

message [message full]
	[message full] is broadcast in the log.

rawmessage [rawmessage full]
	[rawmessage full] is broadcast as raw HTML in the log.

Initialization
------------------------------------------------------------------------

poke [pokemon]
	Initialize a pokemon with the given ID, if it exists.

previewpoke [pokemon]
	Initialize a pokemon for the purposes of Team Preview.

	Two differences from `poke`: Will initialize a new pokemon even if a pokemon with that ID already exists, and the initialized pokemon will have an unknown name.

preview
	Start Team Preview.

endpreview
	End Team Preview.


Gameplay (major)
------------------------------------------------------------------------

switch [pokemon]
	Switch in [pokemon].

drag [pokemon]
	Drag in [pokemon].

replace [pokemon]
	[pokemon] replaces what was in its slot previously. Generally used for Illusion reveals.

move [pokemon] [move] [pokemon2] [attr]
	Make [pokemon] use [move] against [pokemon2].
	[attr] describes how to handle the move animation:
		"miss" - the move missed
		"notarget" - the move's target fainted before the start of the move, and no other suitable target was found
		"fail" - the move hit, but failed for some reason
		anything else - the move connected normally

faint [pokemon]
	[pokemon] faints.


Health
------------------------------------------------------------------------

-damage [pokemon] [damage] [source]
	[pokemon] receives [damage] damage.

-heal [pokemon] [damage] [source]
	[pokemon] is healed by [damage] damage.

Effects
------------------------------------------------------------------------

-start [pokemon] [effect] [source]
	The effect [effect] starts on [pokemon].

	Clients that track effects should keep in mind that some effects may end without a message.

-turnstart [pokemon] [effect] [source]
	The 1-turn volatile effect [effect] starts on [pokemon]. No corresponding "-end" message will be given, but the effect will expire at the end of the turn.

-end [pokemon] [effect] [source]
	The effect [effect] ends on [pokemon].

	Generally not used for abilities ("-start" is called on the new ability, which replaces it).
	Generally not used for items ("-take" or "-start" is called, depending on whether the item was replaced or removed).

-remove [pokemon] [effect] [source]
	The effect [effect] ends on [pokemon], unnaturally.

	Aside from animation and message differences, this is identical to using "-end".

-activate [pokemon] [effect] [source]
	The effect [effect] activates on [pokemon].

	This is usually just a message and/or an animation; the results of the effect activation are described later.

-use [pokemon] [effect] [source]
	[pokemon] uses the item [effect].

	Aside from animation and message differences, this is identical to using "-activate" followed by "-end".

-take [pokemon] [effect] [source]
	[pokemon]'s item [effect] is taken from it.

	Identical to -end, but usually comes with a different animation and message.

-sidestart [user] [effect] [source]
	The side condition [effect] starts on the side associated with [user].

-sideend [user] [effect] [source]
	The side condition [effect] ends on the side associated with [user].

-fieldstart [effect] [source]
	The field effect [effect] starts.

-fieldstart [effect] [source]
	The field effect [effect] ends.


Boosts
------------------------------------------------------------------------

-boost [pokemon] [boost] [source]
	Boost [pokemon] by [boost].

-setboost [pokemon] [boost] [source]
	Set [pokemon]'s boost levels to [boost].

-clearboost [pokemon] [source]
	Clear all of [pokemon]'s [boost].

-copyboost [pokemon] [pokemon2] [source]
	Replace [pokemon]'s boosts with [pokemon2]'s boosts.

-swapboost [pokemon] [pokemon2] [source]
	Swap [pokemon]'s boosts and [pokemon2]'s boosts.
