Commit Graph

83 Commits

Author SHA1 Message Date
Ivo Julca
2604dd1939 Trim megaOrZ argument of BattleSide#chooseMove() 2016-11-27 00:23:19 -05:00
Ivo Julca
318ca6ae9f Fix Destiny Bond 2016-11-25 15:38:25 -05:00
Kevin Lau
7963c97894 Fix priority issues with Z-Moves (#2930) 2016-11-21 14:32:31 -05:00
Ivo Julca
cf35c0a8d7 Test: Fix Destiny Bond specification
It should fail deterministically every second time it's used.
2016-11-20 03:00:05 -05:00
Slayer95
a3e3249a8f Spectral Thief should zero boosts despite of target abilities (#2906) 2016-11-19 14:38:54 -05:00
Ivo Julca
a09c0110b8 Destiny Bond: Add tests for exclusive counter and a minimal implementation 2016-11-19 14:17:08 -05:00
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
1700067a77 Fix Judgment test 2016-11-18 15:14:27 -05:00
Ivo Julca
c2f8c72b38 Judgment should not change type from Z Crystals 2016-11-18 15:09:21 -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
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
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
Ivo Julca
f095ac4fea Implement Curse targetting glitch 2016-06-20 11:57:23 -05: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
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
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
Kevin Lau
ab64569717 Fix Focus Punch bugs
By setting a handler to listen for the Hit event, Pokemon will now lose
focus properly when attacked by multiple Pokemon or by Nature Power.
2016-01-27 16:15:50 -08:00
Guangcong Luo
99a6e73df0 Mostly fix Curse targeting
Curse now correctly updates what target it asks for when the user
changes type.

The only remaining targeting issue is when the user changes to
Ghost-type mid-turn in Doubles.
2016-01-12 15:16:23 -08:00
Guangcong Luo
331608da49 Fix Natural Cure message
In-game, you can see your opponent's pokemon represented as balls, with
statused pokemon being dark balls. Because of this, light balls are
clearly not statused, which allows you to know when a pokemon has
Natural Cure.

The only exception is in Doubles/Triples, where multiple pokemon that
are statused but could have Natural Cure switch out at the same time,
but not all of them have Natural Cure: it's not possible to know which
pokemon had Natural Cure.

This exception is now handled correctly.

Fixes #1452
2016-01-12 02:28:43 -08: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
The Immortal
d47c968ee6 Fix Magic Room interaction with Primals 2015-12-21 21:22:23 +04:00
Kevin Lau
64c8650713 Add tests for Trick Room and the TR Glitch 2015-12-09 15:52:21 -08:00
Ivo Julca
33386f79aa Test: increase time limit for redirection tests 2015-11-09 00:15:48 -05:00
Ivo Julca
04c64c143e Cleanup: remove several unused variables 2015-11-07 17:34:21 -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
Ivo Julca
b794d2ee09 Fix Travis CI build 2015-11-01 16:36:05 -05:00
Ivo Julca
e510d036fd Add tests for Curse targetting
Refs Zarel/Pokemon-Showdown-Client#354
2015-11-01 15:43:35 -05:00
Kevin Lau
9a7585c58e Add tests for Ice Ball/Rollout 2015-07-26 19:58:38 -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
4da92ae00c Upgrade Follow Me test to check for self-targetting moves 2015-07-17 01:48:01 -07:00
Kevin Lau
e5beaba7bf Upgrade Sky Drop test to check for Follow Me 2015-07-16 04:24:07 -07:00
Guangcong Luo
9d79f72418 Merge pull request #1999 from ascriptmaster/move-fixes
Fix Quash interaction with self-switching moves
2015-07-02 07:34:06 +00: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
dafbefe973 Fix Sky Drop test pointing at wrong generation
It should be Doubles Custom Game, not [Gen 5] Doubles Custom Game.
2015-06-26 19:07:47 -07:00
Kevin Lau
5403862e43 Fix random failure in Sky Drop test
In Doubles, if a decision is not specified, it tends to choose the first
move but the intended target can be wrong.
2015-06-26 18:59:43 -07:00
Kevin Lau
523ffe454b Add Sky Drop tests and pending Sky Drop glitch tests (for Gen 5) 2015-06-23 11:49:53 -07:00
Kevin Lau
d2eda4a375 Add Quash tests 2015-06-23 00:52:41 -07: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
85ee0961c1 Further upgrade status move tests
Steel-types are immune to the poison status in Gen 3+, so wrap it into the
"fail when the opposing Pokemon is immune to the status it sets" and set
up the poison-inflicting status test to check Generation 2.

Spin off Thunder Wave to its own test, and also create a test for Glare to
check its Generation 3 behavior as well.
2015-06-18 17:05:49 -07:00