Commit Graph

127 Commits

Author SHA1 Message Date
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
Kevin Lau
85ce000a41 Have Burn halve physical damage directly in Battle#getDamage 2015-04-20 12:55:27 -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
815f9d8689 Remove thawsUser move property 2015-04-03 15:39:46 -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
Ivo Julca
df427ad7b1 Fix indentation of a comment in statuses.js 2015-03-27 01:33:02 -05:00
Marty-D
3533a15976 Make sure some Abilities are properly suppressed 2015-03-19 13:43:41 -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
Kevin Lau
a3909337fd Fix Auras
They now use the accurate hex values. The old values were slightly off.
2015-02-18 21:14:42 -08:00
Kevin Lau
4884ec66ba Weather Refactor: Regular weathers don't activate w/ Primal Weather set
Moved all checks for primal weather into setWeather() instead of
hard-coding the check into every effect attempting to change the weather.

Also to prevent hardcoding, the check now runs on the event system, and
the primal weathers themselves deny regular weathers from being set.
2015-02-12 14:39:50 -08:00
The Immortal
ab1e90e478 Update BeforeMove priorities 2015-01-14 03:33:00 +04:00
Guangcong Luo
80704c272d Merge pull request #1298 from Slayer95/disabled-maybe
Hide moves disabled by Imprison or NEXT's Telepathy
2014-12-10 03:57:30 -06:00
Ivo Julca
1d95bfbda5 Fix remaining instances of Klutz being ineffective 2014-12-04 23:19:58 -05:00
Guangcong Luo
151b7ea61a Merge pull request #1334 from ascriptmaster/primal
Ability refactor - Abilities now receive End events properly
2014-12-03 16:43:29 -06:00
ascriptmaster
e79e64e3fc Ability Refactor: Abilities now listen for End events
Added functionality for setAbility to send End events to abilities.

Fixed bug with Mold Breaker negating all Battle#singleEvent ability calls,
even those that don't involve damage calculation.

Fixed Skill Swap to now use End and Start events in the right order:
send the End events, then change the abilities, then send Start events.
If the same ability is swapped, don't send End events (the game simply
re-activates the abilities in question)

Moved SwitchOut/Faint events from weather to ability so the weather
can interact properly with Cloud Nine or Air Lock.

Primal weathers persist if a Pokemon with the relevant ability is
on-field, even if the originator switches out.
2014-12-03 12:22:21 -08:00
Marty-D
db4d16fbd2 Prevent Delta Stream from affecting Stealth Rock. 2014-12-01 22:19:10 -05:00
Marty-D
73ea9f4ea9 Primal weather does not prevent Status moves. 2014-11-26 21:09:00 -05:00
ascriptmaster
54fd6f41d3 Updated most moves, items and abilities to not use -message tags
Some gen 1 moves like Dig/Fly, gen 4's Custap Berry, and everything in
NEXT is untouched for now.
2014-11-17 11:25:56 -08:00
Ivo Julca
d928b64221 Implement BattlePokemon#disableMove to support hiding information
- Changed data to use it anywhere moves get disabled.
2014-11-13 14:45:49 -05:00
Ivo Julca
ac671bcc99 Fix Stealth Rock in Inverse 2014-11-10 19:33:30 -05:00
ascriptmaster
213d9ef47f Fix Primordial Sea glitch 2014-10-30 15:12:35 -07:00
ascriptmaster
859cebf490 Implement Harsh Sun, Heavy Rain, Strong Winds
Abilities might not be 100% accurate to the gameplay yet.
2014-10-27 16:10:26 -07:00
Ivo Julca
727579ff89 Revamp effectiveness calculation
- Implement BattlePokemon#runEffectiveness, accounting for battle events.
- Refactor Tools#getEffectiveness accordingly.
- Remove Inverse mod. It's now implemented using the global event 'Effectiveness', and with a few changes in the base data for hazards and Arena Trap.
- NEXT: Fix Filter and Solid Rock not accounting for the special effects of Freeze Dry and Flying Press.
2014-10-27 03:46:32 -05:00
Guangcong Luo
dde363ca28 Fix style errors in recent pull requests 2014-09-30 17:00:43 -04:00
Guangcong Luo
2f93240bfb Merge pull request #1231 from Pikachuun/master
Future Moves Bug Fix (Issue 567)
2014-09-30 13:37:52 -07:00