Commit Graph

643 Commits

Author SHA1 Message Date
Guangcong Luo
9659511ff1 Refactor queue to new BattleQueue class
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.
2020-02-12 13:30:47 -08:00
Kris Johnson
92c7d377a7
Add Pokemon Home support (#6349)
Co-authored-by: The Immortal <the_immortal123@live.com>
2020-02-12 14:54:55 +04:00
The Immortal
19cdf79821 Update OMs 2020-02-12 14:19:29 +04:00
Guangcong Luo
1914a37aba Fix Eject Pack to activate for self-boosting 2020-02-11 11:16:46 -08:00
Guangcong Luo
6a677e39e8 Fix Emergency Exit timing
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-7075354

Fixes #6309
2020-02-08 08:07:39 -08:00
Guangcong Luo
55cbc52bba Fix bugs with secondary/ability order
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.
2020-02-08 08:07:39 -08:00
Kris Johnson
9f08d93244
Toxtricity-Low-Key can Gigantamax (#6343) 2020-02-07 03:54:07 +04:00
Kris Johnson
d3e266cddd
Fix crash with TRs (#6330) 2020-02-03 00:25:49 -08:00
Kris Johnson
05efe2e011
Add TRs (#6317) 2020-02-02 23:19:45 -08:00
Marty-D
8d644fcb0c Calculate Innards Out damage using non-Dynamax HP 2020-02-02 18:04:33 -05:00
The Immortal
d9327d945a Simplify max moves check in Copycat 2020-02-02 22:30:04 +04:00
The Immortal
6db191a0a8 Implement Copycat interaction with Max moves 2020-02-02 21:29:55 +04:00
QuiteQuiet
211cefb262
Fix Healing Wish for Gen 8 (#6296)
- 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.
2020-02-01 22:04:21 -08:00
Kris Johnson
4c5640d051
Add February 2020 OMotM and RoA Spotlight (#6323) 2020-02-01 15:10:59 +04:00
The Immortal
d2003354f1 Improve 68e0bcb75 2020-01-28 13:43:12 +04:00
The Immortal
68e0bcb75f Refactor single-use items
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`.
2020-01-28 13:21:23 +04:00
urkerab
351089c3d9 Always use getAbility to get a Pokémon's Ability (#6293) 2020-01-18 19:37:01 -07:00
Guangcong Luo
b48733cb7a Rename resolveTarget -> getRandomTarget
Should be much clearer in terms of what it's actually doing.
2020-01-18 15:43:34 -07:00
Guangcong Luo
e6f53a7ad2 Implement smart target tracking
(Stalwart, Propeller Tail, Snipe Shot behavior.)
2020-01-18 15:43:33 -07:00
Waleed Hassan
6714e14fc5 Fix max line length warnings (#6286) 2020-01-14 15:30:50 +04:00
urkerab
b589745a25 Typescript move.target (#6260) 2020-01-11 09:10:10 -05:00
The Immortal
5b97367952 Update Skill Swap & Wandering Spirit 2020-01-09 10:49:41 +04:00
The Immortal
491e0575e0 Random Battle updates 2020-01-07 22:07:09 +04:00
The Immortal
d00bcb9927 Fix validator crash 2020-01-07 00:52:13 +04:00
CK Yong
cadc3fa05d Remove tightening focus message when used by dynamaxed pokemon (#6253)
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
2020-01-04 06:02:35 -05:00
Guangcong Luo
138fccbaa8 Consolidate more rules into Standard
- `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.
2020-01-03 23:42:48 -05:00
Guangcong Luo
2310934a45 Support checking for redundant rules 2020-01-03 23:42:45 -05:00
The Immortal
dde10b714f Fix validation for "Unobtainable" Pokemon
As well as the error message for Past/Future Pokemon.
2020-01-04 05:38:52 +04:00
Guangcong Luo
ca1f8ec820 Fix Howl ally-targeting
Fixes #6247
2020-01-01 11:10:49 +09:00
Guangcong Luo
267c815d7d Allow piecemeal repeal of inherited rules
Specifically, removing a subrule now correctly removes subsubrules.
2020-01-01 11:10:48 +09:00
ZardMX
de7d8168af Fix Neutralizing Gas (#6232) 2019-12-31 16:29:21 +09:00
The Immortal
a0bffce283 Revert "Max happiness in gen 8 is 160"
This reverts commit c7bc102c5a.
2019-12-30 16:44:39 +04:00
Guangcong Luo
edb5404e41 fixup! Fix abilityData/itemData type definitions 2019-12-30 12:23:40 +09:00
Guangcong Luo
1c2119c02e Fix Body Press hint
See https://github.com/smogon/pokemon-showdown/pull/6221#issuecomment-569556599
2019-12-30 11:33:18 +09:00
Guangcong Luo
bf8ed1861d Fix abilityData/itemData type definitions
TODO: move EffectState to global types, and properly type it.
2019-12-30 11:32:12 +09:00
urkerab
c02e711375 Body Press uses SpD boosts under Wonder Room (#6221) 2019-12-30 09:37:04 +09:00
Kris Johnson
36a92b5465 Move Darmanitan-Galar to Ubers (#6236) 2019-12-30 01:13:39 +04:00
Guangcong Luo
1e1c97c255 Add default types/stats for template
A stub Template object now has `['???']` as its `types` array.

This should suppress some crashes, but the underlying problem remains.
2019-12-27 22:09:11 +09:00
Liminalia
afffbeb8b0 Fix RandomPlayerAI wrong teamsize assumption (#6216) 2019-12-27 08:04:47 -05:00
urkerab
7152b42daf Calculate fractional priority once per turn (#6224) 2019-12-27 12:42:34 +09:00
Marty-D
c5b8a0e3c0
Fix Pursuit crash in past gens 2019-12-26 13:51:20 -05:00
The Immortal
f58f196190 Fix National Dex validation 2019-12-25 07:18:42 +04:00
Guangcong Luo
b31b88a79b Add documentation for custom rules 2019-12-25 11:26:23 +09:00
Guangcong Luo
15cfd06795 Support whitelisting in custom 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.)
2019-12-25 10:05:49 +09:00
The Immortal
f62ff19e8a Improve validation for unobtainable Pokemon
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.
2019-12-25 00:35:39 +04:00
Guangcong Luo
7f772fba67 Fix Teatime
Fixes #6210
2019-12-24 14:49:47 +09:00
Guangcong Luo
b190202356 Fix Eject Pack crash 2019-12-24 14:30:30 +09:00
The Immortal
1287dd8add Fix "Past" unreleased hidden abilities 2019-12-22 19:59:32 +04:00
The Immortal
c9af9eacce Correct forme mechanics
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.
2019-12-16 05:37:17 +04:00
Quinton Lee
9a97a49b24 Dex: fix Darmanitan-Galar-Zen's gen (#6187) 2019-12-15 16:11:23 +09:00