The full description is in the comments of the Endless Battle
Clause entry in rulesets.js.
This update fixes a lot of the issues with yesterday's version.
Also included: A minor refactor of deductPP, which did not need
a success variable.
The new Endless Battle Clause attempts to ban endless battles by
detecting situations in which a battle could become endless.
This approach bans endless battles without banning Leppacycling.
The exact formulation is:
A Pokémon is considered cornered if:
- it has no available moves other than Struggle
- OR a stale Pokémon used Assist Whirlwind on it
- OR it has been hit by a Struggle from a stale Pokémon on the turn
it switched in
(at the beginning of a turn, if you have available moves other than
Struggle, you are no longer cornered)
A Pokémon is considered stale if:
- it has gained a Leppa berry through any means besides starting
with one (including but not limited to Harvest, Recycle, Pickup,
Symbiosis, Bestow, Thief, Switcheroo, and Magician)
- OR it has been targeted with Fling Leppa Berry
- OR it is cornered and begins a turn with more HP than it the last
turn it began
- OR it is cornered and begins a turn with as much HP as the last
turn it began, and was not fully paralyzed, loafing around from
Truant, or immobilized from Attract
- OR it uses Transform/Imposter against a stale Pokémon
(a Pokémon that becomes stale stays stale for the rest of the match)
If all active Pokémon are stale, the player whose team originally
started with a Leppa Berry loses. If both or neither team started
with a Leppa Berry, the team that had the first stale Pokémon wins.
- Gen 5-6: Thaw check is skipped when using a self-thaw move
- Gen 3-4: Thaw check happens before a move is used
- Gen 2: Self-thawing does not happen if the move misses
Gen 4 and Gen 5:
1) In Gen 4, the chance of protecting succeeding does not fall below
1/8, which has now been corrected in this commit. Previously, the
chance of success in Gen 4 was allowed to drop all the way to
1/(2**32) as in Gen 5.
Please see upokecenter for the correct mechanics:
http://upokecenter.dreamhosters.com/dex/?lang=en&move=182
For Protect and friends, Smogon currently says that the chance of
success does not fall below 50%, which is inconsistent both with the
current Pokemon Showdown! behaviour and with upokecenter. It is
pretty much certain that upokecenter is accurate here, since it is
based directly on the in-game data. This commit implements the
upokecenter mechanics.
2) This commit also consolidates some duplicate code with Protect and
friends by moving the miss chance logic to an event of the 'stall'
volatile called onStallMove. This allows me to remove some duplicate
code from moves.js.
3) Currently, some but not all of Protect and friends have a flag
called stallingMove set to true. This flag does not appear to be used
for anything. However, for consistency, I have set it to true for all
the "stall moves", as opposed to just a subset of them.