Commit Graph

77 Commits

Author SHA1 Message Date
Ivo Julca
0281176fd1 Remove usage of Array|Object methods implemented by Sugar.js
Adds a dependency to shim Object.values until it's natively available.
2016-03-09 16:55:34 -05:00
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
Marty-D
afe31af0b4 Gen II: Fix critical hit interaction with screens 2016-02-15 23:16:07 -05:00
Konrad Borowski
81f602b8d8 Always use trailing comma for multiline objects 2016-01-01 00:20:07 +01:00
The Immortal
2e85f15d51 Gen 2: Change back IVs variable 2015-12-29 22:34:59 +04:00
The Immortal
d3786b0680 Gen 2: Remove duplicate HP IVs
The gen 2 mod doesn’t need HP IVs due to 0883c65. Updated the relevant
Hidden Power checks.
2015-12-29 20:24:39 +04:00
Ivo Julca
88c9902ebe Remove unused variables in old-gen random set builders
- Gen 2: `isSetup` is not even assigned a value.
- Gen 5: unmaintained.
2015-12-03 19:55:19 -05:00
Marty-D
a0876824c1 Gen II: Fix Flail and Reversal
They can't crit and don't perform damage variance.
2015-11-23 18:42:13 -05:00
Marty-D
c5b5885709 Gen II: Implement screens properly
Watch out for rollovers!
2015-11-14 11:42:58 -05:00
Marty-D
ebf197734b Gen II: Fix stat calculation
No longer shall paralyzed Pokemon have a Speed of 1.
2015-11-14 10:41:39 -05:00
Marty-D
7bfee1b079 Gen II: Add weather modifiers to the damage formula
And put SolarBeam's rain check where it belongs.
2015-11-09 12:24:53 -05:00
Guangcong Luo
ded9f1cd5d Fix duplicate cases in random set generators 2015-11-07 23:12:19 -06:00
Ivo Julca
90973d5c0c Style fixes
- Cut down excessive spacing
- Add braces to missing conditionals
2015-11-07 17:08:09 -05:00
Ivo Julca
2c2a3bdf58 Fix misplaced cases in random sets generators 2015-11-07 16:50:51 -05:00
Juanma Serrano
c4ac8d6e2f Use strict mode and let and const instead of var
This commit also fixes some duplicated variable declarations.
2015-11-06 21:56:52 -05:00
Ivo Julca
15b925f7e4 RBY-GSC Randbats: Fix high incidence of later gen Pokémon 2015-07-16 13:33:42 -05:00
Ivo Julca
baadd0a92f Overhaul old-gen random team builders
Mainly follow-up for 1deedc595, but also fixes a few bugs.
- BW/GSC/RBY - randomSet: fixed and renamed slot argument.
- BW - randomTeam: crashlogger relative path was set incorrectly.
- BW - randomTeam: PotD Magikarp and Delibird used outdated randomBattleMoves data format.
- RBY - randomTeam: builder was too reject-happy regarding weaknesses (counters prematurely updated).

An improvement of 130% more op/s is observed for RBY randomCCTeam,
with no significative performance regression for randomTeam in any gen.
2015-07-16 12:03:14 -05:00
Marty-D
29e56b1043 Fix confusion timing after rampage moves
- Gen 1, 2, 5, and 6 cause confusion immediately after the move on the
last turn
- Gen 3 and 4 cause confusion at the end of the turn on the last turn
2015-06-04 09:55:30 -04:00
Marty-D
099824a3fb Gen II: Fix base power modifiers 2015-05-28 19:01:15 -04:00
Marty-D
1e5b241c0d Gen I, II: Fix rampage moves
- The lock starts even if the move is blocked by Protect, misses, or the
target is immune
- The lock ends without causing confusion whenever the move cannot be
executed
- When the lock ends normally, confusion begins even if the user is
already confused, and there is no indication that confusion has started
- In Gen 1 the duration is 3-4 turns
2015-05-22 14:30:44 -04:00
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