BattlePokemon#runImmunity is now two functions, runImmunity and
runStatusImmunity.
The split is helpful because: 1. NegateImmunity only applies to type
immunities, and 2. Immunity only applies to status immunities and
Ground immunities.
Ground immunities are now entirely handled hardcoded in isGrounded.
This overall doesn't have a noticeable impact on performance, but
it makes certain things behave more predictably, and correctly
shows the ability activation for Levitate, so I assume that means it's
a net positive. I hope I at least improved readability...
Mainly follow-up for 1deedc595, but also fixes a few bugs.
- BW/GSC/RBY - randomSet: fixed and renamed slot argument.
- BW - randomTeam: crashlogger relative path was set incorrectly.
- BW - randomTeam: PotD Magikarp and Delibird used outdated randomBattleMoves data format.
- RBY - randomTeam: builder was too reject-happy regarding weaknesses (counters prematurely updated).
An improvement of 130% more op/s is observed for RBY randomCCTeam,
with no significative performance regression for randomTeam in any gen.
- The lock starts even if the move is blocked by Protect, misses, or the
target is immune
- The lock ends without causing confusion whenever the move cannot be
executed
- When the lock ends normally, confusion begins even if the user is
already confused, and there is no indication that confusion has started
- In Gen 1 the duration is 3-4 turns
All this code was done before the main battle-engine was reworked to have exceptions for past gens.
Furthermore, due to how inheritance works, it was messing up team preview in Stadium formats.
All what was dealt with this code is now dealt with in battle-engine.js and all future gen 2 exceptions should be there.
Unlike battle-engine.js, old gens did not check if move.ignoreImmunity was
undefined/false in their getDamage functions, causing crashes when numbers
were passed in to the function.
hasMove was not tracking moves properly, instead only tracking new moves
added in the object instead of its entire moveset. Also, there was a
line of code that caused all moves to be flagged as rejected.
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.
Implement Gen 2 Random Battles as a challenge option.
This format is not going to have a ladder anytime soon.
This format is going to help ironing out Gen 2 mechanics.
The current team and set makers are pretty much basic, they are to be improved with player input over the time.
Right now it doesn't incorporate a full Gen 2 Pokémon pool and it intends to use more offensive items than Leftovers.