Previously, battle queue stuff was just strewn around `battle.ts`.
This gives it a new home: `battle-queue.ts`.
This was intended to make `battle.ts` slightly more tractable, although
the difference is so small that maybe I shouldn't bother. Oh, well,
every little bit helps.
This is a really hacky implementation of Emergency Exit, but Emergency
Exit itself is a huge mess on cart, too.
Our previous implementation:
- activated Emergency Exit at AfterMoveSecondary timing for move damage
- activated Emergency Exit immediately after dealing any other damage
This new one:
- activates Emergency Exit only in three situations:
- right after AfterMoveSecondary timing, for move damage
- right after DamagingHit timing, for DamagingHit residual damage
(Rough Skin, Iron Barbs, Rocky Helmet)
- right after the switch update, for switch-hazard residual damage
(Stealth Rock, Spikes)
- does not otherwise activate (so Substitute, Hail, Toxic, etc no
longer activate Emergency Exit)
This should much accurately simulate Emergency Exit behavior, including
most famously timing it after healing berries after hazards, as
documented in:
https://www.smogon.com/forums/threads/pokemon-sun-moon-battle-mechanics-research.3586701/#post-7075354Fixes#6309
Fixes#6346
The `AfterDamage` event has been replaced with `DamagingHit`, which
which happens for damaging moves after secondaries.
The `AfterHit` event has also been moved after `DamagingHit`, to make
sure Knock Off still procs after Rocky Helmet.
`AfterHit` is no longer a valid event on `secondary` and `self` blocks,
because it's meaningless in those blocks, anyway. All `self.onAfterHit`
and `secondary.onAfterHit` handlers have been moved to `onHit`, which
should have the same timing in practice.
- Healing Wish is not consumed if the Pokemon switching in
has full health and no status condition.
- Being statused with full health will consume the Healing Wish.
- It does not trigger on damage after switching in.
- The effect will be consumed if an injured Pokemon is swapped
into a slot with an active Healing Wish by Ally Switch.
This adds a `boosts` property to items that runs in `useItem`.
This allows it to be added to `datasearch` or similar plugins.
The item activation messages are now as accurate as in-game.
The Gem activation message is also consolidated in `useItem`.
Check whether the move is a max move. If it isn't, then resolve the choice as usual. Otherwise, do not add the move to the queue, and let the runDynamax mechanic handle move resolution.
Added regression test to check for focus punch message in both dynamaxed and regular use
- `Obtainable` and `Team Preview` are now part of `Standard`
- `minSourceGen: 8` is now a part of `-Unreleased` (which is part of
`Obtainable`) in Gen 8. Instead, it's NatDex that overrides it with
`minSourceGen: 1`. This allows `!Standard, Standard NatDex` and
`!Standard NatDex, Standard` to work as intended.
- Duplicate rules are now checked for (does not apply to subrules, so
multiple inheritance is still possible)
- It is now possible to inherit `minSourceGen` from rules.
Custom rules can now use whitelists instead of blacklists.
Whitelist rules look like:
`- all moves, + Metronome`
(Metronome Battle does not use this ruleset currently, because its
scripted check displays a better error message than a whitelist rule,
which can't actually display the whitelist as of the current
implementation.)
This merges the Glitch and Pokestar tags into a new Unobtainable tag that defines Pokemon that are only obtainable through hacking (such as Floette-Eternal and Missingno.). These Pokemon are legal in Hackmons of their specific generation only. Custom is used in future gens instead of Past because of National Dex legality.
New research shows that only Zacian-Crowned and Zamazenta-Crowned are unobtainable out-of-battle. So, reverting the validateForme changes and hardcoding it in BH instead of using Obtainable Formes.