Previously, if we wanted to test if A was either 'B' or 'C', we would use
the pattern:
A in {B:1, C:1}
I actually don't know how common this pattern is; I just started using
it because I was tired of typing `A === 'B' || A === 'C'` all the time.
I never really liked it, though; the `:1` part made it kind of
blatantly a hack.
I did some testing and `['B', 'C'].includes(A)` is overall faster.
(A switch statement is around 20x faster still, but who wants to type
that much code?)
Anyway, the new standard is
['B', 'C'].includes(A)
Something something progress!
Random team generation scripts are no longer in scripts.js, but instead
in a new file random-teams.js.
The scripts are now also no longer run from inside battles, but in a
new team generator object. This makes it easier for external scripts
to generate random teams by running Dex.generateTeam(format).
PS's rule table has been renamed from banlistTable, and works a bit
differently now. It's a Map instead of an object now, and the keys
work a bit differently.
The original banlistTable was designed to store bans, and later
additions shoved rules and then unbans in there. The new table is
designed to support all of these.
* Random Battle: Add possibility for Fly-Z or Bounce-Z
This involves adding Fly to some Flying Pokemon without a good Flying
STAB. (This also makes sure Fly is not their only STAB, and only exists
with setup.)
* Update scripts.js
Armaldo is far too slow to utilize Swords Dance well, and only works on
dedicated Rain teams (which are very uncommon in Randoms).
Update item selection for Substitute and Reversal in combination.
* Magnet Pull Magnzone now gets HP Fire 100% of the time
* Change Ditto's IVs to allow players to know it's Hidden Power at Team
Preview
* Dittos are now Sassy to give a better download matchup in the case of
a 'double down" - mirror matchup remains unchanged
* Removed weather restriction on Chlorophyll to bump up Venusaur usage
* Removed unused weather abilities
Also updated the link to the VR thread in the BSS format description
Eevee only gets Celebrate from an Event, and thus Umbreon cannot have its HA or Egg Move (Wish) on a set that also has Celebrate.
Also fixes several items being left out of the item clause (Thanks Urkerab and DragonWhale)
This is a surprisingly minor refactor considering how many files it
touches, but most of this is only renames.
In terms of file renames:
- `tools.js` is now `sim/dex.js`
- `battle-engine.js` is now `sim/index.js` and its three classes are
in `sim/battle.js`, `sim/side.js`, and `sim/pokemon.js`
- `prng.js` is now `sim/prng.js`
In terms of variable renames:
- `Tools` is now `Dex`
- `BattleEngine` is now `Sim`
- `BattleEngine.Battle` is now `Sim.Battle`
- `BattleEngine.BattleSide` is now `Sim.Side`
- `BattleEngine.BattlePokemon` is now `Sim.Pokemon`
Previously, `moveid` would contain the specific type of hidden power such as `'hiddenpowerfire'`, but the switch statement would check for `'hiddenpower'`, and thus Hidden Power would never be rejected.
* Random Battle: Improve HP evs
This lets Zygarde-10% activate Power Construct in two subs, and also simplifies some unnecessarily complex code.
* Fix formatting (#19)
* Update scripts.js
It can't sub down to exactly half if it's got lefties, so don't give it less HP for no reason.