Commit Graph

237 Commits

Author SHA1 Message Date
Ivo Julca
a0601bdb73 Add MoveAborted event, to be run when move execution stops on BeforeMove 2016-11-25 15:23:52 -05:00
urkerab
74aa31dcf1 Use TryAddVolatile for confusion rather than a custom event (#2641) 2016-08-07 12:11:58 -04:00
urkerab
be0f9d3be2 Show ability activation when it causes an immunity (#2555)
- Also improve `trySetStatus` and `moveHit` implementations
2016-05-22 18:44:54 -04: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
541747ac85 Refactor move disabling
pokemon.disabledMoves no longer exists; disabled move information is
now all tracked in pokemon.moveset.
2016-02-19 19:41:55 -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
a68df7e062 NEXT: Buff Psycho Cut
Psycho Cut now has a base power of 90.

Affects Mega Medicham in OU, but that's balanced out by the HJK nerf.

Affects Mega Gallade in BL, but that's balanced out by the CC nerf.

Closes #2380
2016-01-18 22:21:07 -08:00
Guangcong Luo
9973460f08 NEXT: Unban Hoopa-Unbound 2016-01-17 23:37:59 -08:00
Kevin Lau
1772bf2103 Gen-NEXT: Buff Heatproof to be complete Fire/Burn immunity 2016-01-17 18:30:55 -08:00
Kevin Lau
944c68b59c Gen-NEXT: Apply Intrinsic Levitate to Rotom formes 2016-01-17 17:59:08 -08:00
Guangcong Luo
78ab44a6c5 NEXT: More Eggsketch, buff Spinda 2016-01-17 15:15:07 -08:00
Kevin Lau
512211337e Fix Gen-NEXT Team Validation Errors
- Unban the listed Mega Evolutions under the new tiering system
- Fix issues with modified abilities being treated as invalid
2016-01-03 04:33:13 -08: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
Konrad Borowski
b7051bf0c0 Make learnsets and Pokedex more readable 2016-01-01 00:11:49 +01:00
Guangcong Luo
ea2da5e621 Fix style error 2015-12-30 17:28:25 -05:00
Guangcong Luo
ffbccc2a20 NEXT updates
- Give priority to Heal Order and Defend Order
- Swarm negates Flying weaknesses for Flying-types
- Vespiquen gets Swarm
- Jump Kick now 100% accurate (it's not overpowered so it doesn't
  really need an exception)
2015-12-30 14:51:00 -06:00
Marty-D
235e470553 Merge pull request #2339 from ascriptmaster/trapping
Trapping refactor
2015-12-28 12:10:52 -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
2e83e276ef Fix minimum recoil damage properly
- Recoil damage is always minimum 1
- Gen 5 is the only exception: if the move dealt 0 damage, no recoil
occurs
2015-12-13 23:17:49 -05:00
Konrad Borowski
133595c70f Fix style issues in mods hidden by ESLint before 2015-12-10 23:14:32 +01:00
Ivo Julca
8619ba2022 Turn on strict mode globally for real 2015-11-08 15:38:15 -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
Kevin Lau
3bfce38ff7 Gen-NEXT: Update README.md
Improved the grammar on many parts of the README. Also, sorted the Pokemon
in the Intrinsic Levitate section and removed mention of released Hoopa.

Staying true to the Gen-NEXT OU banning philosophy, Hoopa-Unbound is now
banned. Landorus-I is now unbanned.

Removed ability modification in weather-setting abilities as they are no
longer needed.
2015-10-02 17:35:44 -07:00
Marty-D
02c7323fb8 Refactor breaking protection
- And fix Mat Block
2015-08-08 14:38:51 -04:00
Marty-D
50acd016a2 Fix breaking protection
This is mostly a band-aid.
TODO: Refactor breaking protection out of the protection moves
2015-08-05 23:22:51 -04:00
Kevin Lau
8b02203f48 NEXT: Aegislash in unbanned
It does not fit banning critieria at this moment, and the README was
giving contradictory information on the matter, so Zarel decided it should
be unbanned.
2015-08-03 12:11:06 -07:00
Kevin Lau
0bbd3650b7 Normalize ModifySpe calculations with the other Modify-Stat events
The current implementation of ModifyAtk, ModifyDef, etc. is to pass the
actual stat into the event, have event handlers run battle.chainModify(),
ModifySpe passes in a modifier variable, calls battle.chain(), and then
ends with battle.modify() using the modifier variable. The way chainModify
is implemented within the event system also means that it chains together
modifiers in the same manner and finishes with battle.modify(), meaning
that there is no need for ModifySpe to use battle.chain() and
battle.modify() manually.

This also fixes the effect of BattlePokemon#getStat on stats other than
speed.
2015-07-24 12:19:42 -07:00
Ivo Julca
40c4c91af6 Fix future move gem boost message 2015-07-19 12:21:14 -05:00
Ivo Julca
207cb41957 Remove indeterminacy from moves
Gen 1 Disable and Gen-NEXT Night Daze now use the battle RNG.
2015-07-16 12:03:12 -05:00
Kevin Lau
cbef63343a Fix OHKO moves' interaction with accuracy-changing abilities/effects
Add a new event ModifyAccuracy that affects all moves other than OHKO
moves and switched many event handlers that originally used the Accuracy
event to ModifyAccuracy instead.
2015-06-29 17:22:42 -07:00
Kevin Lau
5bde84fd6d Style Change: suppressAttackEvents -> suppressingAttackEvents
The new function name makes it clear that the function doesn't actually
suppress attack events, only checks if they would be suppressed.
2015-06-12 16:22:32 -07:00
Guangcong Luo
d46ada6777 Merge pull request #1934 from SolarisFox/patch-5
standardize "Pokémon" in .md files
2015-06-10 00:36:27 +00:00
Ivo Julca
26680768eb Properly handle failure of multitarget moves
- On failure, they will no longer trigger the `AfterMoveSecondarySelf` event. It was a common pattern to check for success on its handlers, so this removes some duplication.
- All failed moves will now run any set `MoveFail` single events.
- Life Orb will now harm the holder if a successful attack did 0 damage (e.g. False Swipe on a 1 HP target).
2015-06-09 19:31:11 -05:00
SolarisFox
7ed407dfd3 standardize "Pokémon" in .md files 2015-06-09 17:21:23 -07:00
Kevin Lau
114ab7e8d4 Gen-NEXT: Fix Intrinsic Levitate
An examination of the commit history seems to indicate that it was
intended to be bypassed by Mold Breaker variants, and not be affected
by Gastro Acid.
2015-06-09 13:43:30 -07:00
Marty-D
ad00529215 Fix Life Orb
- All attacking moves except OHKO moves now take recoil correctly
(except Bide... TODO)
- Thief effects stealing a Life Orb now take recoil correctly
2015-06-07 15:49:38 -04:00
Guangcong Luo
066b1d6828 Merge pull request #1865 from ascriptmaster/move-fixes
Battle refactor: No longer reset ignore in Battle#update
2015-05-27 01:11:34 +00:00
Guangcong Luo
590ebf9730 Merge pull request #1898 from ascriptmaster/tests
Un-hardcode Rock Head in favor of an onDamage handler
2015-05-26 01:25:06 +00:00
Kevin Lau
17724c59f0 Un-hardcode Rock Head in favor of an onDamage handler
Instead of having a hardcode in scripts.js that people needed to
reference, it seemed more intuitive to take advantage of the Damage
event instead, and have Rock Head negate damage within the event.

Fixed a bug in Gen-NEXT Rock Head exhibiting the same behavior that
was causing the original Rock Head + Mummy glitch.
2015-05-21 13:52:02 -07:00
Marty-D
0581a47431 Fix rampage-ending confusion message 2015-05-21 14:54:37 -04:00
Kevin Lau
12be51b262 Battle refactor: New functions ignoringItem() and ignoringAbility()
BattlePokemon#ignoringItem and BattlePokemon#ignoringAbility are
hardcodedto return true for any situation where pokemon.ignore['Item']
or pokemon.ignore['Ability'] respectively would have been true.
2015-05-18 19:17:41 -07:00
Kevin Lau
0ec4ff912a Battle Engine Refactor: Add a DisableMove event
The intention for this event is to remove the move disabling code away
from ModifyPokemon and to an event that can be run a fewer number of
times. Since the disabledMoves index is used to gray-out moves that cannot
be used, and not for any other purpose, there is no need for the related
code to be run at the ModifyPokemon timing, instead working better as a
once per turn event.
2015-05-04 21:17:00 -07:00
Kevin Lau
628b870b2f Move Refactor: Moves track the type effectiveness of the move
Set up moves to track the type effectiveness of the move for purposes of
'Hit' and 'ModifyDamage' events. This fixes various glitches resulting
from Pokemon with the 'IgnoreEffectiveness' flag set for some types, and
also is a slight optimization because it removes the need to run the
'Effectiveness' event one more time to check effectiveness in the moves.
2015-04-09 01:46:22 -07:00
Kevin Lau
2e56120ad9 Move refactor: affectedByImmunities -> ignoreImmunity
While move.affectedByImmunities was always a Boolean value to denote if
the move was affected by immunities, move.ignoreImmunity can be a Boolean
value if it ignores or is affected by all type immunities, but also can
act as an object such that !!move.ignoreImmunity[type] means it ignores
immunities of that type.
2015-04-08 00:17:12 -07:00
Marty-D
53fd95e442 Past Gens: Make sure moves inherit or have flags 2015-04-04 00:04:51 -04:00
The Immortal
7e9c1030ec Remove notSubBlocked move property
Use the authentic flag instead. Also combined the Infiltrator properties
into one.
2015-04-04 01:22:21 +04:00
Marty-D
815f9d8689 Remove thawsUser move property 2015-04-03 15:39:46 -04:00