Commit Graph

57 Commits

Author SHA1 Message Date
Marty-D
0e2606b9b9 Fix failure message showing for self effects 2015-05-20 10:45:17 -04:00
Marty-D
c1a1ce85df Fix failure message showing for secondary effects 2015-05-19 15:49:45 -04:00
Juanma Serrano
4f246f7032 Gen 2: Remove unused code
All this code was done before the main battle-engine was reworked to have exceptions for past gens.
Furthermore, due to how inheritance works, it was messing up team preview in Stadium formats.
All what was dealt with this code is now dealt with in battle-engine.js and all future gen 2 exceptions should be there.
2015-05-12 09:50:56 +02: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
Kevin Lau
b6808d4476 Fix ignoreImmunity crashes in earlier gens
Unlike battle-engine.js, old gens did not check if move.ignoreImmunity was
undefined/false in their getDamage functions, causing crashes when numbers
were passed in to the function.
2015-04-14 15:22:06 -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
Kevin Lau
b894bbfec9 Gen 2 Random Battle: Fix Move Rejection Phase
hasMove was not tracking moves properly, instead only tracking new moves
added in the object instead of its entire moveset. Also, there was a
line of code that caused all moves to be flagged as rejected.
2015-04-12 13:59:21 -07:00
Juanma Serrano
7181ded437 Gen 2 RandBat: Update set maker slightly 2015-04-10 13:21:41 +02:00
Juanma Serrano
08aefc3535 Gen 2 RandBat: Fix issue with HP and 3-move movesets 2015-04-10 13:16:10 +02: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
Juanma Serrano
b718c8605d Update Gen 2 RandBat generator
Make several changes to team and set maker.
Fix bad choice of moves.
2015-03-31 17:49:21 +02:00
Juanma Serrano
1dd546b078 Gen 2 RandBats: Fix typos 2015-03-31 16:28:42 +02:00
Juanma Serrano
05d6cdc448 Gen 2 RandBats: Use sampleNoReplace to get moves 2015-03-31 14:48:59 +02:00
Juanma Serrano
11f328b1fe Gen 2 RandBats: Check for sets with two Hidden Powers 2015-03-31 13:46:12 +02:00
Juanma Serrano
ccaf250776 Gen 2 RandBats: Improve the set maker
Move the check for HP id and add level 99 for some shitmons
2015-03-31 13:01:50 +02:00
Juanma Serrano
d03d055ef8 Gen 2: Implement Random Battles
Implement Gen 2 Random Battles as a challenge option.
This format is not going to have a ladder anytime soon.
This format is going to help ironing out Gen 2 mechanics.
The current team and set makers are pretty much basic, they are to be improved with player input over the time.
Right now it doesn't incorporate a full Gen 2 Pokémon pool and it intends to use more offensive items than Leftovers.
2015-03-31 12:51:12 +02:00
Marty-D
2051f5f117 Gen II: Remove now unnecessary Nightmare fix
- Fixed for all gens in
7ffa583b58
2015-03-26 12:00:54 -04:00
Marty-D
ed074532c6 Make sure the flags object always exists 2015-03-21 14:29:07 -04:00
Marty-D
6ebb25d142 Gen II, IV: Fix (Hi) Jump Kick crash damage
Gen 2: 1/8 potential damage, not capped; no damage if target is immune
Gen 4: damage is 1/2 target's max HP if it is immune
2015-02-24 10:06:32 -05:00
Konrad Borowski
815909eff2 Don't skip residuals after fainting in Gen2.
The original code was wrong, as all it did was skipping residuals.
Skipping moves is handled by `faintMessages`.
2015-02-21 11:37:39 +01:00
Joimer
f26a69583e Gen 2: Fix Nightmare duration 2015-01-17 18:34:39 +01:00
Juanma Serrano
d9c367ff65 Fix more Travis Build Errors
Add a spaces after tests.
2015-01-15 09:31:36 +01:00
Juanma Serrano
94ad16652f Gen 2: Get rid of 1/256 on secondaries 2015-01-14 12:12:37 +01:00
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