7,226
edits
Nescientist (talk | contribs) (I believe it may not technically be an overflow, so trying to avoid saying that) |
Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
Line 9: | Line 9: | ||
==Explanation== | ==Explanation== | ||
To multiply the additional effect chance due to the effects of both Serene Grace and the rainbow, a 16-bit signed integer is used. However, for moves that do not inflict [[status condition]]s, the additional effect chance is then stored in an 8-bit unsigned integer. <math inline="yes">70 \times 4 = 280</math> is greater than 255 (the maximum value for 8-bit integers); it subsequently becomes 24% when assigned to an 8-bit integer (when the | To multiply the additional effect chance due to the effects of both Serene Grace and the rainbow, a 16-bit signed integer is used. However, for moves that do not inflict [[status condition]]s, the additional effect chance is then stored in an 8-bit unsigned integer. <math inline="yes">70 \times 4 = 280</math> is greater than 255 (the maximum value for 8-bit integers); it subsequently becomes 24% when assigned to an 8-bit integer (when the most significant bits are truncated): <math inline="yes">\left ( 70 \times 4 \right ) \bmod 256 = 24</math>. | ||
This glitch would affect all moves with a base additional effect chance between 64% and 88%. However, Charge Beam is the only move with an additional effect chance within that range. | This glitch would affect all moves with a base additional effect chance between 64% and 88%. However, Charge Beam is the only move with an additional effect chance within that range. |