Commit Graph

34 Commits

Author SHA1 Message Date
Guangcong Luo
5c8ddc6983 Refactor gen 2 fainting
Makes gen 2 use the modern fainting system.
2015-01-10 01:39:35 -05:00
Joimer
0b2ee6c36f Gens 1 & 2: Fix small bug with recoil and drain damage 2015-01-08 21:08:10 +01:00
Juanma Serrano
dc34e0e181 Gen 2: Don't run AfterSwitchInSelf on forced switch 2015-01-08 13:35:18 +01:00
Juanma Serrano
8f5327db76 Gens 1 & 2: Make sure AfterSwitchInSelf doesn't run after a faint 2015-01-08 13:25:31 +01:00
Juanma Serrano
f60a251f3d Gens 1 & 2: Make sure residuals are not executed after target faint 2015-01-08 11:03:58 +01:00
Joimer
618ece51c4 Gen 1: Proper residual checks 2015-01-03 20:11:36 +01:00
Joimer
d899e52da9 Gen 2: Fix residuals
Residuals on Gen 2 happen after you move and after you switch in willingly.
2015-01-03 19:06:02 +01:00
Joimer
641ca9efdb Fix possible crash in gen 2 2014-12-30 21:59:40 +01:00
Joimer
1e94609e88 Gens 1 & 2: Fix turn order
Since comparePriority is not on the Battle prototype and gen 1 and 2 mods reference it with this, it was not being used.
Side effect of 27be6a2a65
2014-12-29 22:49:42 +01:00
Marty-D
85bff32789 Gen II: Light Ball only doubles Pikachu's Sp. Atk 2014-12-29 16:26:29 -05:00
Marty-D
7977b2c3cd Fix unsuccessful two-turn moves
Previously, if an invulnerable move's second turn was prevented from
executing, the user would remain invulnerable until the end of the turn.
2014-12-29 14:08:25 -05:00
Joimer
27be6a2a65 Gen 2: Fix phazing moves
Commit 15a0c241f5 forgot to revert the changes on 6e30b6a9eb.
Now they are implemented properly.
2014-12-29 19:30:27 +01:00
Joimer
1aedf0ee71 Gens 1 & 2: Fix bug with substitute on <25% hp
An improper check caused damage on substitutes when the user had <=25%hp to be lowered.
2014-12-29 02:27:39 +01:00
Joimer
ef31e69c1e Gens 1 & 2: Refactor secondary status effects.
After a review of the disassembled code of gens 1 and 2, we've come to realise some very important stuff regarding secondary status.
On gens 1 and 2, Fire-types are not inherently immune to burn.
Ice-types are neither inherently immune to ice.
On gen 1, secondary status effects for paralyse, burn, and freeze will be ignored if the target Pokémon shares a type with the move-type.
On gen 2, the same happens but only for burn and freeze.
Poison-types are actually immune to poisons.
On gen 2, tri-attack can burn fire-types and freeze ice-types.
On gen 1, body slam cannot paralyse normal-types.
Also, Lick cannot paralyse ghost-types.
And thunderbolt/thunder can't paralyse electric-types.
2014-12-28 15:41:11 +01:00
Juanma Serrano
985232302e Gen 2: Proper interaction of critical hits and burn
Normal damage is calculated with boosts, screens, and burn.
If a critical hit happens, then:
Stat level modifications are ignored if they are neutral to or favour the defender.
Reflect and Light Screen defensive boosts are only ignored if stat level modifications were also ignored as a result thereof.
If the attacker is burned, stat level modifications are always ignored.
The attack drop from the burn is only applied when attacker's attack level is higher than defender's defense level (boost).

Therefor:
A critical hit will ignore defensive and offensive buffs/debuffs if the attacker and the defender have the same boost level or the defender has higher boost.
The boosts will be ignored if the attacker is burned, but if the attacker has more boost than the defender, burn reduction still applies.
Burn reduction won't apply on the first case, buffs being the same or defender having more.
2014-12-22 16:07:50 +01:00
Juanma Serrano
9280b5d9c8 Gen 2: Implement critical hit mechanics 2014-12-22 14:05:26 +01:00
Juanma Serrano
fb18d41885 Gen 2: Fix Baton Pass mons getting damaged by psn / leech seed
AfterMoveSelf does not happen if the move used was Baton Pass.
2014-12-22 13:23:04 +01:00
Juanma Serrano
412bf38d75 Gen 2: Fix AfterMoveSelf events
Leech seed, etc., must be activated just after the Pokémon moves and even if asleep or FP.
2014-12-22 13:23:04 +01:00
Juanma Serrano
3292d9a1c9 Gen 2: Refactor stat and damage calculation 2014-12-22 13:23:04 +01:00
Joimer
bcd970f30d Gens 1 and 2: Proper stat reduction calculation
This is huge since there's a change in -1 Snorlax's speed that is relevant to Gen 2.

See:
http://www.smogon.com/forums/threads/stat-reduction-bug.3520407/
https://github.com/iimarckus/pokered/blob/master/engine/battle/core.asm#L7856
https://github.com/kanzure/pokecrystal/blob/master/battle/effect_commands.asm#L6608
2014-12-21 21:27:08 +01:00
Joimer
482940a459 Gen 2: Remove unnecessary code 2014-12-21 20:55:35 +01:00
Slayer95
70ebbf1fd6 Pass target location to ´beforeTurnCallback´
This fixes Assurance sometimes failing to track damage dealt in the turn.
2014-05-03 16:32:51 -05:00
小太
5c8fc7b982 Space after function for anonymous functions 2014-04-22 01:58:16 +10:00
小太
6fb3bc332a Spaces around operators and === instead of == 2014-04-22 01:56:11 +10:00
Slayer95
3fc36ef80f 'clampIntRange is now a method of 'Tools' and no longer global 2014-04-18 15:14:54 -05:00
Ivo Julca
244f1700a0 Set old moves' categories on Gen 3 data load
This is only performed for Gen 3, as the data is passed down to older gens.
2014-02-14 18:47:20 -05:00
Ivo Julca
456883914b Gen 2 now inherits data from Gen 3
This fixes issues with a lot of moves, including but not limited to Acid, Beat Up, Bone Rush, Crunch, Dig, Extreme Speed, Fake Out, Future Sight, High Jump Kick, Hypnosis and Petal Dance.
2014-02-12 20:16:20 -05:00
Slayer95
9cd05b80a3 Specify basis for inheritance of mods needing it
Create scripts.js file for gen5bw in order to do so.
2013-11-03 16:39:06 -05:00
Joimer
6e30b6a9eb Gen 2: Fix phazing moves
In Gen 2,moves with negative priority work with negative speed.
It's the slower phazing move that will work first.
To achieve this, gen 2 runs its own compare priority and the functions
which use this one are edited so they use the custom compare priority.
2013-09-04 11:02:44 +02:00
小太
f2f973fe29 Obliterate trailing whitespace 2013-08-18 21:33:15 +10:00
Joimer
00a5f991fb Gen 2: Fix Light Screen and Reflect
Ater Light so they modify Def and SpD.
On critical hit, choose unmodified stat.
This also does half the work of crit mechanics.
2013-08-12 15:47:19 +02:00
Joimer
a9bc62149c Gen 2: Clean up scripts 2013-08-12 12:50:47 +02:00
Joimer
2190c8d6ec Gen 2: Fix bug on critical hit with debuff
If you have an attack debuff and get critical hit, turn crashes.
2013-08-10 18:10:58 +02:00
Joimer
a6b1bff6fb Gen 2: Add base files
Formats for its own validateSet, statuses, learnsets (from Veekun),
items, move changes, formats data for tiering, ability none,
and battle scripts.
2013-08-09 22:02:04 +02:00