Commit Graph

75 Commits

Author SHA1 Message Date
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
fbc88c8428 Fix Emergency Exit: It should block Volt Switch effect 2016-11-18 15:10:51 -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
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
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
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
f2aff1b6ae Refactor tests to use the new assert/battle APIs 2016-06-15 08:56:29 -05:00
Ivo Julca
2ab2937b3c Implement assert extensions to enhance the test suite 2016-06-15 08:54:18 -05: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
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
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
Guangcong Luo
b665660608 Refactor for more ES6 features
Now that nodejs/node#3072 is mostly fixed, we can finally start using
Node 4+ features.

This refactor:

- uses arrow functions where appropriate

  Note that arrow functions still aren't used in Mocha, where `this`
  is sometimes meaningful.

  This also removes the need for .bind() nearly everywhere, as well
  as the `self = this` trick.

- refactors Validator and Connection into ES6 classes

- no longer uses Array#forEach for iterating arrays

  We strongly prefer for (let i = 0; i < arr.length; i++) because of
  performance reasons. Most forEaches have been replaced with for..of,
  though, which is 5x slower than the long-form loop but 2x faster
  than forEach, which is good enough outside of most inner loops.

  The only exception is tournaments, which is due for a more invasive
  refactor soon anyway.
2016-02-10 17:40:21 -06:00
Guangcong Luo
f094e4cf01 Fix Lightning Rod redirection priority
In speed ties, the pokemon that's had the ability the longest is
redirected to.

Fixes #2083

Closes #2154
2016-01-13 00:13:55 -08:00
Guangcong Luo
4898190cb6 Fix old pullreq for modern code style 2016-01-04 23:13:43 -06:00
Guangcong Luo
69934732ef Merge pull request #2130 from ascriptmaster/move-fixes
Refactor move redirection
2016-01-05 04:06:58 +00:00
Konrad Borowski
81f602b8d8 Always use trailing comma for multiline objects 2016-01-01 00:20:07 +01:00
Marty-D
235e470553 Merge pull request #2339 from ascriptmaster/trapping
Trapping refactor
2015-12-28 12:10:52 -05:00
Kevin Lau
7c491ad06b Add test suites for trapping moves and abilities 2015-12-21 14:56:21 -08:00
Ivo Julca
c8df8c4e27 Test: increase timeout for Lightningrod Triples test 2015-12-21 05:41:56 -05:00
Ivo Julca
344e021700 Increase timeout for Pressure tests in Triples 2015-12-14 17:53:03 -05:00
Ivo Julca
90973d5c0c Style fixes
- Cut down excessive spacing
- Add braces to missing conditionals
2015-11-07 17:08:09 -05:00
Juanma Serrano
c4ac8d6e2f Use strict mode and let and const instead of var
This commit also fixes some duplicated variable declarations.
2015-11-06 21:56:52 -05:00
Carl Sobolewski
f1146dcac6 Weather modifies baseDamage instead of basePower
http://git.io/vZKFp
2015-09-13 02:43:39 -06:00
Kevin Lau
449f0aaa16 Add test suite for Shield Dust 2015-09-03 03:10:13 -07:00
Kevin Lau
cc1f581c90 Refactor move redirection
Implemented a new priorityEvent function that is set to abort when any
event handler returns a non-undefined result, unlike runEvent which waits
until all event handlers have run. Set RedirectTarget to use this event.

Changed ability/move priorities for RedirectTarget handlers to fit under
this new paradigm.

Added new Lightning Rod and Storm Drain tests to ensure proper behavior.
2015-08-26 20:22:28 -07:00
Kevin Lau
1c70494e2b Fix Snatch and Imprison's interaction with Pressure
They target the user, but for the purposes of Pressure are treated as if
they target the opposing side.
2015-08-21 18:50:21 -07:00
Kevin Lau
e846fbb129 Fix Battle Armor and Shell Armor tests to no longer use the battle log
Instead, they can use Battle#on to check for the move dealing a critical
hit within the ModifyDamage event instead.
2015-08-12 16:02:12 -07:00
Ivo Julca
cd36fbfde2 Gulpfile: add more JSCS rules
- Disallow spaces between function names and round brackets.
- Disallow spaces inside array/object literal brackets.
- Disallow spaces before semicolons.
- Disallow yoda conditions for equality.
2015-07-28 19:38:53 -05:00
Marty-D
d00ed0c5c5 Fix trailing whitespace from cf295251a1 2015-07-24 21:26:28 -04:00
Pikachuun
cf295251a1 Fix Flower Gift 2015-07-24 20:03:25 -04:00
Kevin Lau
b310eb00b9 Add Intimidate test for double-KOs 2015-07-19 16:54:55 -07:00
Guangcong Luo
0eb6f4b244 Merge pull request #2006 from ascriptmaster/move-fixes-2
Fix PP deduction interactions with Pressure
2015-07-17 13:40:19 -05:00
Kevin Lau
913704c3ac Release and update Pressure tests
Added a check for Harsh Sun/Water moves failing and deducting PP.

Spikes has 32 max PP. Correct relevant values in the code.
2015-07-17 01:47:58 -07:00
Guangcong Luo
3bde6c758b Merge pull request #2050 from ascriptmaster/tests
Fix Mold Breaker interaction with Damp
2015-07-16 16:36:43 -05:00
Konrad Borowski
c0b71f03b7 Show that weather began even under Air Lock effect 2015-07-16 16:12:47 +02:00
Kevin Lau
55f08be727 Add many Ability tests related to Mold Breaker 2015-07-15 14:48:57 -07:00
Kevin Lau
72b61b25d6 Update Intimidate test to ensure ability activation order
Re-do the activation test with the Pokemon switched to ensure that ability
activation was based on speed instead of player order.
2015-07-13 20:39:25 -07:00
Kevin Lau
604194e7d4 Normalize wording on tests related to Mold Breaker
The two most common wordings were "suppressed" and "bypassed". Out of the
two, "suppressed" was chosen to be used across all tests.
2015-07-12 03:27:11 -07:00
Kevin Lau
e991c70f4c Update Intimidate test to check activation order 2015-07-07 13:20:32 -07:00
Kevin Lau
3c33a363fa Add Intimidate test to check simultaneous switches 2015-07-07 00:15:10 -07:00
Kevin Lau
70c8ca45ff Fix behavior with Ability activation in double-KO scenarios
Add new function battle.insertQueue that inserts a decision into the
correct position in an already-sorted queue instead of re-sorting. Also,
to prevent code reuse, add new funciton battle.resolvePriority to deal
with shared code between battle.addQueue and battle.insertQueue.
2015-07-06 20:33:40 -07:00
Kevin Lau
f7f310831d Improve tests relating to item removal 2015-06-28 16:47:12 -07:00
Kevin Lau
51f2cd93ff Fix Color Change test wording 2015-06-27 00:42:21 -07:00
Kevin Lau
020c08d5d9 Add tests for Color Change, Relic Song, Thief 2015-06-27 00:40:16 -07:00
Ivo Julca
fc89d5f372 Test suite is now deterministic 2015-06-26 21:55:43 -05:00
Kevin Lau
d7b77a76a4 Mocha: Normalize oldgen descriptions for tests
Listing the generation number imitates the style used in PS! format names,
and is clearer on which generation it is than listing games from that gen
(so GSC -> Gen 2, etc)
2015-06-19 00:25:03 -07:00
Kevin Lau
9df3d0e42f Add Contrary tests for Mold Breaker and Belly Drum 2015-06-18 14:23:53 -07:00
Kevin Lau
ba35604c58 Add Sticky Hold and Knock Off tests 2015-06-17 15:39:32 -07:00