SadisticMystic said: Something notable about Sword of Ruin and Beads of Ruin is that they are the first non-stat-stage scale factors in the history of the modern stat system that apply any amount of decrease to a defense stat.
The absence of such factors before was, it seemed, deliberate: the raw stat formula refuses to output a stat value of less than 4, even for a level 0 or 1 Pokemon with a negative nature in the stat and a low base stat. Combined with the +6/-6 cap, this means they can be divided by 4 but no further, so a 4-point stat (indeed, even a 7-point stat) will remain at 1 after all those drops. Other factors that claimed to make a Pokemon weaker to certain things, like Dry Skin or Fluffy, were always coded as an increase to incoming move power or damage, rather than admitting the existence of any factor that could ever possibly reduce a defense stat beyond what the stages already do.
Early on in RBY, you had some mechanics that understandably weren't very polished: if you Screeched the opponent's defense down to 1, you could then use Explosion to cut that value in half for the duration of the move. Or any physical move used with at least 256 attack into 3 defense would divide both values by 4, and get a 0 that way. This resulted in a division by 0, and a game crash. Modern games aren't quite as fragile when you throw those challenges at them, and will catch the attempted division by 0 before it happens, with the failsafe being to zero out the result of the calculation up to that point, and any attacks aimed at that side will do only single-digit damage no matter how powerful they are or if they're super effective. In effect, this means if you can get a 0-point defensive stat, the game will treat that as an infinitely high stat . The trouble, of course, lies in getting that zero in the first place--it requires either direct stat hacking, or Sw/Sh introduced a vector involving overflow of the positive nature calculation to the unobtainable Eternatus-E form (thereby introducing the mechanic to Pure Hackmons). It's clear from the damage-mitigation behavior of 0 defense that this failsafe mechanic was never supposed to be accessible for general use.
Did the Ruins change all that? If you stat-drop a low-level Pokemon down to 1 defense or SpD, then bring in the appropriate Ruin ability to affect that stat, will this result in a further reduction to 0, and if so then does the game still treat attempted division by a 0-point defense stat the same way it has based on the precedent of gens 5-8?
Click to expand... Click to collapse... DaWoblefet and I tried this experiment:
He brought a level 1 Happiny with a starting Defense of 4.
I used Screech 3 times and then Icicle Crash from a Chien-Pao, which KO'd it.
Looking at the debug output, the Defense was still treated as 1, so it took 27k damage.
Debug Thread 12 "JobThread1" hit Breakpoint 1, 0x0000005444767298 in ?? ()
$1 = 4096
$2 = "attack mod"
$3 = 272
$4 = "attack power before mod"
Thread 12 "JobThread1" hit Breakpoint 6, 0x00000054447675b4 in ?? ()
$5 = 272
$6 = "attack power"
Thread 12 "JobThread1" hit Breakpoint 2, 0x0000005444767d74 in ?? ()
$7 = 3072
$8 = "defense mod"
$9 = 1
$10 = "defense power before mod"
Thread 12 "JobThread1" hit Breakpoint 9, 0x0000005444767d88 in ?? ()
$11 = 1
$12 = "defense power"
Thread 12 "JobThread1" hit Breakpoint 7, 0x0000005444767d98 in ?? ()
$13 = 100
$14 = "attacker level"
Thread 12 "JobThread1" hit Breakpoint 8, 0x0000005444767d9c in ?? ()
$15 = 85
$16 = "move BP"
Thread 12 "JobThread1" hit Breakpoint 4, 0x00000054447688d0 in ?? ()
$17 = 6144
$18 = "STAB/tera mod"
$19 = 18062
$20 = "damage before STAB/tera mod"
Thread 12 "JobThread1" hit Breakpoint 3, 0x0000005444768bd4 in ?? ()
$21 = 4096
$22 = "damage mod"
$23 = 27093
$24 = "damage before mod"
Thread 12 "JobThread1" hit Breakpoint 5, 0x0000005444768ce4 in ?? ()
$25 = 27093
$26 = "final damage"
The place where the Defense modifier applied follows:
Code: if ( ((defGuard_before_mod * def_mod) & 0xFFFu) <= 0x800 )
defGuard = (defGuard_before_mod * def_mod) >> 12;
else
defGuard = ((defGuard_before_mod * def_mod) >> 12) + 1;where
defGuard_before_mod = 1 and
def_mod = 3072. Essentially this is a "round half down" step and since 3072 * 1 / 4096 never hits 0.5, it gets rounded up.
I did try a second experiment where I straight up set the opposing Pokémon's defense,
defGuard_before_mod to 0, and the opposing Pokémon took 2 damage.
Debug Thread 13 "JobThread2" hit Breakpoint 1, 0x0000005444767298 in ?? ()
$27 = 4096
$28 = "attack mod"
$29 = 346
$30 = "attack power before mod"
Thread 13 "JobThread2" hit Breakpoint 6, 0x00000054447675b4 in ?? ()
$31 = 346
$32 = "attack power"
Thread 13 "JobThread2" hit Breakpoint 10, 0x0000005444767d74 in ?? ()
$33 = 4096
$34 = "defense mod"
$35 = 0
$36 = "defense power before mod"
Thread 13 "JobThread2" hit Breakpoint 9, 0x0000005444767d88 in ?? ()
$37 = 0
$38 = "defense power"
Thread 13 "JobThread2" hit Breakpoint 7, 0x0000005444767d98 in ?? ()
$39 = 100
$40 = "attacker level"
Thread 13 "JobThread2" hit Breakpoint 8, 0x0000005444767d9c in ?? ()
$41 = 90
$42 = "move BP"
Thread 13 "JobThread2" hit Breakpoint 4, 0x00000054447688d0 in ?? ()
$43 = 6144
$44 = "STAB/tera mod"
$45 = 1
$46 = "damage before STAB/tera mod"
Thread 13 "JobThread2" hit Breakpoint 3, 0x0000005444768bd4 in ?? ()
$47 = 4096
$48 = "damage mod"
$49 = 2
$50 = "damage before mod"
Thread 13 "JobThread2" hit Breakpoint 5, 0x0000005444768ce4 in ?? ()
$51 = 2
$52 = "final damage"