move.zPowered is renamed move.isZPowered. It's now documented in JSDoc
exactly how it differs from move.isZ.
This commit includes several minor refactors to Z-move mechanics,
including a bug fix: Z-boosted called Weather Ball is now correctly
typed.
The types Template, Move, Ability, and Item are now read-only. This
should guard against accidental writing to types that shouldn't be
written to.
A new type, ActiveMove, has been introduced. Like it sounds, it's
used for moves that are currently actively being used. A lot of
attributes that are only relevant to active moves, such as
`hasBounced`, are now only available on ActiveMove, not on Move.
ActiveMoves are mutable, unlike Moves.
getMoveCopy has been renamed getActiveMove, to better reflect its
role. `isCopy` has been deprecated, and distinguishing Moves from
ActiveMoves is now done by `typeof move.hit === 'number'` where
necessary.
ActiveMoves now internally track which hit of a multihit move
they're on, in move.hit, so move.hit doesn't need to be manually
incremented by Triple Kick and Parental Bond anymore.
move.hasParentalBond has been replaced by a more generic
move.multihitType.
So if a Prankster-mon chooses in two successive turns an attacking move and an Status move,
and this Pokémon is encored into the attacking move before the Status move proceeds,
the attacking move will be used and it won't affect a Dark-type target.
Mechanically refactor code which uses PRNG#random for booleans to use
PRNG#randomChance instead.
Take advantage of the following properties:
random(x) < y is equivalent to randomChance(y, x)
random(x) <= y is equivalent to random(x) < (y + 1), i.e. randomChance(y + 1, x)
random(x) >= y is equivalent to !(random(x) < y), i.e. !randomChance(y, x)
random(x) > y is equivalent to random(x) >= (y + 1), i.e. !randomChance(y + 1, x)
random(x) === 0 is equivalent to random(x) < 1, i.e. randomChance(1, x)
!random(x) is equivalent to random(x) === 0, i.e. randomChance(1, x)
Boolean(random(x)) is equivalent to random(x) > 0, i.e. !randomChance(1, x)
This commit should not change behaviour. In particular, PRNG#next is
called the same number of times with the same number of parameter as
before this commit, and PRNG#next's results are interpreted in the same
way as before this commit.
Latest research (http://www.smogon.com/forums/posts/7625046/) shows that although Z-Synthesis bypasses Heal Block, using Z-Copycat to copy Synthesis does not. (Z-Copycat on a damaging move does of course turn into a damaging Z-Move.)
pokemon.moveset is now pokemon.moveSlots, which is at least slightly
clearer about what it's doing (tracking move state, mainly PP).
Mostly, this gives a consistent naming scheme for `move` (a Move
object) vs `moveSlot` (a MoveSlot object).
This also refactors a lot of existing `moveSlot` accesses to be modern,
including using `for...of`.
We are now tracking source effects for switch actions, if they're
initiated by effects such as U-turn or Baton Pass. This will lead
to better messages client-side.