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`
pokemon.update() used to be called after pretty much everything, but
now that we've refactored pretty much everything out of it, it's no
longer necessary for most of the situations we call it for.
It currently only updates pokemon.speed, so I've renamed it updateSpeed
for clarity.
We now only update pokemon.speed on switch-in, right before the
residual event, and at the beginning of every turn. This gives
something like a 30% speed-up.
JSHint's ES6 support is shaky, and its development has stalled as of late.
Since ESLint can do by itself both JSHint and JSCS' jobs, this commit replaces them.
Gulp and its related dependencies are also hereby removed.
As gen 1, Stadium has its own stat modifying mechanics.
It's basically an extension of gen 1's, only it changes the approach and runs a recalculation on all changes only for the proper Pokémon.
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.
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.
This commit implements at its full the Stadium format.
Stadium is a half-generation between Gen 1 and Gen 2, widely regarded as a Gen 1 game without the major gen 1 bugs.
The main changes of this game are:
Sleep lasts between 1 and 3 turns.
Hyper Beam does recharge after a faint.
Critical hits happen way less.
Substitute now blocks all status ailments and draining.
It allows tradebacks.
Partial trapping moves miss and stop their duration upon target switch.
Focus Energy actually works.
Stat calculations are done properly, burn and para drop are lost if you lose status.