Commit Graph

428 Commits

Author SHA1 Message Date
Marty-D
f1a18767c1 Fix Sticky Hold interaction with Sticky Barb 2016-03-29 13:44:19 -04:00
Carl Sobolewski
30745356c8 Pickup: make -item message consistent with others
All other abilities use '[from] ability:'
2016-03-28 01:27:37 -06:00
Carl Sobolewski
c14aa7f018 Truant: Don't leak move information 2016-03-25 14:10:26 -06: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
Quite Quiet
79747aa8b4 Modify target sent when redirected 2016-03-15 09:21:56 +01:00
Marty-D
d4decbc30f Fix Fling and Gem interaction with stealing items 2016-03-02 09:24:26 -05:00
Marty-D
93356219c0 Fix Mountaineer 2016-02-24 19:57:15 -05: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
cc7ccd2efe Stop unnecessarily calling update()
pokemon.update() used to be called after pretty much everything, but
now that we've refactored pretty much everything out of it, it's no
longer necessary for most of the situations we call it for.

It currently only updates pokemon.speed, so I've renamed it updateSpeed
for clarity.

We now only update pokemon.speed on switch-in, right before the
residual event, and at the beginning of every turn. This gives
something like a 30% speed-up.
2016-02-17 01:07:22 -06:00
Guangcong Luo
4f6d064a36 Fix Synchronize message
Synchronize reveals itself on failure as well.
2016-02-16 01:08:55 -05:00
Guangcong Luo
6eb6c8be55 Fix ability activation for Flame Body etc 2016-02-15 19:48:19 -05:00
Kevin Lau
7a3a8bc255 Fix Secret Power interactions with various abilities
- Reverted 6603f97 (fixes interaction with Shield Dust)
- Moved Hit handler that changed the secondaries to ModifyMove for
  proper interaction with Serene Grace when terrains are present
- Add behavior in Parental Bond to prevent Secret Power from activating
  its secondary on the first hit
2016-02-15 10:39:43 -08: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
3659783a68 Update Bulletproof description 2016-02-08 09:30:30 -06:00
Marty-D
86e80c1d2c Animate Slow Start properly 2016-01-22 17:05:39 -05:00
Marty-D
79bea93431 Add Lightning Rod/Storm Drain redirection message 2016-01-13 18:25:45 -05: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
Marty-D
905fbc6e16 Fix Sticky Hold mechanics after fainting
Since Gen 5, the effects of Thief and Knock Off (among other things)
happen after the target has fainted, so it's possible to remove a
Pokemon with Sticky Hold's item at this point since Abilities don't
'exist' once inactive.
2016-01-07 22:03:39 -05:00
Marty-D
c980475553 Gen V, VI: Fix Heal Bell's interaction with Soundproof 2016-01-05 15:32:17 -05: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
Konrad Borowski
79a5b23f25 Modify data and mods files to follow style rules 2016-01-01 00:18:00 +01:00
The Immortal
d1538cfe8a Fix ability activation for primals
Abilities activate if it isn’t Drizzle on Kyogre and Drought on Groudon.
2015-12-29 01:20:07 +04:00
Guangcong Luo
2e7af97262 Fix Primal activation order 2015-12-28 12:16:32 -05:00
Kevin Lau
567b070cda Refactor trapping mechanics out of ModifyPokemon event
Trapping is now checked within Battle#nextTurn as a new TrapPokemon event.
All relevant abilities/items/moves have been adjusted to use it.
2015-12-21 14:56:22 -08:00
Marty-D
23bc05ea61 Add Stance Change animation 2015-12-07 16:48:37 -05:00
Guangcong Luo
2afd1ba636 Fix Mummy message 2015-12-05 02:06:12 -05:00
Guangcong Luo
7536a37dc5 Standardize ability-boost messages
Stat boosts/unboosts caused by abilities now send:

|-ability|POKEMON|ABILITY|boost
|-boost|etc
|-boost|etc
|-unboost|etc

Before, they were pretty inconsistent.
2015-12-05 02:04:01 -05:00
Marty-D
4d2eda1968 Fix Serene Grace's interaction with Secret Power 2015-11-26 11:45:04 -05:00
The Immortal
06fe3f1681 Revert 629f6f381a
Interacts badly with Arena Trap.
2015-11-18 22:22:34 +04:00
The Immortal
629f6f381a Add Levitate activation 2015-11-18 20:10:42 +04:00
Marty-D
81116929d4 Fix Intimidate message on substitutes 2015-11-17 11:06:28 -05:00
Marty-D
a8822423e8 Fix Gooey activation 2015-11-15 21:05:07 -05:00
Ivo Julca
8619ba2022 Turn on strict mode globally for real 2015-11-08 15:38:15 -05:00
Ivo Julca
38eb5d373d Lint: fix variable name collisions in data 2015-11-06 22:31:36 -05:00
Marty-D
5c5d442a40 Fix Dry Skin and Solar Power damage display 2015-10-21 16:28:44 -04:00
Marty-D
3d3938723e Improve support for Ability activation 2015-10-21 09:37:57 -04:00
Marty-D
48e4bc46f3 Apply more accurate modifiers in damage calculations 2015-10-18 21:03:37 -04:00
The Immortal
e2ef6ec36a Random Battle: Modify levels and Ability ratings
- Set Pokemon whose Ability is banned from UU at UU level
- Change weather Ability ratings, primarily to make sure Politoed
always gets Drizzle
2015-10-02 20:29:19 +04:00
Kevin Lau
002ea198f7 Add a source parameter to BattlePokemon#transformInto
This allows it to send a proper [from] tag to the client.
2015-09-14 17:08:27 -07:00
Kevin Lau
489fe131ce Add -ability tag to Imposter activation 2015-09-14 13:25:27 -07:00
Kevin Lau
79732b414e Shield Dust does not block self-boosting secondaries
Refactor TrySecondaryHit to become ModifySecondaries instead to allow for
proper behavior.
2015-09-03 03:10:16 -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
Marty-D
1b2e3d415a Fix Zen Mode removal upon fainting 2015-08-20 16:09:16 -04:00
Marty-D
1962a39f33 Merge pull request #2113 from ascriptmaster/move-fixes
Fix Zen Mode interaction with Skill Swap
2015-08-19 16:12:49 -04:00
Marty-D
cf77e666fa Fix race conditions with added flinch effects
- Sheer Force removes secondary effects before King's Rock/Razor Fang
adds the flinch effect to moves, which Serene Grace can then double
2015-08-15 00:09:41 -04:00
Kevin Lau
d629cf2da3 Fix Zen Mode interaction with Skill Swap
If two Zen Mode Pokemon Skill Swap each other, Zen Mode will end.
2015-08-14 18:02:36 -07:00
Marty-D
4743527d93 Fix Forewarn messages 2015-08-11 20:48:43 -04:00
The Immortal
7cd225b266 Update Mummy to use -activate 2015-08-10 06:38:02 +04:00