Fixed Lock On to allow multiple Pokemon to target the same Pokemon, and
causing it to fail if a Pokemon already has a Lock On active.
Fixed Lock On and Telekinesis to work properly with multi-hit moves and
target redirection.
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.
- Rename randbats helper function `canMegaEvo` to `hasMegaEvo`.
- Move duplicate mega evolution possibility checks from `runMegaEvo` and BattlePokemon constructor to `canMegaEvo` battle script.
Fixed ability interactions with Hidden Power, Judgment, and other moves
that change their types.
-ate Abilities don't trigger with Natural Gift.
Normalize > move's type change > -ate Ability > Ion Deluge/Electrify
For Gen 4, the order is: move's type change > Normalize
Sky Drop needs to occur before Stance Change and just about every other
ability, move, status, or volatile effect. Since Stance Change was
recently upgraded to BeforeMovePriority of 11, Sky Drop needs to be moved
up to 12.
- The existence of the volatile implies that the last move used by the fainted mon is the correct one.
- Just like Destiny Bond, Grudge isn't triggered by future moves, and the volatile should always be removed on BeforeMove.
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.
- Griseous Orb, Plates, Drives, and Mega Stones can no longer be removed
from or given to their respective species by any means
- Mold Breaker and friends can no longer remove a Plate from an Arceus
- The Fling base power for these related items is now defined in Tools,
like Berries
- Sticky Hold works correctly with Bestow, Fling, Knock Off, Switcheroo,
and Trick
- Pokémon affected by Imprison -or Telepathy in NEXT- will now have a special flag 'maybeDisabled' in move requests if they are the last active pokémon.
- If a Pokémon having this flag attacks, the player will not be able to cancel their decision.
- Refactor Battle#parseChoice: Move decisions will now be parsed based on all the moves a pokémon knows after LockedMove, rather than only on validMoves. Any request to use a disabled move or a move with 0 PP will now be replied with a message in the form |callback|cant|[pokemon]|[sourceEffect]|[move], unless the pokémon has no valid moves, in which case it will use Struggle. The check for lockedMove in choice parsing is now performed as the first action after checking that the pokémon is not fainted. This prevents pokémon from Shifting to the center in Triples while being locked into a move.
- Don't report moves' being disabled to the client in requests if they are disabled due to Imprison or Telepathy. Instead, their being disabled will be reported using the mechanism described above.
- 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.
- Changed Sky Drop to use onTryHit on its first hit as well as its second,
allowing it to check for Protect and Fly naturally.
- Added messages when a Pokemon is freed from Sky Drop.
- Allow Flying-type Pokemon to be hit by Sky Drop if their Ground immunity
has been removed.
- Added BeforeMovePriority to allow Sky Drop to interact with Stance
Change properly.
- Prevent a Pokemon trapped by Sky Drop from Mega Evolving.
- Added onRedirectTarget to allow Sky Drop to interact with Ally Switch
properly.
The noAssist table wasn't working because of a bug in ae6da14ca0
namely that the .moves array wasn't toId'd.
Come to think of it, there's no reason for .moves to exist at
all anymore. We should probably just refactor it out.
When a Pokemon uses Entrainment, the correct battle message should be
"POKEMON acquired ABILITY!", which only displays in the client if the
[from] tag is included in the message.
I used a hack to make the multiple declaration errors go away,
so all that remained in jsHint were actual errors, which I've
now mostly fixed.
All this linting ended up uncovering one actual bug: Uproar's
message not showing. It's a very minor bug in a move no one uses,
so I'm going to fold it into this commit.
- Fix an issue introduced in 6539521adc, where Protean didn't activate if the target was immune to the move.
- Protean should not activate if the user fails a Detect/Protect, or the move is Fling or Natural Gift and the user has no item.
- Protean should not activate on the first turn of a Pledge Combo. Aditionally, fix Flash Fire/Storm Drain, etc being activated by the first move in the combo.
- Introduce event 'PrepareHit', which is ran after any move target is resolved but before immunity is checked.
I checked all the following against an X ROM dump:
- basePower (no errors)
- pp
- accuracy
- priority (no errors)
- secondary chance (no errors)
- isContact
- type (no errors)
- category (no errors)
- isSnatchable
- isSoundBased
- isPunchAttack
I also tried to check isBounceable and isNotProtectable, but they seem
to work somewhat differently from the corresponding game flags.