Commit Graph

178 Commits

Author SHA1 Message Date
Ivo Julca
792548c01d Add test for Mega-evolution vs Pursuit order 2016-11-19 02:54:52 -05:00
Ivo Julca
78ab0bdf31 Implement Spectral Thief 2016-11-18 18:26:16 -05:00
Ivo Julca
34beddac3d Add test for bounced status moves affected by Prankster
So that UltiMario can be validated when it happens in CC:
http://www.smogon.com/forums/threads/3586701/page-33#post-7087589
2016-11-18 16:59:22 -05:00
Ivo Julca
1700067a77 Fix Judgment test 2016-11-18 15:14:27 -05:00
Ivo Julca
fbc88c8428 Fix Emergency Exit: It should block Volt Switch effect 2016-11-18 15:10:51 -05:00
Ivo Julca
c2f8c72b38 Judgment should not change type from Z Crystals 2016-11-18 15:09:21 -05:00
Ivo Julca
e97ccb3d48 Emergency Exit activation quirks are similar to Eject Button and Red Card
In particular, it only activates after all hits in a multi-hit move are performed, and
it won't activate if the move is boosted by Sheer Force.

This commit also implements the interactions of Emergency Exit
with Eject Button and Red Card, and adds tests.
2016-11-18 13:55:57 -05:00
Ivo Julca
5d04c4f2e0 King's Shield Atk drop now triggers even if immune 2016-11-18 12:48:50 -05:00
Ivo Julca
c8308ccd89 Sheer Cold no longer affects Ice-type Pokémon 2016-11-18 01:53:24 -05:00
Ivo Julca
511a45eb95 Implement immunity of Dark-types to Prankster
The immunity also applies to any moves, even non-Status, called by
other Prankster-boosted moves.
2016-11-18 00:35:52 -05:00
Ivo Julca
e741700553 Test: Update the PRNG seed to make confusion self-hits more consistent 2016-11-17 23:09:04 -05:00
Ivo Julca
92c31e9d7c Test: Move old gen suites for statuses to the bottom 2016-11-17 23:09:04 -05:00
Ivo Julca
005287443c Add tests for new mega evolution & turn order mechanics 2016-11-17 20:57:29 -05:00
Ivo Julca
4fa6c5499b Build: Fix issues reported by the latest Eslint version 2016-11-17 14:27:39 -05:00
Guangcong Luo
b734d2f1c3 Make gen 7 the default mod
This makes gen 7 the default mod, updates the tests to match, and fixes
the corresponding build error.

Note that this only changes the default Tools mod, the default Formats
mod is now gen6. gen7 must be specified by name in a format, for that
format to be a gen 7 format.
2016-11-17 12:27:46 -06:00
Guangcong Luo
02055d3d17 Fix mod loading order
Sometimes mods would mess up if they were loaded in the wrong order.
Specifically, some autogenerated properties of e.g. moves need to be
recalculated for mods.

Anyway, the entire cache system is replaced with a newer, faster,
slightly-more-memory-intensive-but-only-slightly cache system, which
no longer has these kinds of loading order issues.
2016-10-23 14:17:13 -05:00
Ben Davies
54d0ff203a Performance: replace direct references to arguments with rest parametres (#2818)
Replacing direct references to the arguments object of functions with rest
parametres prevents the function from being deoptimized while still allowing
use of arbitrary arguments. This may also fix some minor memory leaks related
to mishandling the arguments object.
2016-10-04 16:29:14 -07:00
Guangcong Luo
da1b318707 Move text processing from Tools to CommandParser
The following functions have been renamed:

- Tools.html to CommandParser.html
- Tools.plural to CommandParser.plural
- Tools.escapeHTML to CommandParser.escapeHTML
- Tools.toDurationString to CommandParser.toDurationString
- Tools.toTimeStamp to CommandParser.toTimestamp
  (notice the lowercase 's')

This is in preparation for a rename of Tools to Dex (by removing the
non-dex-related functions) and a rename of CommandParser to either
Messages or Chat.
2016-09-30 18:04:13 -07:00
Taylor Everding
1a1f64fe95 Remove .js extension from requires (#2725) 2016-08-30 00:04:40 -05:00
The Immortal
76b6030043 Fix Relic Song 2016-08-04 03:41:15 +04:00
Marty-D
41e6945417 Add Electric/Misty Terrain messages 2016-07-20 14:05:25 -04:00
The Immortal
a61e19b46a Tests: Remove unused const 2016-06-26 05:37:17 +04:00
Kevin Lau
5e3f1dcabc Tests: Update Weather tests for clarity and readability (#2596)
Updated remaining Primal Weathers to the new APIs.

Updated misleading test cases relating to base power of moves in
Desolate Land / Primordial Sea.

Increased coverage on weather tests.
2016-06-24 20:11:03 -07:00
Ivo Julca
f095ac4fea Implement Curse targetting glitch 2016-06-20 11:57:23 -05:00
Ivo Julca
ec572891a5 Fix typing information leak 2016-06-20 11:38:06 -05:00
Ivo Julca
59c667337b Refactor Team Preview to support per-Pokémon decisions 2016-06-20 10:49:21 -05:00
Ivo Julca
543bbf5ccc Refactor switching to support per-Pokémon decisions
- Implements `skip` choice, which acts as a placeholder in the player
choices. This is relevant to double-KOs, since in-game you are allowed
to specify switch-ins in any order.
2016-06-19 23:45:57 -05:00
panpawn
a331b5d41c Test: fix iteration index (#2594) 2016-06-20 05:25:52 +02:00
Ivo Julca
50fcd02b6d Tighten move validation
The target location is checked on chooseMove(), rather than
after the decision has entered the queue.
2016-06-19 07:53:58 -05:00
Ivo Julca
2861463b48 Test: Increase coverage of /undo
Among the added tests, are included:
- A skipped test for an edge case in which usage of Reflect Type
causes a typing information leak via the presence/absence of the
"maybe-trapped" warning and cancel prevention.
- Two skipped tests related to partial decisions functionality.
2016-06-19 05:49:23 -05:00
Ivo Julca
3b1749eccf Add basic support for per-Pokémon decisions
- Basically, support is added only for `move` requests here, and
behind a flag (`battle.supportsPartialDecision`).
- Switching is mostly supported, except for the multiple-KOs case.
- Team Preview needs a rework in order to enable this feature.
2016-06-17 12:26:56 -05:00
Ivo Julca
76604daf58 Test: Cover /team and /shift decisions 2016-06-17 11:48:07 -05:00
Ivo Julca
be8ba884c8 Test: Increase coverage of decisions 2016-06-17 08:48:22 -05:00
Ivo Julca
99f43ca2ef Test: Fix misc issues
Introduced in commits 69d9dc803 and 22c55e656
2016-06-17 08:41:58 -05:00
Ivo Julca
67da1a1221 Test: Use the new common#createBattle method
- This cuts down tons of code that define player names, avatars,
and deal with Team Preview.
2016-06-17 05:45:22 -05:00
Ivo Julca
e69d9dc803 Test: Dramatically increase coverage of choice parser 2016-06-16 08:25:37 -05:00
Ivo Julca
b242e86c04 Test: rearrange tests for decisions 2016-06-16 08:22:07 -05:00
Ivo Julca
6ca2233657 Fix logging of passes 2016-06-15 10:02:52 -05:00
Ivo Julca
f2aff1b6ae Refactor tests to use the new assert/battle APIs 2016-06-15 08:56:29 -05:00
Ivo Julca
0be37dd2ce Split apart Battle#parseChoice into several BattleSide methods 2016-06-15 08:56:11 -05:00
Ivo Julca
2ab2937b3c Implement assert extensions to enhance the test suite 2016-06-15 08:54:18 -05:00
Ivo Julca
e5971f4f13 Test: Increase choice parser coverage 2016-06-15 01:28:06 -05:00
Ivo Julca
22779102cc Lint: Add miscellaneous extra rules
Among the newly added rules, there are quite a few intended to enforce
compliance of CONTRIBUTING.md-blessed idioms, as well as ensure
safe usage of classes and constant bindings.

We are also now enforcing usage of early return in commands.js,
which has 100% compliance as of fd2c45c.
2016-04-25 21:52:21 -05:00
Kevin Lau
1c574c6c55 Critical Hit Ratio refactor: Use an event to modify crit ratios (#2501)
This allows for proper crit ratios when a Pokemon loses/gains an ability,
item, or other effect in the middle of a multi-hit attack.
2016-04-11 21:35:36 -04:00
Kevin Lau
715de49408 Refactor Anger Point to the Hit event handler
This fixes its interaction with Clear Smog because Hit handlers for
moves always activate before all other global event handlers.

Removed the Hit event from the list of events stopped by Mold Breaker
variants as there are no abilities that would be negated by it that
use that handler.
2016-03-23 20:23:42 -07:00
Kevin Lau
bfac338ddb Normalize doesn't affect moves that change type
The ModifyMove singleEvent for moves always runs before the
larger event that triggers an ability's event handler and
take precedence over Normalize, so we code exceptions in
Normalize to not change the type in those situations.

Conveniently, all the moves that change type right now are
defaulted to Normal-type, and since Normalize technically
won't change the type of any Normal-type move, we're using
that as the guideline for our exception.
2016-03-16 10:54:47 -07:00
Guangcong Luo
82ed5e0d22 Fix Levitate Flying Ring Target interaction 2016-02-19 17:23:21 -06:00
Guangcong Luo
8446e5fbc3 Fix Thousand Arrows Wonder Guard interaction
Thousand Arrows shouldn't add Smack Down if Wonder Guard avoids it.
2016-02-19 17:23:21 -06:00
Guangcong Luo
794d160eec Refactor runImmunity
BattlePokemon#runImmunity is now two functions, runImmunity and
runStatusImmunity.

The split is helpful because: 1. NegateImmunity only applies to type
immunities, and 2. Immunity only applies to status immunities and
Ground immunities.

Ground immunities are now entirely handled hardcoded in isGrounded.

This overall doesn't have a noticeable impact on performance, but
it makes certain things behave more predictably, and correctly
shows the ability activation for Levitate, so I assume that means it's
a net positive. I hope I at least improved readability...
2016-02-19 05:18:40 -06:00
Guangcong Luo
a8e8272bac Refactor types and remove ModifyPokemon
The unwieldy system that is typesData is now removed, and is replaced by
the array `types` and the string `addedType`, which track the same amount
of information in a much more efficient way. (Roost is now hardcoded, but
let's not talk about that.)

Incidentally, this now roughly matches client, which tracks typechange
and typeadd as volatiles.

This allows us to remove ModifyPokemon, which overall provides a 10%
performance increase. I was hoping it'd be more substantial, but oh well.
2016-02-16 23:42:37 -06:00