The current implementation of ModifyAtk, ModifyDef, etc. is to pass the
actual stat into the event, have event handlers run battle.chainModify(),
ModifySpe passes in a modifier variable, calls battle.chain(), and then
ends with battle.modify() using the modifier variable. The way chainModify
is implemented within the event system also means that it chains together
modifiers in the same manner and finishes with battle.modify(), meaning
that there is no need for ModifySpe to use battle.chain() and
battle.modify() manually.
This also fixes the effect of BattlePokemon#getStat on stats other than
speed.
- Gen 1 PP overflow makes a Pokemon stale
- Staleness warnings now specify the staleness source
- Half-staleness also warns, if another pokemon is already stale
Warning on half-staleness helps remind people who seem to think
they've beaten Endless Battle Clause after 5-ish turns, when it
takes 10-20 turns for some staleness verdics, especially if
there's a lot of switching going on.
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.
Implement new function getMoveTargets to list all move targets given a
user and a move. Refactor Battle system to remove redundancies with
checking move targets. Run the RedirectTarget in this function instead of
later after TryMove, since technically single-target moves changing
targets should occur before the move is attempted.
Refactor the DeductPP event to be a singleEvent that targets the Pokemon's
ability instead of a global event. Run this event on the move's targets as
calculated by BattlePokemon#getMoveTargets.
- Mimic can copy any move
- Mimic can be used while Transformed
- Mimic uses its own PP for copied moves, even if its current PP is
greater than the maximum PP of the copied move
Add new function battle.insertQueue that inserts a decision into the
correct position in an already-sorted queue instead of re-sorting. Also,
to prevent code reuse, add new funciton battle.resolvePriority to deal
with shared code between battle.addQueue and battle.insertQueue.
Knock Off no longer broadcasts the source so Arceus can knock off a Plate
from a non-Arceus, Genesect can knock off a Drive, etc. Updated Sticky
Hold to check for Knock Off specifically as a result.
TakeItem is no longer suppressed by Mold Breaker, fixing interaction with
Unburden. Updated Sticky Hold to check for Mold Breaker instead.
Items that prevent their own removal do not have that effect negated by
Klutz and other item-negating effects.
Thief and Covet can steal Mail.
Replace the pokemon.negateImmunity object with a new `NegateImmunity`
event that handles all the immunity negation.
Also deprecate 'IgnoreEffectiveness' in favor of having relevant moves
and items use `Effectiveness` event handlers instead.
Creates a new function Battle#on that allows tests and potentially formats
to add new event handlers to a battle. These handlers can then be picked
up by the battle engine for consumption.
At any rate, it's more efficient than hotpatching the getEvent function
within a Mocha test.
- Process the 'runSwitch' decision directly in Battle#dragIn in gen
5 and up. This allows the Pokemon executing the drag-out move to
remain as battle.activePokemon for the duration of the dragging
action. This fixes Mold Breaker's interaction when moves that drag
out Pokemon are used.
- Add a check for battle.activePokemon.isActive in the Mold Breaker
ability activation check to prevent glitches with Red Card.
- Remove Damage/SubDamage from Mold Breaker's check and instead add
an additional check for the Damage event specifically to use extra
criteria. This fixes its interaction with Magic Guard.
It should compare this.activePokemon to "thing", which is the Pokemon that
is holding the Ability being processed, not "target".
Also fixed random typo where Mold Breaker might succeed even if the
ability were supressed.
This system is problematic for people who enter games without having
filled out their EVs, as their stats will not reflect the stats shown
in the teambuilder and can influence damage calculations, resulting in
many erroneous bug reports.