Commit Graph

250 Commits

Author SHA1 Message Date
Guangcong Luo
794d160eec Refactor runImmunity
BattlePokemon#runImmunity is now two functions, runImmunity and
runStatusImmunity.

The split is helpful because: 1. NegateImmunity only applies to type
immunities, and 2. Immunity only applies to status immunities and
Ground immunities.

Ground immunities are now entirely handled hardcoded in isGrounded.

This overall doesn't have a noticeable impact on performance, but
it makes certain things behave more predictably, and correctly
shows the ability activation for Levitate, so I assume that means it's
a net positive. I hope I at least improved readability...
2016-02-19 05:18:40 -06:00
The Immortal
02fc77eed2 Move primal reversion message to client 2016-02-08 21:18:20 +04:00
Marty-D
b7d3ce40e7 Add CAP 21: Crucibelle 2016-01-11 18:55:05 -05: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
Marty-D
edc2b8f98a Fix Jaboca and Rowap Berries' damage ordering
Corrects interactions with Bug Bite/Pluck/Knock Off, etc.
2015-12-28 17:40:30 -05:00
Guangcong Luo
2e7af97262 Fix Primal activation order 2015-12-28 12:16:32 -05:00
Marty-D
235e470553 Merge pull request #2339 from ascriptmaster/trapping
Trapping refactor
2015-12-28 12:10:52 -05:00
Marty-D
7d11d384f7 Restrict Ice Berry to Gen 2 games 2015-12-25 14:06:06 -05:00
Marty-D
8d2c022c14 Gen II: Remove now unneeded items.
And fix up the real Gen 2 items.
2015-12-24 12:36:57 -05:00
Guangcong Luo
02274e56be Add missed gen 2 item 'Dragon Scale' 2015-12-24 08:26:23 -06:00
Guangcong Luo
f351885781 Fix 'Energy Powder' item name for gen 6 2015-12-24 08:25:56 -06:00
Guangcong Luo
15caa435bd Add a default sprite for Berserk Gene
We're using Red Chain; probably the best option we have that was
already in our sprite sheet.
2015-12-24 04:37:16 -06:00
Guangcong Luo
8aa1409da7 Add Gen 2 only items
PS has a tradition of supporting future-gen items/moves/etc in past gens,
so why not the other way around? Obviously, these items are banned
outside of Custom Game.

This mainly helps make the teambuilder less confusing to gen 2 players.
2015-12-24 03:19:31 -06: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
6ecac2029d Fix Mental Herb always showing Attract's end message 2015-12-08 11:22:01 -05:00
Marty-D
091fffee59 Fix Air Balloon showing during Gravity 2015-11-20 12:19:34 -05:00
Ivo Julca
8619ba2022 Turn on strict mode globally for real 2015-11-08 15:38:15 -05:00
Ivo Julca
38eb5d373d Lint: fix variable name collisions in data 2015-11-06 22:31:36 -05:00
Ivo Julca
1a8c51e9a9 Consolidate Pokémon forme validation
- Introduces `battleOnly` to Pokémon formats-data to flag which formes are forbidden on battle start.
- Adds back Secret Sword as Keldeo-Resolute's required move.
- Introduces `requiredAbility` to handle Darmanitan-Zen.
- Introduces `forcedForme` to items' data to flag the formes that some items enforce.
2015-10-20 23:13:32 -05:00
Marty-D
48e4bc46f3 Apply more accurate modifiers in damage calculations 2015-10-18 21:03:37 -04:00
Marty-D
51fb5c8745 Fix Enigma Berry 2015-09-12 21:15:22 -04:00
Marty-D
ecda0f293d Correct Natural Gift base powers 2015-09-03 13:12:29 -04:00
Marty-D
cf77e666fa Fix race conditions with added flinch effects
- Sheer Force removes secondary effects before King's Rock/Razor Fang
adds the flinch effect to moves, which Serene Grace can then double
2015-08-15 00:09:41 -04:00
Marty-D
934f9a4b4d Fix Air Balloon's interaction with confusion damage 2015-08-12 16:04:15 -04:00
Guangcong Luo
89a8acae34 Small update to Endless Battle Clause 2015-08-07 09:05:49 -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
Guangcong Luo
5d3cd8263c More updates to Endless Battle Clause
- Gen 1 PP overflow makes a Pokemon stale
- Staleness warnings now specify the staleness source
- Half-staleness also warns, if another pokemon is already stale

Warning on half-staleness helps remind people who seem to think
they've beaten Endless Battle Clause after 5-ish turns, when it
takes 10-20 turns for some staleness verdics, especially if
there's a lot of switching going on.
2015-07-24 03:33:28 -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
Marty-D
d7ead997a5 Fix Ditto Transformed into Ditto gaining Metal/Quick Powder boosts 2015-07-17 21:57:09 -04:00
Marty-D
c8a63d4e53 Merge pull request #2012 from ascriptmaster/move-fixes-3
Fix OHKO moves' interaction with accuracy-changing abilities/effects
2015-07-01 11:05:00 -04:00
Marty-D
75d94ab935 Correct Mail and Zoom Lens' descriptions 2015-06-30 21:47:49 -04: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
a179b5c37c Clarify description of mostly useless Berries
...and Rare Bone
2015-06-27 16:54:49 -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
Marty-D
0fc6807d3a Fix Pledge moves' interaction with Gems 2015-06-13 12:24:01 -04:00
Marty-D
4f006f817d Disambiguate Kee and Maranga descriptions 2015-06-11 23:25:34 -04:00
Marty-D
ec06537531 Fix Kee and Maranga Berries
Who would have thought?
Bonus: Fixes Kee Berry's interaction with Knock Off
2015-06-11 13:25:51 -04: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
Ivo Julca
a231aa9690 Fix Life Orb harming the holder on multitarget moves' failure 2015-06-08 01:43:41 -05: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
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
Guangcong Luo
383af9eea1 Merge pull request #1858 from ascriptmaster/move-fixes-2
Fix Rage Powder's interaction with Safety Goggles
2015-05-05 05:39:29 +00:00
Kevin Lau
d287e86b46 Do not consume healing berry if healing is blocked
Fixes behavior between healing berries and Berry Juice with Heal Block.
2015-05-04 21:17:08 -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
23a8ebd8eb Fix Rage Powder's interaction with Safety Goggles
Safety Goggles was causing Rage Powder to fail.
2015-05-04 00:22:01 -07:00
Guangcong Luo
54947b665f Merge pull request #1728 from ascriptmaster/move-fixes
Move refactor: moves/items that ignore immunity/effectiveness
2015-04-14 17:05:22 +00:00
Ivo Julca
e6332ff424 Properly do b0e7711 2015-04-11 20:19:52 -05:00