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.
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.
- Since Gen 5, Abilities have no effect when the Pokemon is not on the
field (which is why Aromatherapy and Heal Bell can cure inactive Sap
Sipper and Soundproof Pokemon, respectively, among other things)
In order to emulate Gen 1 perfectly and to let the metagame adapt to the correct mechanics, stat calculation has been refactored.
Burn and Paralyse drop are applied whenever a Pokémon switches in with the status.
Also whenever a Pokémon gets a stat boost, if the Pokémon whose turn is not has the status.
Stat boosts recalculate that stat, minus burn and para drops (that's why Agility ignores para drop and Rest keeps drops).
Additionally, Reflect and Light Screen are only calculated in damage calculation.
Part of this code has been added to battle-engine.js with a gen === 1 conditional to avoid a ton of code repetition that would have been necessary otherwise.
Keep in mind that .modifiedStats for a BattlePokemon and the modifyStat function must only be available for gen 1 games.
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.
- Gen 4 and earlier announce a Pokemon has no moves left before the turn
begins, and only to that player's side (even multiple times in Doubles
if the first action is cancelled)
b922ae2f introduced possibility of using Pokemon over level 1000 in
custom battles. However, this doesn't work in practice, because battle
engine limits level to 1000. This commit fixes what b922ae2f should have
done all along.
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.
- No longer leaks information that the opponent has no moves left
whether or not they actually attack with Struggle
- Now shows the correct recoil message
- Gen 3 and earlier now have the correct accuracy
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.
lastAttackedBy is now reset if the attacker is no longer active.
Note: Mirror Move has extremely complicated mechanics and this does not
implement it completely but does as much as possible.
- Split it off from `runDecision` to `parseChoice`
- Internally, `decision.team` is now an array of zero-based positions.
- Guard against slot duplicates.
Added a new event, ModifyWeight, to deal with weight changes from items,
abilities, and moves. Add a function getWeight to call the event and
return a Pokemon's current weight.