Commit Graph

176 Commits

Author SHA1 Message Date
Marty-D
aadef53c75 Gen IV: Fix Leaf Guard 2015-07-24 21:23:12 -04:00
Marty-D
94e4027505 Gen IV: Fix Flower Gift 2015-07-24 21:21:51 -04: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
f1ae041707 Fix Endeavor showing two failure messages 2015-07-17 21:31:28 -04:00
Kevin Lau
b0e1fd5789 Fix Pressure's interaction with multi-target moves and Follow Me
Implement new function getMoveTargets to list all move targets given a
user and a move. Refactor Battle system to remove redundancies with
checking move targets. Run the RedirectTarget in this function instead of
later after TryMove, since technically single-target moves changing
targets should occur before the move is attempted.

Refactor the DeductPP event to be a singleEvent that targets the Pokemon's
ability instead of a global event. Run this event on the move's targets as
calculated by BattlePokemon#getMoveTargets.
2015-07-17 01:47:55 -07:00
The Immortal
96af9c6625 Past gens: Add Munchlax event
Forgot to do this in c7cc620527.
2015-07-14 01:00:02 +04:00
Guangcong Luo
803c202c5f Actually fix gen 4 Custap 2015-07-12 15:14:59 -04:00
Guangcong Luo
a226bec668 Fix gen 4 Custap 2015-07-12 04:27:18 -04:00
Guangcong Luo
2ea5907f65 Refactor battle turn order
Instead of automatically sorting the queue, the queue is now only
sorted manually when committing decisions.
2015-07-11 18:10:11 -04:00
Marty-D
0739d7eea5 Gen III, IV: Fix Taunt 2015-07-05 13:40:30 -04:00
Marty-D
d32b69f48d Fix Attract end messages 2015-06-25 12:29:30 -04:00
Kevin Lau
903853d91b Battle refactor: No longer reset negated immunity in pokemon.update()
Replace the pokemon.negateImmunity object with a new `NegateImmunity`
event that handles all the immunity negation.

Also deprecate 'IgnoreEffectiveness' in favor of having relevant moves
and items use `Effectiveness` event handlers instead.
2015-06-16 00:02:06 -07:00
Kevin Lau
2aba40b8ad Gen 4 and below Pressure affects allies 2015-06-15 16:30:19 -07:00
Marty-D
29e56b1043 Fix confusion timing after rampage moves
- Gen 1, 2, 5, and 6 cause confusion immediately after the move on the
last turn
- Gen 3 and 4 cause confusion at the end of the turn on the last turn
2015-06-04 09:55:30 -04:00
Marty-D
aab6d24bb2 Correct a few "events" from Pokémon XD 2015-05-29 14:27:00 -04:00
Marty-D
4749def28b Add Johto starter prizes from Pokémon XD 2015-05-29 11:58:59 -04:00
SolarisFox
29b961ff69 Style fix: indexOf() comparisons 2015-05-18 15:55:57 -07:00
Marty-D
e76c220fae Gen IV: Fix Sleep Talk while locked
- In Gen 3 and 4, Sleep Talk always fails when the move is forced to be
used
2015-05-09 13:16:52 -04:00
Marty-D
787a8ba53f Gen IV: Fix Lunar Dance 2015-05-09 13:12:26 -04:00
Marty-D
7edad419f3 Gen II-IV: Correct moves that cannot be encored 2015-05-06 13:19:44 -04:00
Kevin Lau
b06b5513b6 Fix Generation 4 Heal Block
Heal Block only blocked the HP recovery from draining moves and Leech Seed
in Generation 4.
2015-05-04 21:17:04 -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
Marty-D
c51bb399fe Fix Sturdy's OHKO immunity 2015-04-30 14:29:58 -04:00
Marty-D
48ec829055 Past Gens: Fix Struggle properly
- Gen 4 and earlier announce a Pokemon has no moves left before the turn
begins, and only to that player's side (even multiple times in Doubles
if the first action is cancelled)
2015-04-22 17:00:13 -04:00
Marty-D
2bf1de826f Gen IV: Fix Roar/Whirlwind against Protect 2015-04-09 17:19:30 -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
The Immortal
70c780f96a Remove isNotProtectable move property
Use flags instead.
2015-04-03 22:07:50 +04:00
Marty-D
a698ed2315 Ensure Toxic Spikes does not activate Synchronize 2015-04-03 12:19:11 -04:00
Marty-D
3742d84f34 Fix thaw mechanics in all gens
- Gen 5-6: Thaw check is skipped when using a self-thaw move
- Gen 3-4: Thaw check happens before a move is used
- Gen 2: Self-thawing does not happen if the move misses
2015-04-03 09:42:08 -04:00
Marty-D
70e465157c Merge pull request #1656 from ascriptmaster/oldgens
Generation 4: Fix Transform's interaction with items
2015-03-26 18:23:59 -04:00
Kevin Lau
47ea3b5f32 Refactor ModifyBoost to use objects
This allows ModifyBoost handlers to check the stat names properly.
2015-03-26 13:00:49 -07:00
Kevin Lau
403f58bd7e Generation 4: Reject Griseous Orb on any non-Giratina Pokemon
Griseous Orb cannot be held by any Pokemon other than Giratina in
Generation 4 games (to preserve reverse compatability with Pokemon
Diamond and Pearl)
2015-03-24 22:11:24 -07:00
Kevin Lau
5cbda47358 Generation 3-4: Species-specific items check current species
This means that Pokemon Transformed into other Pokemon will be treated as
the target species for the purpose of items like Thick Club.
2015-03-24 19:59:28 -07:00
The Immortal
6659a2c325 Add gen 4 Magic Coat 2015-03-25 03:40:53 +04:00
The Immortal
bf3898273e Fix Mirror Move mechanics for gens 3 and 4
lastAttackedBy is now reset if the attacker is no longer active.

Note: Mirror Move has extremely complicated mechanics and this does not
implement it completely but does as much as possible.
2015-03-25 03:25:48 +04:00
The Immortal
3de23cb90a Use the reflectable flag for Magic Bounce/Coat 2015-03-24 02:42:04 +04:00
Marty-D
3533a15976 Make sure some Abilities are properly suppressed 2015-03-19 13:43:41 -04:00
The Immortal
b527192431 Update Snatch to use flags 2015-03-16 22:42:24 +04:00
Juanma Serrano
e41db19062 Gen 3: Implement properly future-hit moves
This fixes the problem of future moves getting STAB and effectiveness.
Relevant commits: fb6a75e3a3 and a057a77970
2015-03-16 13:56:58 +01:00
Guangcong Luo
670a04dede Merge pull request #1625 from ascriptmaster/move-fixes
Generation 4: Fix Simple
2015-03-14 14:38:31 -05:00
Kevin Lau
d36297d491 Generation 4: Fix Simple to use proper DPP mechanics
In Generation 4, Simple did not double stat boosts as they changed.
Instead, it treated each stat boost as if it had twice the effect.
Reimplemented the deprecated ModifyBoost event, but with slightly
different functionality as before; it now modifies the live boosts so that
they work properly with Simple.
2015-03-13 18:02:33 -07:00
Kevin Lau
ab8cdf8147 Generation 3-4: Actually fix Lightning Rod/Storm Drain
Accidentally removed Gen 3's implementation, so it is reverted.

Set Gen 4 to inherit the redirection from Gen 5+.
2015-03-13 17:58:18 -07:00
Kevin Lau
d9c6573a79 Generation 3-4: Fix Lightning Rod/Storm Drain
They don't provide immunity or boosts in these Generations.
2015-03-13 01:06:57 -07:00
Marty-D
2f9fb283fa Gen III, IV: Fix Focus Punch
- Loses PP even if the user was hit
2015-03-03 12:59:07 -05:00
Marty-D
6ebb25d142 Gen II, IV: Fix (Hi) Jump Kick crash damage
Gen 2: 1/8 potential damage, not capped; no damage if target is immune
Gen 4: damage is 1/2 target's max HP if it is immune
2015-02-24 10:06:32 -05: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
Kevin Lau
f5c12a60a1 Fix Anger Point's Interaction with Mold Breaker
Moved Anger Point's check for critical from onCritical to onAfterDamage.
This not only allows it to avoid being suppressed by Mold Breaker, it
also results in the Anger Point message being displayed in the correct
order with respect to the other messages.
2015-02-08 13:16:18 -08:00
Marty-D
cb5333a025 Fix Fake Out and Sucker Punch VS protection moves 2015-01-29 21:08:30 -05:00