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.
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.
The intention for this event is to remove the move disabling code away
from ModifyPokemon and to an event that can be run a fewer number of
times. Since the disabledMoves index is used to gray-out moves that cannot
be used, and not for any other purpose, there is no need for the related
code to be run at the ModifyPokemon timing, instead working better as a
once per turn event.
freezing a Shaymin-S transformed into something else -> no change; no
change when it comes back in frozen
freezing a Shaymin-S transformed into Shaymin-S -> reverts to Shaymin
freezing a Shaymin transformed into Shaymin-S -> reverts to Shaymin
freezing a Ditto transformed into Shaymin-S -> no change
freezing a Shaymin-S holding Aspear or Lum -> reverts to Shaymin, then
defrosts
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.
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.
- 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
Moved all checks for primal weather into setWeather() instead of
hard-coding the check into every effect attempting to change the weather.
Also to prevent hardcoding, the check now runs on the event system, and
the primal weathers themselves deny regular weathers from being set.
Added functionality for setAbility to send End events to abilities.
Fixed bug with Mold Breaker negating all Battle#singleEvent ability calls,
even those that don't involve damage calculation.
Fixed Skill Swap to now use End and Start events in the right order:
send the End events, then change the abilities, then send Start events.
If the same ability is swapped, don't send End events (the game simply
re-activates the abilities in question)
Moved SwitchOut/Faint events from weather to ability so the weather
can interact properly with Cloud Nine or Air Lock.
Primal weathers persist if a Pokemon with the relevant ability is
on-field, even if the originator switches out.
- Implement BattlePokemon#runEffectiveness, accounting for battle events.
- Refactor Tools#getEffectiveness accordingly.
- Remove Inverse mod. It's now implemented using the global event 'Effectiveness', and with a few changes in the base data for hazards and Arena Trap.
- NEXT: Fix Filter and Solid Rock not accounting for the special effects of Freeze Dry and Flying Press.
Future moves fail to activate if the opponent has Wonder Guard, and
deals damage if it activated beforehand to a Wonder Guard Pokemon that
is not weak to them. This commit fixes both of those issues. However,
future moves still hit through wonder guard in generation 5, so that
is untouched.