Commit Graph

35 Commits

Author SHA1 Message Date
Guangcong Luo
fcccc2cff0 Rename Battle#on to Battle#onEvent
Battle will soon be a Node.js Stream, which has an .on() function,
which Battle#on would conflict with.

PS events aren't Node events, so naming a PS event function .on()
was kind of misleading anyway.
2017-05-05 16:48:38 -05:00
Guangcong Luo
df5d8b283e Fix mistakes in tests
So I've been working on a massive refactor to the choice system for,
like, over a week. It's still not done, but it's found some mistakes
in the tests that should be fixed.
2017-03-17 02:22:52 -05:00
Guangcong Luo
6611c9c9ed Fix Seed activation on double-Surge
Terrain seeds weren't activating correctly on the first Surge of two
Surge ability activations turn 1. This fixes it by allowing Update to
run on inactive Pokémon, allowing a Pokémon's item to activate onUpdate
before their own ability activation.
2017-02-14 22:14:15 -06:00
Ivo Julca
78972c41f0 Revert "Confusion still has a 50% self-hit chance"
This reverts commit 7d1ee5fecd.

There is even stronger evidence, from a trusted source, that the chance is now 1/3.
https://twitter.com/pokemon_PhD/status/788827888028151808
2016-12-06 23:50:07 -05:00
Ivo Julca
7d1ee5fecd Confusion still has a 50% self-hit chance
Hypothesis of chance=1/3 can be rejected at a 0.0005 significance level.
2016-11-27 19:11:58 -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
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
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
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
Guangcong Luo
82ed5e0d22 Fix Levitate Flying Ring Target interaction 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
Konrad Borowski
81f602b8d8 Always use trailing comma for multiline objects 2016-01-01 00:20:07 +01:00
urkerab
ba6dc7c5c0 Prevent IV values that represent half of a DV 2015-12-30 15:32:40 +00:00
Marty-D
bb7bfada94 Fix lingering issues from #2339 2015-12-28 15:09:32 -05:00
Kevin Lau
7c491ad06b Add test suites for trapping moves and abilities 2015-12-21 14:56:21 -08: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
Kevin Lau
f7f310831d Improve tests relating to item removal 2015-06-28 16:47:12 -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
ba1f5df45c Release and improve pending Iron Ball/Thousand Arrows tests
Some tests had incorrect program flow that was resulting in incorrect
expected behaviors.

Improved the wording on some test descriptions.

Gave some of the Pokemon Shell Armor to negate test failures due to
critical hit messages appearing before the type effectiveness messages.
2015-06-16 00:11:08 -07:00
Ivo Julca
21aebd070e Add pending tests for Iron Ball and Thousand Arrows 2015-06-15 04:48:15 -05:00
Kevin Lau
b8af0856f4 Add tests for type-immunity negating moves and items 2015-06-11 13:48:28 -07:00
Kevin Lau
b59c53f886 Add tests for Levitate, Magic Guard, Sturdy, Focus Sash 2015-06-09 03:09:01 -07:00
Kevin Lau
88827ff468 Fix hardcoded HP values for Mocha tests
Without the battle engine setting the HP EVs to 84, all HP values for
tests that involved set damage/healing were changed.
2015-05-29 11:32:21 -07:00
Kevin Lau
4fe6fb16f4 Add mocha tests for moves and items that disable move choices 2015-05-04 21:16:52 -07:00
Kevin Lau
7cb80c7937 Add Item Removal tests
Added tests for Unburden, Pickup, and Mail.
2015-02-25 19:13:33 -08:00
Guangcong Luo
f874040753 Merge pull request #1546 from xfix/gen2-leftovers
Leftovers heal after switching in in Gen2
2015-02-21 13:00:18 -06:00
Konrad Borowski
815909eff2 Don't skip residuals after fainting in Gen2.
The original code was wrong, as all it did was skipping residuals.
Skipping moves is handled by `faintMessages`.
2015-02-21 11:37:39 +01:00
Konrad Borowski
3446730787 Create Flame Orb test
Killing Focus Sash Magikarps with one attack is so amazing.
2015-02-20 12:15:42 +01:00
Ivo Julca
5508777d97 Add first few battle simulation tests 2015-02-15 13:35:43 -05:00