Commit Graph

57 Commits

Author SHA1 Message Date
MacChaeger
bb8aca0905
Fix move-disabling mechanics for Dynamaxed Pokemon (#7853) 2020-12-30 18:08:53 -05:00
MacChaeger
ef4132edb8
Fix two-turn submoves + Ally Switch in Doubles (#7654) 2020-11-25 15:21:23 -05:00
Guangcong Luo
3336decb79 Implement Desync Clause Mod for Gen 1 Counter 2020-11-15 02:18:37 +00:00
Guangcong Luo
1e39e19f00 Refactor chat to use Utils.splitFirst 2020-11-08 18:31:38 +00:00
Guangcong Luo
a38f0597f8 Remove last vestiges of tslint 2020-10-27 22:49:00 +00:00
Kris Johnson
fa569c7a49
Add properties to see which Pokemon fainted last/this turn (#7452) 2020-10-01 16:31:45 -07:00
Guangcong Luo
3d68248efa Update to latest eslint
We're skipping two major typescript-eslint versions, so there are a
bunch of changes here, including:

- it's catching a lot of things it didn't catch in the past, for
  reasons unclear to me

- no-unused-vars has to be explicitly disabled in global-types now

- a lot of `ts-ignore`s were never necessary and have been fixed

- Crashlogger can now handle being thrown things that aren't errors.
  This has never been a problem in the past, but to satisfy TypeScript
	we might as well not die in a fire on the off chance someone tries to
	`throw null` or something.
2020-09-29 15:28:08 -07:00
urkerab
5d714fbb56
Replace @ts-ignore with type assertions or other less unsafe constructs (#7390) 2020-09-19 02:07:48 -07:00
Mia
deeed6c789
Remove sim/ and data/'s globals (#7091) 2020-08-07 06:44:15 -07:00
Guangcong Luo
4d09f7acde Rename more instances of Effect to Condition 2020-07-26 11:26:23 -07:00
Guangcong Luo
800d8bd8f3 Remove Dex.getForme etc
The server now uses the same approach as the client of treating
cosmetic formes as real formes, as documented in `FORMES.md`.

This eliminates the need for the `.forme` and `.speciesid` properties
of `Pokemon`.

`pokemon.id` has also been removed: useful, since it turns out half
of its uses were bugs that should have used `pokemon.species.id`.
2020-04-28 17:38:54 -07:00
Guangcong Luo
e8e3493c40 Fix Struggle activation conditions
PS wasn't correctly detecting `disabled: 'hidden'` moves as disabled
for the purposes of detecting Struggle activation. This has been fixed.

Thanks to DaWoblefet for unit tests!

Fixes #6620
2020-04-26 17:52:06 -07:00
Guangcong Luo
5abdb88e55 Refactor EventListener
Renames:
- .status -> .effect
- .statusData -> .state
- .thing -> .effectHolder

`thing` was always a really weird "I don't know what to call this"
variable name, but it's been renamed `effectHolder`, which should be
much clearer. `status` -> `effect` is I think the last remnant of old
PS code which called all effects "statuses". `statusData` -> `state`,
on the other hand, is the very first step in an initiative to calling
less things "data".
2020-04-07 17:05:19 -07:00
Kris Johnson
994fc60aed
Rename Template to Species (#6478) 2020-03-25 23:29:27 -07:00
Guangcong Luo
5108a62f5e Standardize on using + for move targeting
Move targets are now intended to be +1 +2 +3 for foes. The old syntax
of using 1 2 3 is still supported, but is not recommended.

(The old syntax will still be used in the old client, but the Preact
client will support the new syntax going forward.)

This makes the difference between move number and move target
clearer.

This also fixes the Conversion 2 ambiguity (although for backwards
compatibility, we do still need to special-case it).
2020-03-23 23:50:46 -07:00
Guangcong Luo
90c503724f Support and document /move max mindstorm
Dynamax and Z move decisions can now be input by naming the max move
or z-move involved.

Fix #6425
2020-03-21 23:38:04 -07:00
Waleed Hassan
8aa4f053bb
Use optional chaining and linter improvements (#6422)
This is mostly just a follow up to #6342.

`prefer-optional-chaining` was turned on and fixed in every location it
complained in. The transformed function [0] looks expensive from a
glance but from skimming through the replaced sites it doesn't appear
to be ran in any important place, so it should be OK.

The linter improvements are:
- Increase linter performance
	- Make `full-lint` and `lint` write to different caches so we
	  avoid overwriting their caches since they're different configs
	- Change husky's hook to `npm run lint` so as to write to the
	  same cache
	- Remove `@typescript-eslint/eslint-plugin-tslint` which is
	  essentially a wrapper to TSLint because the rules aren't worth
	  running another linter
- Convert `.eslintrc.json` and `.eslintrc-syntax.json` to two spaces
  rather than four tabs to respect PS' `.editorconfig`
- Rename `fulllint` to `full-lint` to ease spelling it

[0] - https://pastie.io/mmtxpf.js (prettified)
2020-03-06 11:44:32 -08:00
Guangcong Luo
b21c9047e2
Migrate to typescript-eslint (#6342) 2020-03-05 08:33:06 -08:00
Guangcong Luo
c64ad07385 Fix typo 2020-02-23 22:17:22 -08:00
Guangcong Luo
9a4cf1149c Rename getRequestData functions
We now have `pokemon.getMoveRequestData()` and
`pokemon.getSwitchRequestData()`, which should make it much clearer
which one does what.
2020-02-23 22:10:49 -08:00
Guangcong Luo
a41e4b051f Fix infinite loop with disabled Max Guard 2020-02-23 04:47:52 -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
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
e6f53a7ad2 Implement smart target tracking
(Stalwart, Propeller Tail, Snipe Shot behavior.)
2020-01-18 15:43:33 -07:00
Guangcong Luo
9abdaa1977 Allow "dynamax" choices when already dynamaxed 2019-12-12 17:09:16 +09: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
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
18dab87d6b Fix Dynamax move targeting in Doubles 2019-11-20 21:28:51 +13:00
Guangcong Luo
2b55bde8af Output Dynamax to inputlogs 2019-11-17 13:10:43 +13:00
HoeenHero
a9f0f752d3 Fix choice lock - dynamax interaction 2019-11-16 08:44:31 -05:00
HoeenHero
9ecbcabee9
Dynamaxing (#5946) 2019-11-15 21:33:10 -05:00
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
Guangcong Luo
3db1d9916c Deduplicate Template definition
It turns out Template is the only remotely-easy type to merge the class
and interface for.

The others all have a bunch of event methods which would need to be
redefined on the class.
2019-07-19 18:20:42 -05:00
Kirk Scheibelhut
f0e3d22957 Tweak cases how/when base power is included in required (#5527) 2019-06-05 16:40:47 -05:00
Kirk Scheibelhut
51d390900d Include BP in |request| for Frustration/Return (#5519) 2019-06-04 11:35:40 -05:00
Kirk Scheibelhut
3d24166cdf toId -> toID
Closes #5479
2019-05-12 17:53:01 -07:00
Kirk Scheibelhut
df3d9b91ef Battle toJSON/fromJSON (#5427) 2019-04-30 14:48:27 +12:00
Kirk Scheibelhut
7e4929a39f Change protocol for '|split' message type (#5331) (#5332) 2019-04-22 09:20:47 +09:30
Kirk Scheibelhut
b2777f9bf6 Remove |callback| in favor of |error| (#5418) 2019-04-09 03:33:32 +08:00
Ivo Julca
121c4a3b24 Sim: Abort parsing choices if any is invalid
Fixes #5399
2019-04-03 02:08:59 -05:00
Kirk Scheibelhut
0f8241045b Test 'noCancel' behavior to prevent #5344 (#5348)
Renames currentRequest -> requestState to avoid confusion.
2019-04-03 11:58:53 +08:00
Ivo Julca
b369b0f680 Sim: Fix crash in Team Preview
Regression from the deletion of parseChoice() @698fb2a
2019-03-30 19:39:24 -05:00
MacChaeger
9a7ce3dedf Put side conditions on p1 and p2 in multi battles (#5341) 2019-03-27 11:00:36 +08:00
Kirk Scheibelhut
564dae455d Make Battle throw on choice errors in tests (#5286) 2019-03-21 13:14:38 +09:00
MacChaeger
6ac8266696 Support 4 player battles (#5266) 2019-03-18 13:37:27 +09:00
Kirk Scheibelhut
0e1708bf9f Enable prefer-const and max 120 character lines for .ts files (#5292) 2019-03-16 07:14:04 +09:00
Ivo Julca
37b537feea Fix long line warning 2019-03-12 00:35:51 -05:00
Slayer95
5828a60663
Sim: Quit parsing on too many choices 2019-03-11 02:04:22 -05:00
Guangcong Luo
47111ac4c7 Make side#getChoice() show ultra where relevant
Fixes #5294
2019-03-10 13:52:30 -05:00