Commit Graph

321 Commits

Author SHA1 Message Date
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
Ivo Julca
db4eec3e2a Fix support for Node 0.12
Update the detection of legacy engines, as Node 0.12 has native Map support enabled by default
2015-05-21 18:10:56 -05:00
Guangcong Luo
ae89d74e75 Merge pull request #1896 from ascriptmaster/protocol
Add -center message type for Triples Automatic Center
2015-05-21 07:27:19 +00:00
Kevin Lau
f40506d133 Add -center for Triples Automatic Center
It's a single exception to the rule that -message be used for rule clauses
or custom metagames.
2015-05-20 23:11:45 -07:00
Ivo Julca
723f4b5a4b Fix support for Node 0.10-0.12
Some child processes now use ES6 methods, so we got to make sure they are available with `es6-shim`
2015-05-21 01:07:08 -05: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
SolarisFox
29b961ff69 Style fix: indexOf() comparisons 2015-05-18 15:55:57 -07:00
Marty-D
d58ddc671b Make Abilities inactive if the Pokemon is
- Since Gen 5, Abilities have no effect when the Pokemon is not on the
field (which is why Aromatherapy and Heal Bell can cure inactive Sap
Sipper and Soundproof Pokemon, respectively, among other things)
2015-05-16 20:33:51 -04:00
Juanma Serrano
14cc0ce5fb Gen 1: Refactor stat calculation
In order to emulate Gen 1 perfectly and to let the metagame adapt to the correct mechanics, stat calculation has been refactored.
Burn and Paralyse drop are applied whenever a Pokémon switches in with the status.
Also whenever a Pokémon gets a stat boost, if the Pokémon whose turn is not has the status.
Stat boosts recalculate that stat, minus burn and para drops (that's why Agility ignores para drop and Rest keeps drops).
Additionally, Reflect and Light Screen are only calculated in damage calculation.

Part of this code has been added to battle-engine.js with a gen === 1 conditional to avoid a ton of code repetition that would have been necessary otherwise.
Keep in mind that .modifiedStats for a BattlePokemon and the modifyStat function must only be available for gen 1 games.
2015-05-12 17:58:00 +02:00
Ivo Julca
18e3eeb1bc Make sure that pokemon have a disabledMoves property
Battle interruptions would prevent its initialization at `nextTurn`
2015-05-08 20:55:52 -05:00
Marty-D
e18ae9aaf7 Gen II: Sandstorm fails during effect 2015-05-07 14:26:11 -04:00
Guangcong Luo
4f708b1240 Merge pull request #1849 from ascriptmaster/move-fixes
Refactor disabling moves, other miscellaneous bug fixes
2015-05-05 05:36:06 +00: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
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
c53d022e4b Fix OHKO moves
- Fix Gen 1/Stadium's accuracy and immunity order
- Fix OHKO moves ignoring Phantom Force
- Add OHKO messages
2015-04-30 13:06:45 -04:00
Ivo Julca
b46cbb46ad Remove BattlePokemon#getValidMoves
As of f33909e9, this method is no longer called anywhere.
2015-04-26 17:36:51 -05:00
Ivo Julca
54c8c8a0ad Hackmons: fix decisions being overriden when Struggle is in the first slot 2015-04-26 17:36:36 -05:00
Ivo Julca
16e8c4bc33 BattlePokemon#getMoves now returns an empty array for no moves
It's a needed distinction to fix Struggle when hacked into a moveset
2015-04-26 02:50:14 -05:00
Ivo Julca
c2e1710b40 Remove superfluous instructions in team order parsing 2015-04-26 02:45:12 -05:00
Ivo Julca
c398e051d6 Fix modding of getDetails and getHealth 2015-04-26 01:52:54 -05: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
Guangcong Luo
dc9ba97551 Merge pull request #1790 from ascriptmaster/move-fixes
Have Burn calculate directly in getDamage
2015-04-21 19:30:42 +00:00
Kevin Lau
85ce000a41 Have Burn halve physical damage directly in Battle#getDamage 2015-04-20 12:55:27 -07:00
Konrad Borowski
beb09c806e Allow level 9999 Pokemon in battles
b922ae2f introduced possibility of using Pokemon over level 1000 in
custom battles. However, this doesn't work in practice, because battle
engine limits level to 1000. This commit fixes what b922ae2f should have
done all along.
2015-04-18 13:18:46 +02:00
Guangcong Luo
85971075e2 Fix possible crash in battle-engine
I still have no clue how this happens, but this will crashlog
enough data to pin it down if it happens again.
2015-04-17 00:35:02 -04: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
Marty-D
02e5dc6b9f Fix Transformed PP 2015-04-09 12:33:49 -04: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
Marty-D
c3fcc834b8 Fix Struggle
- No longer leaks information that the opponent has no moves left
whether or not they actually attack with Struggle
- Now shows the correct recoil message
- Gen 3 and earlier now have the correct accuracy
2015-04-08 23:43:39 -04: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
The Immortal
cb843b097a Fix crash in AfterDamage 2015-04-03 17:31:02 +04:00
Juanma Serrano
cf1785cb83 Update Final Destination
Proper wording for clause.
Critical hits are removed, they are uncompetitive.
2015-04-01 10:23:26 +02:00
Kevin Lau
94734a837c Fix ModifyBoost in calculateStat
It doesn't use the Pokemon's boosts.
2015-03-27 21:02:40 -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
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
52d5721471 Generation 4: Multitype prevents the removal of any item from Arceus 2015-03-24 22:11:23 -07: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
Ivo Julca
dbf3993a64 Improve validation of team order decisions
- Split it off from `runDecision` to `parseChoice`
- Internally, `decision.team` is now an array of zero-based positions.
- Guard against slot duplicates.
2015-03-23 14:37:06 -05:00
Ivo Julca
cedc60c7fc Fix fallback for switch-in requests 2015-03-22 15:55:02 -05:00
Guangcong Luo
d89a77ac87 Merge pull request #1639 from ascriptmaster/modifypokemon
Weight Refactor: Do not modify weight in ModifyPokemon
2015-03-21 22:38:43 -05:00
Kevin Lau
2eebf29d92 Generation 4: Fix Transform's interaction with item-based forme changes
Causes Dittos transforming into Giratina-O without Griseous Orb to revert
to Giratina-A in Generation 4, etc.
2015-03-21 19:05:42 -07:00
Marty-D
ed074532c6 Make sure the flags object always exists 2015-03-21 14:29:07 -04:00
The Immortal
7e6d18a93e Change triples comment again 2015-03-21 19:25:25 +04:00
The Immortal
0affd4ee8d Change triples comment 2015-03-21 15:37:21 +04:00
Guangcong Luo
9c4a376d2c Support onAny for side conditions
This improves the battle engine by adding support for onAny in side
conditions.
2015-03-20 17:28:45 -04:00
Kevin Lau
b0c2dcde5f Weight Refactor: Do not modify weight in ModifyPokemon
Added a new event, ModifyWeight, to deal with weight changes from items,
abilities, and moves. Add a function getWeight to call the event and
return a Pokemon's current weight.
2015-03-18 18:44:01 -07:00
DanUgore
848992001e RNG: Use Gen 6 Damage Roll Calculation 2015-03-18 03:16:32 -04:00