In Doubles, there's the possibility that battle.sides[i].active[j]
does not exist, thus causing a crash. Add a check for that.
A non-existing Pokémon is not counted for result.
If there's no active Pokémon, there's no field Perish Song
effect whatsoever.
These aren't done with a rounded fraction like the other healing moves. They heal the target by an amount equal to it's maxHP modified by either 0xAAC (.667), 0x800 (0.5), or 0x400 (0.25)
If Smeargle uses Imprison, Torment, and Transform against an opponent, it won't be able to use Struggle twice in a row and it will run no moves every two turns. Check for Struggle in Torment to fix that.
- Gen 5: User cannot Transform if it or the target is already
Transformed.
- Gens 2-4: User cannot Transform if the target is already Transformed.
- Gen 1: User can Transform in both situations.
1) For the purpose of action sorting, a Pokemon's effective speed is
`speed & 8191`.
2) Trick Room works by replacing a Pokemon's speed by `0x2710 - speed`.
- Previously, using Final Gambit on a Pokemon holding a Red Card and
having the Red Card holder survive the hit would force the Final Gambit
user out and faint the Pokemon dragged in, rendering the battle
unplayable.
I'm calling it a refactor because I'm pretty sure it doesn't actually
change anything. But right now gems require a new code guarantee:
basePowerCallback shouldn't return false under normal circumstances.
(Some of them still do return false, but only under error conditions)
Specifically, the TryFieldHit event no longer exists.
Instead, Magic Bounce has separate event handlers for TryHit and
TryHitSide.
This also fixes it so Magic Coat/Bounce happen before ability
absoption (like Water Absorb).
Gems now boost all hits of a spread move.
This introduces a new event BasePowerMultiplier, so that gems actually
activate at the right time now.
The name is similar to basePowerModifier but they do the same thing
anyway. We should probably figure something out for their naming,
though.
• Non-Ghost-Type Pokemon that have been Ghost Cursed can now use Curse
on themselves.
• Curse now lets Ghost-type Pokemon select a target in Double Battles.