Commit Graph

48 Commits

Author SHA1 Message Date
Ivo Julca
a14d1cc1f2 Add test for turn order for Mega Evos with Trace 2016-11-24 22:42:03 -05:00
Ivo Julca
632c04e6f1 Add failing tests for randbats generators 2016-11-20 00:24:28 -05:00
Ivo Julca
2bceebaac8 Test: Add coverage for random team generators 2016-11-19 16:11:50 -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
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
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
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
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
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
Konrad Borowski
81f602b8d8 Always use trailing comma for multiline objects 2016-01-01 00:20:07 +01:00
Kevin Lau
7c491ad06b Add test suites for trapping moves and abilities 2015-12-21 14:56:21 -08: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
Konrad Borowski
d9abb0eeb7 Poison/burn/leech seed don't increment residualdmg on start in Gen1
Previously moves like Leech Seed incremented residualdmg when used by 1,
but this doesn't actually happen in the game. Instead, an actual game
uses a flag to store toxic poisoning flag, and when it's not specified,
these statuses always dealt 1/16 of full HP.

This fixes the issue where the sequence of moves (Toxic followed by Leech
Seed) was dealing 1/16, 3/16, and 4/16 of full HP in residual damage,
instead of 1/16, 2/16, and 3/16.
2015-10-04 13:26:23 +02:00
Carl Sobolewski
4155771189 Test: Fire- and Water-related weathers modify damage correctly
These calculations would return 150 and 54 damage respectively prior to the
previous commit.
2015-09-13 03:23:01 -06:00
Ivo Julca
fc89d5f372 Test suite is now deterministic 2015-06-26 21:55:43 -05: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
Kevin Lau
6d76928ec3 Add Battle#on tests 2015-06-09 03:42:32 -07:00
Kevin Lau
26f88d2f89 Change weight tests to use the new event handlers 2015-06-09 03:42:27 -07:00
Kevin Lau
1f10dc1185 Add terrain tests, Arena Trap tests, Inverse Battle tests 2015-05-17 19:43:15 -07:00
Kevin Lau
dd80e38322 Upgrade tests
- Improve the wording on tests for status moves to be more clear
- Add a test for Stealth Rocks
2015-05-10 15:40:52 -07:00
Ivo Julca
245f9bd8ac Hackmons: add failing test for choice parsing when a pokémon knows Struggle 2015-04-26 17:36:06 -05:00
Kevin Lau
5976efea2b Add Mocha tests for status effects 2015-04-16 15:50:11 -07:00
Joimer
d46d5ca598 Properly add status immunity test
It must have its own case.
We must check Pokémon of a type with a status immunity are actually immune.
2015-04-15 01:24:58 +02:00
Joimer
7cec8b6831 Update statuses test
Test also Thunder Wave not paralysing a Ground-type
2015-04-15 00:29:07 +02:00
Kevin Lau
f26b3fd279 Add type immunity tests in Mocha 2015-04-08 23:00:12 -07:00
Kevin Lau
f60181ac91 Add Regression Tests for Weight-Based Abilities/Items/Moves 2015-03-18 18:39:01 -07:00
Ivo Julca
68aaa48974 Gulpfile: no files are exempt from style checks
- Streams are merged to make sure that all errors and warnings are reported.
- Adds dev dependencies: `merge-stream` and `lazypipe`.
- Tracks a fork of `gulp-jshint` to fix https://github.com/spalger/gulp-jshint/issues/88
2015-02-18 19:51:15 -05:00
Ivo Julca
5508777d97 Add first few battle simulation tests 2015-02-15 13:35:43 -05:00