Commit Graph

374 Commits

Author SHA1 Message Date
Marty-D
192ad88ef9 Fix remaining boost orders
- Magnetic Flux, Shift Gear, Weak Armor
2015-07-25 11:40:36 -04:00
Pikachuun
cf295251a1 Fix Flower Gift 2015-07-24 20:03:25 -04: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
Marty-D
112aa72378 Fix Parental Bond with spread moves having only one target 2015-07-24 12:37:53 -04:00
The Immortal
ea546bf8e4 Change Sturdy to use -ability
Relevant:
https://github.com/Zarel/Pokemon-Showdown-Client/commit/a2e9ed70bfa78c26
bfef41d871116455519af04c
2015-07-24 14:23:38 +04:00
Marty-D
21a7fcc8bc Fix Parental Bond interaction with two-turn moves 2015-07-22 22:04:06 -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
The Immortal
aa0525f724 Fix Intimidate activation message 2015-07-21 00:06:08 +04:00
Marty-D
fc1268da2e Fix Telepathy's interaction with Bide 2015-07-17 15:52:19 -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
Kevin Lau
be03f23c78 Replace TryWeather event with battle.suppressingWeather 2015-07-06 17:00:41 -07: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
fce231cc48 Various Item removal fixes
Knock Off no longer broadcasts the source so Arceus can knock off a Plate
from a non-Arceus, Genesect can knock off a Drive, etc. Updated Sticky
Hold to check for Knock Off specifically as a result.

TakeItem is no longer suppressed by Mold Breaker, fixing interaction with
Unburden. Updated Sticky Hold to check for Mold Breaker instead.

Items that prevent their own removal do not have that effect negated by
Klutz and other item-negating effects.

Thief and Covet can steal Mail.
2015-06-28 16:53:47 -07: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
Marty-D
081e288f57 Fix Pledge moves' interaction with redirection Abilities 2015-06-13 12:10:03 -04:00
The Immortal
3e3f2ad7cc Fix Color Change 2015-06-08 00:35:07 +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
b7aa629703 Merge pull request #1889 from ascriptmaster/move-fixes-2
Battle refactor: New function isGrounded(), bug fixes
2015-05-26 07:09:19 +00:00
Kevin Lau
61996d3f6e Battle refactor: New function isGrounded(), bug fixes
Added BattlePokemon#isGrounded to check for the grounded-ness of a
Pokemon. Also BattlePokemon#isSemiInvulnerable for whether a Pokemon is
in the first turn of a two-turn move that makes them semi-invulnerable.

Fixed Terrain bugs involving Pokemon in a semi-invulnerable state.

Changed OHKO move check to use BattlePokemon#isSemiInvulnerable, fixing a
graphical bug that would display an immunity message when a Pokemon
attempted an OHKO move on a higher-leveled Pokemon that was being held by
the effect of Sky Drop.

Fixed Misty Terrain bug that was causing Rest and the effect of Yawn to
put Pokemon to sleep.

Fixed Misty Terrain bug that was causing Yawn to fail.

Fixed Electric Terrain bug that was causing Yawn to succeed.
2015-05-21 16:54:44 -07: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
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
1209954765 Fix Sheer Force properly 2015-05-04 10:45:44 -04:00
Juanma Serrano
299213040d Fix Sheer Force
This adds the intended fix of bdd99e84d3 and fixes the problem that made all Sheer Force mons to ignore the AfterMoveSecondary event.
2015-05-04 12:15:09 +02:00
Guangcong Luo
2d3bfb1af7 Merge pull request #1855 from Rhythms88/air-lock-cloud-nine-fix
Fix Air Lock and Cloud Nine
2015-05-04 02:58:59 +00:00
Rhythms
a7b846f6e0 Fix Air Lock and Cloud Nine
Moved them from AnyModifyPokemon to AnySwitchIn based on information in
the <a href="https://github.com/Zarel/Pokemon-Showdown/issues/1789">Air
Lock and Cloud Nine Difficulties issue</a> from @gamut-was-taken
2015-05-03 17:03:31 -06:00
Marty-D
bdd99e84d3 Fix Sheer Force
- Sheer Force may not be user's Ability by the time `AfterMoveSecondary`
effects are checked
- Sheer Force boosted moves called by other moves now ignore
`AfterMoveSecondary` effects properly
2015-05-03 11:40:39 -04:00
Marty-D
a92e38547f Fix Rock Head
- Since Mummy exists, it is entirely possible not to have Rock Head by
the time recoil happens
2015-05-02 15:05:42 -04:00
Marty-D
c51bb399fe Fix Sturdy's OHKO immunity 2015-04-30 14:29:58 -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
de5faddf3f Add Sticky Hold message 2015-04-28 20:47:50 -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
Guangcong Luo
27f3ae2372 Merge pull request #1805 from ascriptmaster/move-fixes-2
Fix Flower Gift to properly use formeChange
2015-04-23 16:42:00 +00:00
Kevin Lau
0644ce40aa Fix Flower Gift to properly use formeChange 2015-04-22 15:59:25 -07:00
The Immortal
fb8c970540 Fix Sap Sipper bug
This fixes it activating on the user's Aromatherapy.
2015-04-19 14:56:43 +04:00
Kevin Lau
81be17cd3c Fix Wonder Guard's interaction with Iron Ball/Thousand Arrows 2015-04-11 00:43:56 -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
1a6e62ef7b Fix Pickpocket 2015-04-05 10:55:02 -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
a698ed2315 Ensure Toxic Spikes does not activate Synchronize 2015-04-03 12:19:11 -04:00
The Immortal
d4a22bb1e6 Remove isContact property from moves
Use flags instead.
2015-04-03 16:59:53 +04:00
Kevin Lau
4ca5d7a676 Send -end message when Flash Fire volatile disappears
Relevant for when the Pokemon with an active Flash Fire boost has its
ability changed or suppressed.
2015-03-31 16:18:07 -07:00
Kevin Lau
ca2aade9ec Change Slow Start to listen to End events 2015-03-31 11:51:25 -07:00
The Immortal
571c7653a4 Improve ability ratings 2015-03-29 16:01:00 +04:00
The Immortal
5949294b78 Use hasItem in Arena Trap 2015-03-29 04:00:51 +04:00
Kevin Lau
18b3a99423 Arena Trap Typo Fix 2015-03-28 03:02:02 -07:00
Kevin Lau
ab80397192 Refactor Unaware to use ModifyBoost
Cleans up the code quite a bit because it no longer needs the hardcoding
option that it was having.
2015-03-26 20:06:47 -07:00
The Immortal
3de23cb90a Use the reflectable flag for Magic Bounce/Coat 2015-03-24 02:42:04 +04:00