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.
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.
Add a new event ModifyAccuracy that affects all moves other than OHKO
moves and switched many event handlers that originally used the Accuracy
event to ModifyAccuracy instead.
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.
Added BattlePokemon#isGrounded to check for the grounded-ness of a
Pokemon. Also BattlePokemon#isSemiInvulnerable for whether a Pokemon is
in the first turn of a two-turn move that makes them semi-invulnerable.
Fixed Terrain bugs involving Pokemon in a semi-invulnerable state.
Changed OHKO move check to use BattlePokemon#isSemiInvulnerable, fixing a
graphical bug that would display an immunity message when a Pokemon
attempted an OHKO move on a higher-leveled Pokemon that was being held by
the effect of Sky Drop.
Fixed Misty Terrain bug that was causing Rest and the effect of Yawn to
put Pokemon to sleep.
Fixed Misty Terrain bug that was causing Yawn to fail.
Fixed Electric Terrain bug that was causing Yawn to succeed.
Instead of having a hardcode in scripts.js that people needed to
reference, it seemed more intuitive to take advantage of the Damage
event instead, and have Rock Head negate damage within the event.
Fixed a bug in Gen-NEXT Rock Head exhibiting the same behavior that
was causing the original Rock Head + Mummy glitch.
BattlePokemon#ignoringItem and BattlePokemon#ignoringAbility are
hardcodedto return true for any situation where pokemon.ignore['Item']
or pokemon.ignore['Ability'] respectively would have been true.
- Sheer Force may not be user's Ability by the time `AfterMoveSecondary`
effects are checked
- Sheer Force boosted moves called by other moves now ignore
`AfterMoveSecondary` effects properly
Old implementation allowed Pokemon to use a standard weather move like
Rain Dance successfully against a primal weather like Harsh Sun if a
Pokemon with Cloud Nine or Air Lock was active.
Set up moves to track the type effectiveness of the move for purposes of
'Hit' and 'ModifyDamage' events. This fixes various glitches resulting
from Pokemon with the 'IgnoreEffectiveness' flag set for some types, and
also is a slight optimization because it removes the need to run the
'Effectiveness' event one more time to check effectiveness in the moves.
While move.affectedByImmunities was always a Boolean value to denote if
the move was affected by immunities, move.ignoreImmunity can be a Boolean
value if it ignores or is affected by all type immunities, but also can
act as an object such that !!move.ignoreImmunity[type] means it ignores
immunities of that type.