So yeah, this is a major bug in the randbat set generator, but other
than performance issues and the random 3-move pokemon, it shouldn't
have any other implications.
- Move some variable declarations outside of loops.
- Use single-line if statements wherever reasonable.
- Update a check for Hyper Fang to Gen 6.
- Fix Ghost types getting Chople Berries in Random Doubles Battles.
- Fix a typo intended to fix in d24b184b and another one introduced in the same commit.
randomBattleMoves is now an array, and has been renamed from
viableMoves since it no longer is used for anything other than
random battles.
This commit also does some cleanup of some code relating to
random battle moves, including fixing gen 1's randomSet function,
which apparently has never worked.
JSHint is now a fair bit stricter, and is now correctly checking
files in `mods/`.
The code has been fixed to match the new stricter standards.
JSHint has now caught its second actual bug: Gen 5 Pinap Berry
was Ice instead of Grass.
I used a hack to make the multiple declaration errors go away,
so all that remained in jsHint were actual errors, which I've
now mostly fixed.
All this linting ended up uncovering one actual bug: Uproar's
message not showing. It's a very minor bug in a move no one uses,
so I'm going to fold it into this commit.
The one who committed that probably meant Sky Attack. Like Bounce it is also a 2-turn move. Aeroblast is a 100 BP Special Flying-Type attack. Very STAB-worthy.
- Fix an issue introduced in 6539521adc, where Protean didn't activate if the target was immune to the move.
- Protean should not activate if the user fails a Detect/Protect, or the move is Fling or Natural Gift and the user has no item.
- Protean should not activate on the first turn of a Pledge Combo. Aditionally, fix Flash Fire/Storm Drain, etc being activated by the first move in the combo.
- Introduce event 'PrepareHit', which is ran after any move target is resolved but before immunity is checked.
Megas now have their own viable moves, so that more unique megas like Heracross, Charizard and Mewtwo can have their viable options.
Potential mega evolving candidates can now be selected without their mega stone. For example, if the team has Gengar with Gengarite, Heracross without Heracronite can be added.
Make multiple mega evolution selection random
It mistakenly always picked the Y forme rather than randomly choosing either.
Reduce number of getTemplate() calls
Slayer95 pointed out that this is a better implementation.
Fix syntax error
Improve randoms mega selection
Simplifying the code by having the mega template stored in 'template'. For abilities, the original template is stored in 'baseTemplate'. Also added the improved mega selection for Random Doubles, which would be affected by giving viable moves to megas in formats-data.js.
Improve mega selection in randoms
Megas now have their own viable moves, so that more unique megas like
Heracross, Charizard and Mewtwo can have their viable options. Potential
mega evolving candidates can now be selected without their mega stone.
For example, if the team has Gengar with Gengarite, Heracross without
Heracronite can be added.