Commit Graph

151 Commits

Author SHA1 Message Date
Marty-D
a8413731dd Fix Choice-lock before attempting a move 2017-09-24 12:13:30 -04:00
urkerab
c28347edda Fix choice lock for the combined Pledge move (#3993) 2017-09-17 19:47:35 -04:00
urkerab
0ed87b755d Remove some ability effects to improve compatibility with Instruct (#3905) 2017-08-23 22:45:54 -07:00
Jacob McLemore
51eb475f34 Fix Unaware Confusion interaction (#3530) 2017-06-13 21:40:37 -05:00
Guangcong Luo
6dd58b40d3 Refactor simulator into new sim/ directory
This is a surprisingly minor refactor considering how many files it
touches, but most of this is only renames.

In terms of file renames:
- `tools.js` is now `sim/dex.js`
- `battle-engine.js` is now `sim/index.js` and its three classes are
  in `sim/battle.js`, `sim/side.js`, and `sim/pokemon.js`
- `prng.js` is now `sim/prng.js`

In terms of variable renames:
- `Tools` is now `Dex`
- `BattleEngine` is now `Sim`
- `BattleEngine.Battle` is now `Sim.Battle`
- `BattleEngine.BattleSide` is now `Sim.Side`
- `BattleEngine.BattlePokemon` is now `Sim.Pokemon`
2017-05-05 16:48:38 -05:00
Marty-D
0789cdb4b3 Fix Struggle while Choice-locked 2017-03-07 10:37:37 -05:00
Marty-D
7f96110699 Update Choice-lock mechanics
Presumably because of Dancer's existence, attempting to use another move
besides the Choice-locked move now results in the move being used but
failing immediately, with no PP loss. This applies even during Magic
Room, etc.
2017-03-04 16:23:55 -05:00
Marty-D
3c9d6c2687 Correct crit ratio boosting Z-Effect 2016-12-18 11:06:55 -05:00
urkerab
c1829acf64 Z-Memento and Z-Parting Shot should tell the client about the Z-power (#3029) 2016-12-16 18:23:54 -08: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
urkerab
3046638c30 Remove line left over from Destiny Bond fix (#2953) 2016-11-26 17:20:39 -05:00
urkerab
a580d7706f Add various Z-move messages (#2947) 2016-11-25 20:24:35 -05:00
Ivo Julca
318ca6ae9f Fix Destiny Bond 2016-11-25 15:38:25 -05:00
Ivo Julca
a0601bdb73 Add MoveAborted event, to be run when move execution stops on BeforeMove 2016-11-25 15:23:52 -05:00
Ivo Julca
a09c0110b8 Destiny Bond: Add tests for exclusive counter and a minimal implementation 2016-11-19 14:17:08 -05:00
Guangcong Luo
8f7d189838 Implement Z-moves 2016-11-18 02:44:29 -05:00
Marty-D
ceca7aaa2d Implement Silvally's type changing
Plus add support for Z-Crystals working with Multitype and Fling powers
with Memories.
2016-11-17 11:06:13 -06:00
Marty-D
18270f72c4 Add burn damage change 2016-11-17 11:06:12 -06:00
Marty-D
52184167b7 Implement new moves 2016-11-17 11:06:12 -06:00
Marty-D
83acbc578d Add preliminary Gen 7 changes 2016-11-17 11:06:12 -06:00
urkerab
74aa31dcf1 Use TryAddVolatile for confusion rather than a custom event (#2641) 2016-08-07 12:11:58 -04:00
Marty-D
98667e8dd5 Correct Wonder Guard message
- Also remove its very unnecessary reimplementation in `futuremove`
2016-06-23 14:34:50 -04:00
Marty-D
5ec02741ff Fix partial-trapping persistence
- Previously, the user could switch out and come back in during the same
turn and have the effect continue.
2016-06-12 14:52:38 -04:00
Guangcong Luo
6eb6c8be55 Fix ability activation for Flame Body etc 2016-02-15 19:48:19 -05:00
Marty-D
b38b43c37e Make sure partial trapping does not happen if the user is inactive 2016-01-08 15:44:33 -05: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
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
82f63b04e3 Fix Infiltrator's interaction with Doom Desire/Future Sight
And correct the Wonder Guard gen check
2015-12-16 12:54:02 -05:00
Guangcong Luo
39281f6995 Fix many bugs in Doom Desire/Future Sight
- Doom Desire/Future Sight now calculate accuracy when hit, not when
  the move is used
- Doom Desire/Future Sight are now limit 1 per defender slot, not 1
  per attacker slot
- Doom Desire/Future Sight in gen 4 and earlier now have their damage
  calculated on use, rather than on hit
- Doom Desire/Future Sight in gen 4 and earlier now deal typeless
  damage, and are not subject to STAB, weakness, resistance, or
  immunity
- Doom Desire/Future Sight in gen 4 and earlier now can't critical
  hit
- Doom Desire is now Physical in gen 3
2015-12-02 00:38:30 -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
Marty-D
05997e3bde Update weather Ability activation 2015-10-25 15:43:42 -04:00
Carl Sobolewski
f1146dcac6 Weather modifies baseDamage instead of basePower
http://git.io/vZKFp
2015-09-13 02:43:39 -06: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
Guangcong Luo
c8c03ad92d Update Endless Battle Clause
The full description is in the comments of the Endless Battle
Clause entry in rulesets.js.

This update fixes a lot of the issues with yesterday's version.

Also included: A minor refactor of deductPP, which did not need
a success variable.
2015-07-22 03:41:43 -04:00
Guangcong Luo
9bf3517f2e Implement New Endless Battle Clause
The new Endless Battle Clause attempts to ban endless battles by
detecting situations in which a battle could become endless.

This approach bans endless battles without banning Leppacycling.

The exact formulation is:

A Pokémon is considered cornered if:

- it has no available moves other than Struggle
- OR a stale Pokémon used Assist Whirlwind on it
- OR it has been hit by a Struggle from a stale Pokémon on the turn
  it switched in

(at the beginning of a turn, if you have available moves other than
Struggle, you are no longer cornered)

A Pokémon is considered stale if:

- it has gained a Leppa berry through any means besides starting
  with one (including but not limited to Harvest, Recycle, Pickup,
  Symbiosis, Bestow, Thief, Switcheroo, and Magician)
- OR it has been targeted with Fling Leppa Berry
- OR it is cornered and begins a turn with more HP than it the last
  turn it began
- OR it is cornered and begins a turn with as much HP as the last
  turn it began, and was not fully paralyzed, loafing around from
  Truant, or immobilized from Attract
- OR it uses Transform/Imposter against a stale Pokémon

(a Pokémon that becomes stale stays stale for the rest of the match)

If all active Pokémon are stale, the player whose team originally
started with a Leppa Berry loses. If both or neither team started
with a Leppa Berry, the team that had the first stale Pokémon wins.
2015-07-21 06:38:22 -04:00
Marty-D
3f997d71dd Ensure confusion damage does not break Illusion 2015-06-06 23:43:21 -04:00
Guangcong Luo
e656c83fbc Fix Focus Sash and Confusion interaction 2015-06-06 17:56:39 -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
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
Marty-D
5d0beee8ac Fix partial trapping end messages 2015-05-18 15:08:52 -04: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
Marty-D
d80f788f97 Fix Must recharge tag appearing when unneeded 2015-05-01 16:49:33 -04:00
Guangcong Luo
f8032a9a19 Merge pull request #1830 from ascriptmaster/move-fixes
Standard Weather always fails to activate when Primal Weather is active
2015-04-30 07:10:09 +00:00
Marty-D
d2a66b597f Fix Shaymin Sky reversion on freeze
freezing a Shaymin-S transformed into something else -> no change; no
change when it comes back in frozen
freezing a Shaymin-S transformed into Shaymin-S -> reverts to Shaymin
freezing a Shaymin transformed into Shaymin-S -> reverts to Shaymin
freezing a Ditto transformed into Shaymin-S -> no change
freezing a Shaymin-S holding Aspear or Lum -> reverts to Shaymin, then
defrosts
2015-04-29 23:31:20 -04:00
Kevin Lau
a99b5d5c51 Standard Weather always fails to activate when Primal Weather is active
Old implementation allowed Pokemon to use a standard weather move like
Rain Dance successfully against a primal weather like Harsh Sun if a
Pokemon with Cloud Nine or Air Lock was active.
2015-04-26 18:19:06 -07:00
DanUgore
6023cbd9ca Correct e04901adb3 2015-04-25 03:51:30 -04:00
DanUgore
e04901adb3 Update Protect Mechanics
Counter maxes out at 3^6.
2015-04-25 03:28:35 -04:00