As of @a475ea5901, a basePower of `false` is a special value that
denotes that the move should always fail (unless modified). This
change broke 62 moves that currently use a basePower of `false` when
they appear to intend a basePower of 0. This commit changes the
basePower of these moves to 0.
Previously, Follow Me (and anything else that redirects moves, such as
various abilities) was unable to redirect the target of a
'randomNormal' target move, because validTargetLoc() always returned
false for a 'randomNormal' type move; this reflects the fact that the
client is not allowed to specify the target for such a move, because it
is chosen randomly. However, the internal game logic does need to be
able to specify a target for 'randomNormal' moves.
This commit adds a new parameter to validTargetLoc that specifies whether
the proposed target was chosen by the client or by the internal game logic.
If the proposed target was chosen by the internal game logic, then the same
targeting rules apply as in the case of a "normal" target move.
Note that it is necessary to add this new parameter, rather than just making
'randomNormal' behave the same as 'normal', because without the userSelected
check, a user could send a crafted choice string to the server specifying a
target for a 'randomNormal' move, and the server would respect the choice.
This implementation correctly prevents the client from specifying the target
of a 'randomNormal' move.
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.