Commit Graph

1278 Commits

Author SHA1 Message Date
Kris Johnson
994fc60aed
Rename Template to Species (#6478) 2020-03-25 23:29:27 -07:00
Guangcong Luo
91e278d22d Fix Blunder Policy Sheer Cold 2020-03-25 16:58:45 -07:00
The Immortal
2ad5525e8b Fix Parting Shot mechanics 2020-03-20 21:23:33 +04:00
Guangcong Luo
125fe31d06 Improve eslintrc
Fixed some more code style, allowing these rules to be enabled:

- `comma-dangle`
- `function-paren-newline`
- `member-delimiter-style`
- `no-eval`
- `no-fallthrough`
- `no-misused-promises`
- `no-unused-vars`
- `operator-linebreak`
2020-03-06 22:35:55 -08:00
Guangcong Luo
a41e4b051f Fix infinite loop with disabled Max Guard 2020-02-23 04:47:52 -08:00
urkerab
98edf3e025
Refactor Dragon Darts (#6378) 2020-02-21 06:36:41 -08:00
The Immortal
8e93518550 Max Guard is disabled by Taunt 2020-02-21 15:49:27 +04:00
Guangcong Luo
f89f44f209 Max Guard is disabled by Assault Vest 2020-02-21 00:46:28 -08:00
Guangcong Luo
e04769d3b8 Fix multi-hit move hitcount message 2020-02-20 17:49:10 -08:00
Guangcong Luo
1d09dd1174 Fix Dragon Darts bugs
- should not stop after one faint
- should not show miss message for first miss
2020-02-20 15:58:36 -08:00
Guangcong Luo
0df0d234f2 Fix Dragon Darts
Dragon Darts has a variety of mechanics that I don't care to fully
write unit tests for, but this commit should track its in-game
implementation much more closely.

If anyone still has a Dragon Darts interaction that this implementation
handles incorrectly, they should confront me about it.

Fixes #6279
2020-02-20 00:14:58 -08:00
Guangcong Luo
206b5c2b26 Fix multihit moves vs Emergency Exit 2020-02-18 01:13:10 -08:00
Guangcong Luo
78eceb6f03 Fix Emergency Exit activating on faint 2020-02-16 23:42:43 -08:00
Guangcong Luo
09e563f9fc Fix some moves triggering abilities twice 2020-02-15 08:54:14 -08:00
Guangcong Luo
652c7163cf
Refactor queue to new BattleQueue class (#6358)
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 16:20:17 -08:00
Guangcong Luo
ee4435716f Fix crash in Knock Off + Substitute
(This also fixes a bug where hitting Substitute procced DamagingHit
events.)
2020-02-10 15:37:34 -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
The Immortal
6db191a0a8 Implement Copycat interaction with Max moves 2020-02-02 21:29:55 +04:00
The Immortal
63fc04c9aa Use baseMaxhp in move.heal 2020-01-20 15:52:06 +04: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
YaBoiJD
9a88d49a83 Fix Ditto from Dynamaxing as a Mega/Primal etc (#6139) 2019-12-12 00:14:47 +04:00
420Blazeitt
143ea606fd Fix type-changing moves & abilities while Dynamaxed (#6080) 2019-12-11 03:10:38 +09:00
The Immortal
c2b8485ae3 OHKO moves fail on Dynamax
Closes #6165
2019-12-09 16:44:04 +04:00
HoeenHero
5c75f0463c Dont turn status moves into G-Max Moves 2019-11-30 16:55:20 -05:00
YaBoiJD
546065a10d Update National Dex Mechanics (#6108)
Pokemon that are holding an Item that enables Mega Evolution, Primal Revision, or the use of a Z-Move cannot Dynamax. A Rayquaza that can Mega Evolve also cannot Dynamax.

Also fixes an alias loop with the national dex format/ruleset.
2019-11-30 14:50:09 -05:00
420Blazeitt
a10265cb0f Change the current Game Console (#6082) 2019-11-26 16:22:35 -05:00
HoeenHero
44a7fa0946 Make Dynamax checks more dynamic
Specifically we now check the battle.canDynamax method when
notifying a player about their pokemon's eligibility to dynamax.

This enforces the fact that pokemon that are transformed into
dynamax ineligible pokemon cannot dynamax themselves.

As a result of this change the pokemon.canDynamax flag is unnessecary
and has been refactored to a side.canDynamax flag. All pokemon specific
dynamax checks should use the battle.canDynamax method.
2019-11-26 13:05:38 -05:00
Guangcong Luo
5364c63e23 Introduce item.itemUser
`item.itemUser` replaces `item.zMoveUser`, and is a new field
representing a list of possible users of an item, for items that are
restricted to specific species.

`item.zMoveUser` is a base forme for items that affect every forme, and
a forme name otherwise (forme name is currently only used for
`forcedForme` uses).

Arceus is a weird case. Both generic Z crystals and Plates, while
having unique effects on Arceus, also have effects on other Pokémon.
For this reason, Arceus isn't listed as an `itemUser` of either of
these item types - use-cases that want this should also check
`item.forcedForme`.

This is mostly intended to be useful to move-searching and custom
rules (like NatDex, which will only allow past-gen items associated
with removed species).
2019-11-25 15:26:36 +13:00
TZubiri
68593cd168 Updated dark pranster immunity message for gen 8. (#6041) 2019-11-23 20:38:31 +04:00
Guangcong Luo
744b25935d Dynamax moves are immune to Encore etc 2019-11-21 11:59:13 +13:00
HoeenHero
10b8641465 Correct Max & GMax move targeting 2019-11-20 14:00:04 -05:00
HoeenHero
43b22a04fd Fix dynamax targeting in doubles 2019-11-20 08:55:25 -05:00
Guangcong Luo
0bb2e58efd Fix Dynamax move base power
Dynamax moves now have the correct base power, and now correctly only
deal 25% usual damage against Protect.
2019-11-17 06:32:17 +13:00
HoeenHero
7ac8663556 Add default BP for Gen 8 Max Moves 2019-11-16 09:53:53 -05:00
HoeenHero
fd46616a93 Max Move's categories should reflect the base move 2019-11-16 08:18:56 -05:00
HoeenHero
c7d31804de Fix issues with Max Guard priority 2019-11-15 23:46:43 -05:00
HoeenHero
9e5f325902 Restrict gen 8 legendaries from Dynamax 2019-11-15 22:39:46 -05:00
HoeenHero
9ecbcabee9
Dynamaxing (#5946) 2019-11-15 21:33:10 -05:00
Guangcong Luo
801af59b98 Fix remaining build errors
- Centiskorch was misspelled in formats-data, causing a crash in the
  egg validator

- A few validation errors were due to Gen 6 not inheriting from Gen 7,
  Gen 7 not having a scripts file, and Gen 8 having a gen of 7

- Intimidate (Gen 7) wasn't inheriting from Intimidate (Gen 8), giving
  it no name, causing a few validation errors

  (Technically not a build error, but I also added Keen Eye to the list
  of Intimidate immunities, as reported by SadisticMystic.)

- A lot of tests relied on Teleport always failing; these have been
  switched to Gen 7 or swapped Teleport for Celebrate

- Inverse Mod suddenly stopped working; its implementation was a huge
  hack and I can't figure out what went wrong, so I've switched it to
	using the same system the other mod tests use. It's still a huge
	hack, but I don't have the free time to fix it right now.
2019-11-16 06:08:48 +13:00
urkerab
e7aee8d9cc Some fixes to Gen 7 formats data 2019-11-15 22:02:24 +13:00
420Blazeitt
723e256aec Add Gen 8 Items 2019-11-15 22:02:15 +13:00
urkerab
4ab68a3440 Refactor Toxic from Poison types against semi-invulnerability (#5930) 2019-11-06 19:51:22 -05:00
urkerab
bae434e606 Add a single event for a move's own immunity to a specific target (#5904) 2019-10-24 11:00:28 +10:30
urkerab
5b9d0c8db6 Centralise invulnerability checks for No Guard and Lock-On (#5894) 2019-10-17 22:32:44 -04:00
urkerab
3bfec7bf2f Rename TryImmunity to Invulnerability (#5877)
It's a check for semi-invulnerability rather than any sort of immunity.
2019-10-16 20:12:12 -04:00
Guangcong Luo
92c0011b93 Fix HP Fighting Mega Latias validation 2019-10-15 21:00:40 +10:30
Guangcong Luo
e97bb7462a Fix healing move messages at full HP
Fixes #5885

Fixes #5746
2019-10-15 20:32:32 +10:30
Guangcong Luo
7a023746ba
Refactor battle.dex out of battle (#5851)
In most other similar systems, like TeamValidator, we use `thing.dex` instead of having it extend `ModdedDex`. Battle has always extended `ModdedDex`, though. This changes Battle to match the others.

This should fix an issue with `Battle.data` not being cached.

This also frees up Battle to extend ObjectReadWriteStream<string> in a future update.
2019-10-06 07:38:08 +11:00