The regressions affected information handling
- Seeds used for random teams were no longer being logged.
- The seed used for generating p2's team was also used for the battle itself.
Dancer Petal Dance shouldn't lock. This is a horrible hack but it fixes
the problem. A real fix would involve refactoring basically all locking
moves. Which I guess I should do one day...
Fixes#2974
This doesn't fix the biggest issue with Dancer (Petal Dance locking),
but it does fix every other Dancer issue, by moving it from useMove
to runMove.
This also adds improved comments on runMove and useMove.
This removes the 'deterministic test' tools by preventing action at a
distance (namely, preventing the modification of the `init` method in
`Battle` during tests). This action at a distance is incredibly
confusing.
All this action at a distance did was discard any parameters that were
passed to `Battle` that weren't the first three (which was probably a
mistake by the original author) and also hard code `this.seed` and
`this.startingSeed` in `Battle`.
This functionality has now been moved to the `PRNG` class, so instead
users should pass a `PRNG` to `Battle` as the 5th constructor argument.
Users can also pass one as the third argument to `common.createBattle`
or use `common.createBattleWithPRNG` with the PRNG as the first
argument.
The PRNG is just an encapsulation of the pseudo-random algorithm in a
class. It is stateful, so make sure to take a `clone()` of the PRNG if
you want to re-use it.
With the Gale Wings nerf, it appreciates being able to use one additional
super-heavy priority attack before Brave Bird takes it below Gale Wings
range.
Priority Z-moves exist (namely, Gale Wings Supersonic Skystrike).
Quick Guard now partially protects against priority Z-moves.
Psychic Terrain now fully protects against priority Z-moves.
In case of boosts, the attacking animation would play 1st, stealing the
boosts last, instead of the other way around.
This approach was chosen since Spectral Thief is the only move that
steals boosts this way, for now
Encore and Disable now fail when used against Z-moves.
Encore and Disable now no longer prevent Z-moves from being used.
Instruct now repeats the selected target location.
Instruct Pursuit now repeats the switched out target location, if
activated.
This refactor also simplifies some previously unnecessarily-complicated
code.