onBasePower events now affect the base power modifier as opposed to the
base power directly. Also some moves had their base power changes moved
from basePowerCallback to onBasePower. These moves affect the modifier
and not the base power.
Note: The effects of weather and burn are still incorrectly applied as
base power modifiers
10: Figure out a way to apply these directly to the stat later
...
6: Target Ability
5: User Ability
4: Target's Ally Abilities
3: User's Ally Abilities
2: Target's Item
1: User's Item
To be honest it's mostly for posterity's sake as well as to match the
soon-to-be-corrected base power modifiers. At the moment all stat
modifiers are either *1.5 or *2 which have the same result no matter
which order you chain them in. However a mod or ability/item in the
future could add a value that isn't as clean.
Specifically, formes that normally require a specific condition,
such as Darmanitan-Z and Arceus-Fire, are now available in Hackmons.
The previous confusion stemmed from that Arceus-Fire is actually
Normal-type, and the Arceus forme is handled separately from
Multitype and plates, which is what actually gives it the Fire
typing.
- Choice items now lock into a new move properly after losing the
original locked move (due to Mimic/Sketch/Transform)
- Choice items now continue locking into the original locked move (if
there was one) after Embargo, Klutz, or Magic Room's effects end
- General fixes to the priority of ignoring items
- Magic Room is now usable again
Safeguard was failing to block Confusion because the Confusion
`onStart` function did not pass a `target` and `source` to `runEvent`
when invoking the `TryConfusion` event, and Safeguard's
`onTryConfusion` function requires that a `target` and `source` be
specified.
Gen 4 and Gen 5:
1) In Gen 4, the chance of protecting succeeding does not fall below
1/8, which has now been corrected in this commit. Previously, the
chance of success in Gen 4 was allowed to drop all the way to
1/(2**32) as in Gen 5.
Please see upokecenter for the correct mechanics:
http://upokecenter.dreamhosters.com/dex/?lang=en&move=182
For Protect and friends, Smogon currently says that the chance of
success does not fall below 50%, which is inconsistent both with the
current Pokemon Showdown! behaviour and with upokecenter. It is
pretty much certain that upokecenter is accurate here, since it is
based directly on the in-game data. This commit implements the
upokecenter mechanics.
2) This commit also consolidates some duplicate code with Protect and
friends by moving the miss chance logic to an event of the 'stall'
volatile called onStallMove. This allows me to remove some duplicate
code from moves.js.
3) Currently, some but not all of Protect and friends have a flag
called stallingMove set to true. This flag does not appear to be used
for anything. However, for consistency, I have set it to true for all
the "stall moves", as opposed to just a subset of them.
- Outrage is supposed to be able to confuse while asleep, as long as the duration would have ended the turn of attempted use anyway, much like Protect + Outrage. Also this breaks the game.
Two-turn moves are now controlled by a volatile, twoturnmove, which determines whether a Pokemon executes the charge turn or the move turn of a two-turn move. This handles mechanics like Truant Pokemon being unable to use two-turn moves, as the execution turn is their truancy turn. It also handles various edge cases involving moves that call other moves (e.g. Metronome) and Encore.
These changes add a new event, onChargeMove, in which one can return false to "skip" the charging turn and execute the move in full immediately. For example, Solarbeam returns false in onChargeMove if the weather is sunny, and Power Herb returns false if the Pokemon uses its item successfully. (Actually, those are the only two examples at present.)
This implementation is complete except for one issue, an inversion of a previous problem: whereas before, moves like Assist calling two-turn moves would execute them immediately, now, only the charge turn will be executed, and the Pokemon will not be locked into the move. This is due to be fixed soon.