# Ultra Sun & Ultra Moon Battle Mechanics Research (Read Post #2)

#### VCrakeV

When does a Pokemon get burnt if attacking a Pokemon using Beak Blast? Is it before or after damage calculation?

It checks and deals damage first, then causes burn.

#### sumwun

Can fling activate magician? Bulbapedia says it can't, but I think it did in a Showdown! battle.

what types exactly are impostored arceus formes without plates? this keeps getting changed back and forth on showdown.

http://replay.pokemonshowdown.com/gen7balancedhackmons-870175890
right now it is always the underlying type that gets copied ie. normal unless having a plate, but just a few weeks earlier it was the superficial type

Last edited:

#### Wheaties

Do Photon Geyser and Light-That-Burns-The-Sky take into account the attacker's abilities? For example, I would expect skill swapping Pure Power onto Ultra Necrozma would affect the power and physical/special designation of those moves. (not sure if that situation is possible in game, but the question still stands)

Photon Geyser determines which stat is higher after applying stat boosts, but nothing else. Huge Power and Choice Band will both be ignored.

Imprison itself was bugged on sim earlier today. It's a self-targeting move, and should never have an opportunity to run into Magic Coat or Magic Bounce.

Weight mechanics:
• Wailord (398.0 kg) holding a Float Stone, and with its ability swapped to Light Metal, is hit for 80 power by Low Kick. This proves that both Float Stone and Light Metal are cumulative, reducing the weight to 99.5 in this case.
• Raichu (30.0 kg) gets 80 power from using Heavy Slam on Reuniclus (20.1 kg) @ Float Stone. This proves that weight-tracking has a granularity of 0.1 kg, and halving effects round down (so 20.1 becomes 10.0, not 10.1 or 10.05).
• Azelf (0.3 kg) gets 80 power from using Heavy Slam on Kartana (0.1 kg) @ Float Stone. This proves that weight has a minimum of 0.1, and cannot be reduced below that. In fact, the same is true if Azelf is also holding a Float Stone and has its ability swapped to Heavy Metal, which proves that Heavy Metal must apply before Float Stone (otherwise Azelf would round down from 0.15 to 0.1, and only double back up to 0.2).
• Celesteela (999.9 kg) with its ability swapped to Heavy Metal gets 80 power from using Heavy Slam on Avalugg (505.0 kg). This proves that unlike the minimum, there is no maximum at 999.9, and Celesteela must be counting as 1999.8 to reach that power level.
• If the Wailord from before uses Autotomize, Low Kick still hits it for 80 power. This remains true whether abilities and items are swapped around before the use of Autotomize, or afterwards. What this proves is that regardless of their chronological order of acquisition, Autotomize always counts before either Light Metal or Float Stone, so 398 -> 298 -> 149 -> 74.5. If Autotomize came after one of them, the sequence would be 398 -> 199 -> 99 -> 49.5 (which is only 60 power); if it came after both, it would be 398 -> 199 -> 99.5 -> 0.1 (only 20 power).
• If a Lairon (120.0 kg) with Heavy Metal and Eviolite uses Autotomize, Low Kick hits it for 60 power. This proves that Autotomize also comes before Heavy Metal (120 -> 20 -> 40, not 120 -> 240 -> 140 which would be 100 power).
• Autotomize displays a "<Pokemon> became nimble!" message upon use, and this message can appear separately on multiple uses of the move. However, it will not appear if Autotomize failed to change the stat (likely by already being at +6), or if the user's weight is already bottomed out at 0.1 kg. Each use of the move that causes the message to appear creates a separate, cumulative weight-reduction effect, and using moves like Haze, Heart Swap, or Topsy-Turvy may change the stat levels but they will not alter or remove the existing weight reductions. To back this up, a Wailord with a normal item and ability can use Autotomize 3 times in a row and Low Kick will proceed to hit it for 80 power (three separate 100kg reductions knock it down to 98.0). After a fourth Autotomize (which can't raise the speed any higher), no message appears about becoming nimble, and Low Kick still hits for 80. After a Haze and a fifth Autotomize, Low Kick now hits for 20, showing that the weight reductions are still intact and the new one drops it all the way to 0.1.
In summary: however many Autotomize effects exist, apply them first, then Heavy Metal, then Light Metal and Float Stone (rounding down to a granularity of 0.1 kg, and also a minimum of 0.1kg).

Note that while Haze does not remove Autotomize's weight-loss effect, any form change does. This most commonly happens with Aegislash, but it could also feasibly be a factor for, say, an Aggron that holds off on going mega for a turn in order to get a speed boost with Sturdy insurance. Both Rock Polish and Autotomize exist as options for this, but Autotomize might be used for a "psych-out" play, as it can then go mega the next turn and be back to its full 395kg, not 295, to give it that bit of extra power on Heavy Slam that the opponent might not have expected it to use based on its willingness to reduce its own weight.

Last edited:

#### urkerab

weight-tracking has a granularity of 0.1 kg, and halving effects round down (so 20.1 becomes 10.0, not 10.1 or 10.05).
To avoid floating-point rounding errors, do you think the sim should store the weight in hectograms, only dividing by 10 for the /details command?

As for the sim mechanics, since Float Stone and Light Metal don't truncate to 0.1, it currently does Autotomize first and then the other three, but apart from that, all the rest of the mechanics appear to be correct.

Do you know whether Transform copies the effect of Autotomize on weight?

Do you know whether Transform copies the effect of Autotomize on weight?
Yes. If a Smeargle uses Autotomize and then transforms into something that hasn't, it will lose the weight reduction effect (this much is consistent with treating the act of transformation as a form change), but if it hasn't used Autotomize and transforms into something that has, it will gain the weight reduction from its transformed body's weight (and if they used the move multiple times, it will copy all such reductions).

On a rather unrelated note, I believe I've sorted out the full order of steps that current games make when they check for a move to be successful. If a move could fail for multiple different reasons, this chart shows which one will take precedence, and where along the way you get effects like PP subtraction or Protean triggering if the move hasn't failed yet. It's a very long list, so...

1. check for sleep/freeze (unless using a move that can execute despite that status)
2. check for disobedience
3. check for Truant loafing turn
4. if move is Focus Punch, check for prior damage this turn
5. check for flinch
6. check for confusion self-damage
7. check for full paralysis
8. check for attraction
9. check if there was no PP left for the move
10. if move is Z powered, display Z dance, and if move is status, APPLY Z effect
11. if not Z powered, check if move is Disabled
12. if not Z powered, check if move is blocked by Heal Block
13. check if move is blocked by Gravity (applies even to Z moves)
14. if not Z powered, check if sound move is blocked by Throat Chop
15. (G7) check for move failure due to being Choice-locked into a different move
16. if not Z powered, check if status move is blocked by Taunt
17. if not Z powered, check if move is sealed by Imprison
18. if user has a Choice item, LOCK into the chosen move
19. if move can call another move (Metronome/Assist/etc.), REPLACE the running move and repeat steps 12-14
20. if ability is Stance Change, CHANGE form if appropriate (in G6, move this before step 1)
21. check for move type changing due to Aerilate/Pixilate/Refrigerate/Normalize/Galvanize/Liquid Voice
22. set move type for Hidden Power/Judgment/Multi-Attack/Natural Gift/Revelation Dance/Techno Blast/Weather Ball/Z-Weather Ball
23. check for move type changing due to Electrify/Ion Deluge/Plasma Fists
24. if move is Curse, user is a ghost, and target is self (which shouldn't be valid for that version of the move), change target to a random opponent
25. check for target redirection by Lightning Rod/Storm Drain
26. check for target redirection by Follow Me/Rage Powder/Spotlight/Z-Destiny Bond/Z-Grudge
27. SUBTRACT the appropriate amount of PP from the move (if the move called another move at step 19, use the original move for PP subtraction)
28. check for move condition failures, part 1
Sucker Punch/Me First: target doesn't have an eligible move pending
Burn Up: user is not Fire type
Fake Out/First Impression/Mat Block: user has already performed an action
protection moves: automatically fail if there are no other pending moves this turn, otherwise check for failure chance if repeated
(G7) Destiny Bond: move is repeated and previous use was successful
Fling/Natural Gift: Embargo or Magic Room are in effect, or ineligible held item
Stockpile: existing Stockpile count is 3
Swallow/Spit Up: existing Stockpile count is 0
Bide: no energy to unleash
Counter/Mirror Coat/Metal Burst: target hasn't hit with an eligible damaging move this turn
Encore: target hasn't used a move, or has no PP left on the move, or move is exempt from the effect
Hyperspace Fury/(G7) Dark Void: ineligible user
Rest: user has full HP, or is already asleep (through Sleep Talk, or user's Comatose)
Rest: user has Insomnia/Vital Spirit (this check happens after the previous one)
Snore/Sleep Talk: user isn't asleep
Future Sight/Doom Desire: target slot already has the future attack effect
29. if move allows self-defrost, UNTHAW the user
30. check if move is blocked by Primordial Sea/Desolate Land
31. check for Fire move failure and backfire due to Powder
32. if move is Future Sight/Doom Desire, CREATE the effect and EXIT (does not count as failing the move)
33. if move is part 1 of an eligible Pledge combo, fail the current move and TRIGGER teammate to pick up the conclusion (they start over from step 1)
34. check if move is blocked by Damp
35. if ability is Protean and user can change type with it, CHANGE type to match with move
36. if move requires charging, APPLY Defense boost if Skull Bash, and unless it's Solar Beam/Solar Blade in sun, or Power Herb can be consumed, SUSPEND the move until next turn (does not count as failing)
37. check for move failure due to lack of target (includes Helping Hand/Ally Switch in singles)
38. check if move is STOLEN by a pending Snatch (go back to step 12 for the Pokemon who snatched it)
39. if move is Explosion/Self-Destruct/Mind Blown, LOSE 100/100/50% of own max HP respectively, but don't fail the move from user fainting
40. check for move condition failures, part 2
Rest: Uproar is in effect
recovery moves other than Rest: user has full HP
Substitute/Belly Drum: not enough HP to make one
Conversion/Camouflage: user is already the type it would change to
Conversion 2: no prior move, or all resistances to the move's type (if any) are already in user's own types
Sky Drop: target is a teammate
41. check for move failure due to target in Fly/Dig/Dive/Bounce/Sky Drop/Phantom Force/Shadow Force
42. check if priority move is blocked by Dazzling/Queenly Majesty
43. check if priority move is blocked by Psychic Terrain
44. if move is Sky Drop, check for failure due to target too heavy (200kg)
45. check if move is blocked by Quick Guard/Wide Guard/Crafty Shield (if Z powered attack, only 75% reduction)
46. check if move is blocked by Protect/Detect/King's Shield/Spiky Shield/Baneful Bunker (if Z powered attack, only 75% reduction)
47. check if move is reflected by Magic Coat
48. if move is Telekinesis, check for failure vs. Diglett/Dugtrio/Sandygast/Palossand/Gengar-Mega, Smacked Down, or Ingrained target
49. check if move is reflected by Magic Bounce
50. check if move is blocked by Mat Block (if Z powered attack, only 75% reduction)
51. check for ability-based immunities, part 1
Sap Sipper: Grass type moves
Flash Fire: Fire type moves
Dry Skin, Storm Drain, Water Absorb: Water type moves
Lightning Rod, Motor Drive, Volt Absorb: Electric type moves
Soundproof: sound moves
Telepathy: damaging moves from a teammate
Wonder Guard: move is a type that isn't super effective
52. if non-status move or Thunder Wave, and target does not hold Ring Target, check for type chart immunity (G6: move this check to step 42)
53. check for Levitate immunity (G6: move this check to step 43)
54. check for Magnet Rise/Telekinesis/Air Balloon immunity
55. check for Overcoat immunity
56. check for Safety Goggles immunity
57. check for type-based move condition immunities
powder moves: Grass type
burning moves: Fire type
poisoning moves: Poison/Steel type (unless user has Corrosion)
paralysis moves: Electric type
(G7) Sheer Cold: Ice type
Mean Look/Spider Web/Block: Ghost type
Sky Drop on the way down: Flying type
58. check for other move condition immunities
Synchronoise: non-matching type
Dream Eater/Nightmare: target is awake
Attract: gender failure
Endeavor: target has less HP than user
Fissure/Horn Drill/Guillotine/Sheer Cold: target has higher level than user
59. check for ability-based immunities, part 2
Sturdy: OHKO moves
Sticky Hold: Trick/Switcheroo
Bulletproof: bullet/bomb moves
Oblivious: Attract/Captivate/Taunt
60. if move is Captivate, check for gender immunity
61. if move is Curse, user isn't a ghost, and target isn't itself, change target to self
62. check for generic move failure due to redundancy
status affliction when target already has one
attempted creation of weather/field effect/pseudo-status that already exists
stat changing moves that can't go any higher or lower
Trick/Switcheroo/Bestow with no item, or unmovable item
Instruct/Disable/Sketch vs. no move, or ineligible move (note that Encore is checked earlier)
Healing Wish/Lunar Dance with no one to switch to
various other moves whose effects would naturally do nothing
etc.
63. check if move is blocked by Safeguard
64. check if move is blocked by Electric Terrain/Misty Terrain
65. check if move is blocked by Sweet Veil or Comatose/Shields Down/Insomnia/Vital Spirit/Leaf Guard
66. check for move accuracy
67. check if move is blocked by target's Substitute
68. check if move is blocked by Mist
69. check for ability-based immunities, part 3
Clear Body/White Smoke/Full Metal Body: all stat drop moves
Hyper Cutter: attack drop moves
Big Pecks: defense drop moves
Keen Eye: accuracy drop moves
Aroma Veil: Attract, Disable, Encore, Heal Block, Taunt, Torment
Flower Veil: all stat drop moves, all status inflicting moves
Water Veil, Water Bubble: burn moves
Immunity: poisoning moves
Limber: paralysis moves
Own Tempo: confusion moves
Suction Cups: Roar, Whirlwind
70. if move is Roar or Whirlwind, check for failure due to Ingrain
71. if move's priority was elevated due to Prankster, check for Dark type immunity
72. if move is Brick Break/Psychic Fangs/Spectral Thief/Pay Day, APPLY its side effect now
73. perform move

Last edited:

#### urkerab

Yes. If a Smeargle uses Autotomize and then transforms into something that hasn't, it will lose the weight reduction effect (this much is consistent with treating the act of transformation as a form change), but if it hasn't used Autotomize and transforms into something that has, it will gain the weight reduction from its transformed body's weight (and if they used the move multiple times, it will copy all such reductions).
Looking at the sim, it suggests this is a change from Gen 6, where it used to keep its own Autotomize weight loss rather than copying its target; can you confirm this? Edit: Also, the forme change resetting weight mechanic is new in Gen 7?

#### sumwun

Can sleep talk call currently disabled moves? Also,
Can fling activate magician? Bulbapedia says it can't, but I think it did in a Showdown! battle.

#### viol and bass

Is Future Sight boosted by Psychic Terrain? If so, does it check for terrain on the turn it hits or the turn it’s selected?

#### DaWoblefet

##### Demonstrably so
Can sleep talk call currently disabled moves?
Yes, Sleep Talk can call Disabled moves.

Can fling activate magician? Bulbapedia says it can't, but I think it did in a Showdown! battle.
Using Fling with a Magician Pokemon into another target that has a stealable held item will not steal that held item on cartridge. You were correct that the interaction is currently bugged on Showdown.

Is Future Sight boosted by Psychic Terrain? If so, does it check for terrain on the turn it hits or the turn it’s selected?
From Marty's profile:
Marty: Psychic Terrain has to be active when Future Sight hits, and will only boost it if the user is grounded at that time, even if it wasn't grounded when the move was used. If the user is currently switched out, it's always considered grounded unless it's a Flying type (a Pokemon's Ability and item aren't checked while it's inactive).
Aurella: Okay, so to describe to what I think you are saying: Levitate Bronzong uses Future Sight > Tapu Lele switches in on the turn that future sight will hit > since Levitate Bronzong (future sight user) isn't active on the field (since Tapu Lele is in currently) then terrain will boost the future sight attack since the original user of the move is not in field and therefore it's ungrounding ability isn't checked during terrain/damage calculation.
Marty: That's correct, yeah.

Turns out there's still more bitwise rollovers to be found!

So I had this ordinary level 1 Alola Geodude, 6 points in Attack, with Galvanize, Muscle Band, and the moves Defense Curl/Rollout/Charge/Explosion. Selecting each of those moves once and in order, Rollout had the obligatory Mimikyu hit to store a 32x multiplier. Then immediately after Charge, while Electric Terrain had been summoned, the rest of the field was: L100 Mantine with 209 Def/373 HP, L80 Wishiwashi with 237 Def/186 HP, and L50 Oranguru with 118 Def/165 HP. Mantine gave Geodude a helping hand, instructed once by Mantine, to cheer on the incoming explosion.

Those stats were calibrated so that, based on existing knowledge of Rollout storage, the Explosion would take everyone into the red, without any chance of a KO except on a critical. But this setup was also chosen for another reason: Helping Hand, Muscle Band, Galvanize, and Charge are all multipliers that work specifically on the move power, before we get to any other part of the formula. When we tally everything up, this Explosion should have a nominal power of 71,273, which happens to exceed 16 bits--so what I was curious about was whether the move really did count as the full 71273 power, or if they put the same 16-bit limitation on power that they also put on stats, in which case I could expect it to wrap around to 5737 power, and in that case the Explosion would do a bit less than 10% damage to everyone.

The end result was a bit surprising: Mantine took 28 damage, Wishiwashi took 6, and Oranguru took 4. The 28 figure is consistent with what a 5737-power move should do, implying a rollover there, but the other two figures appear too low. Even at the lower, rolled-over power, both opponents should have taken at least 12 damage.

Turns out if you use the lingering multiplier from Rollout storage on a spread move, it considers each target one at a time. First is your own teammate (if the move includes them in its targeting scope, as Explosion does), then the opponent's left slot (the one on your right), then the opponent's right slot. With the teammate coming first, it uses up the stored 32x power multiplier, then there's no multiplier left to see when it comes to checking damage against the opponents. So instead of 71273 or even 5737 power, Explosion was counting for just 2227 against them, as you would get from putting Galvanize, Muscle Band, two Helping Hands, Charge, and Electric Terrain onto a starting point of 250 rather than 8000. Presumably in the further-desynced version where Rollout breaks two or more disguises, it proceeds the same way--one at a time, consider each target in order and play "take a number" until there are no more numbers left in the dispenser to take. It's not a mechanic that's likely to have serious competitive impact in any case, but now I know this is how it works.

On a related note, since this proves that move power is capped at 16 bits, and I already knew there were only two bytes devoted to each stat in the Pokemon data structure, it seemed like a done deal that in-battle calculated stats for the damage formula behaved similarly. It's not possible to explore this without hacking: the highest you can ever legally get the stats in question, no matter how contrived, is 14712 in Attack and 9808 in Defense, neither of which is even a quarter of the way there (and in Custom Game, where it is possible to get stats that high, Showdown removes all bitwise rollovers as a matter of policy). So this is purely a curiosity.

If you're going to hack stats to unnatural levels, you might as well make them clean unnatural levels, so for example you could set a Pikachu's attack stat to 16384 then give it Huge Power and a Light Ball to go directly to 65536, wrapping around to a clean 0. 0-point attack stats can be realized even without hacking, by using the effects of Slow Start or Defeatist, and as expected, a 65536-point Attack stat behaves just like a 0. You do very little damage, even against weak opponents, not much to say about that.

The analogous case for the defense stat is a bit more interesting. First off, there's nothing like Slow Start that works on defensive stats to allow those to realize a 0-point value naturally, so we don't have any hackless precedent in the current games to give us an idea of the behavior we should expect there. And in older games where we do have such prior precedent (the first two gens where you could have 256 Attack vs. 3 Defense, and it would scale down both stats one time to try and make them fit within 8 bits), the result is a game crash, and that outcome wouldn't be helpful to anyone.

The good news is games are more robust now than they were back then, and this doesn't cause a crash for attempting to divide by 0. Actually, the tester made a typo the first time and put in the starting defense stat as 16834 instead of 16384, on a Ditto with Fur Coat and Metal Powder. Doubling the wrong value twice gives 67336, which wraps around to 1800, and if anything that gave us an additional useful data point. 67336 did appear to act just like a stat of 1800, taking little damage from physical attacks but not being so completely incomprehensible on the scale of opponents' stats, at least when they have reasonably high levels.

After they corrected to the right value, the defense hit a value that should be wrapping around to 0. But what does that even mean? Well, throwing several attacks at the Ditto to see what sticks, against low- and high-level opponents alike, they were all ending up around 1-8 damage depending on factors such as STAB, criticals, and the spread move penalty. Some of them should have been plenty strong enough, such as a Machamp Dynamicpunch, to prey on an ostensible 0 defense, but only ended up dealing 2 damage anyway.

With a variety of permutations at hand, I believe I have an explanation for all of them. As we learned from Gyro Ball, the game really doesn't like trying to divide by 0, but instead of outright crashing, now they just make an emergency exit from the routine. In Gyro Ball's case, it sets the move power to the minimum 1, and here they seem to be breaking out of an attempted X / 0 calculation by returning 0. This means you can effectively think of it as a 0-point defensive stat (albeit after rollover in this case) gets treated as an infinitely high stat. Yes, this is the opposite of what you'd expect from a low stat, just like how being slow is normally good for powering up your Gyro Ball, but reaching the ultimate in slowness ends up reducing the move to minimum power.

After the 0 return, there are still a few things left to put in the formula. The immediate following step is the static "+2", which takes you from 0 to 2, and then the usual suspects: spread move penalty, weather, critical, random variation (which at this stage is really just "-1 damage, 15/16 of the time"), STAB...but none of them have anything to do with either side's stats at this point, and the end result will usually be in single digits from what little building can be done from that base of 2.

[UPDATE] As you may recall, the multipliers for stat stages/ranks go like this: -6 is 2/8, -5 is 2/7, ... +0 is 2/2, ... +6 is 8/2. The denominator in every case is at least 2, and they don't try to simplify the fractions...so of course, the stat is still capped at 16 bits even during the middle of this calculation. It can never happen in a real match with legal stats, but this means that during this step, stats effectively roll over at half the cap, or 32768. If you somehow had a raw stat of 8193 and went to +6, that would be 8/2 so you'd take 8193 * 8 (65544), wrap around to 8, and divide by 2 to get the effective stat value: 4 (although you could go on to boost this value with things like Choice Band).

I have a low-level damage calculation spreadsheet that you can make a copy of, and explore the nitty-gritty details of every possible rollover condition thus far.

The more you know?

Last edited:

#### DaWoblefet

##### Demonstrably so
If you're going to hack stats to unnatural levels, you might as well make them clean unnatural levels, so for example you could set a Pikachu's attack stat to 16384 then give it Huge Power and a Light Ball to go directly to 65536, wrapping around to a clean 0. 0-point attack stats can be realized even without hacking, by using the effects of Slow Start or Defeatist, and as expected, a 65536-point Attack stat behaves just like a 0. You do very little damage, even against weak opponents, not much to say about that.
I do have one thing to add! With SadisticMystic's research on 16-bit truncation for damage, it was demonstrated that this 65535 maximum is enforced after the check to make sure damage is at least 1. This allows us to deal 0 damage with an otherwise super-powered attack, as I have also showed with an independent setup. Typically, if a Base Power, Attack, or Defense would be 0, the game makes sure it becomes 1 prior to the start of the base damage calculation (seen below). However, a similar occurrence happens for the Attack and Defense should the effective Attack or Defense reach a multiple of 65536; when it's wrapped around back to 0, it stays at 0, and does not get bumped back up to one, and so 0 gets used in the initial base damage calculation.

Suppose you have a case like a level 100 Smeargle Transformed into a level 1 -6 Attack Archen that has 6 or 7 Attack, with Smeargle's HP being low enough for Defeatist to be active. Smeargle-Archen's Attack would first be quartered by the -6 stage in attack, and the result floored. Floor(6*0.25) = Floor(1.5) = 1. Defeatist further cuts this in half, and this time is pokeRounded down from a mere 0.5 to a lonely 0. However, this is bumped back up to 1 prior to the base damage because of an explicit check by the game to make sure an attack stat can't actually be 0 (little did they know we can bypass this with enormously high Attack stats!).

In my test with my Level 100 16384 Attack Huge Power Light Ball Pikachu, I dealt exactly 1 damage with a Double-Edge into a level 2 Buneary with 7 Defense. If you took this 16-bit cutoff to occur prior to the 1 Attack check, then our starting value for Attack should have been 1, not 0. But this doesn't line up with the math! Let's see what happens if we assume the Attack was 1:

$\dpi{150}&space;Base&space;Damage&space;=&space;Floor\left&space;\lfloor&space;\frac{Floor\left&space;\lfloor&space;\frac{Floor\left&space;\lfloor&space;\frac{2&space;\times&space;Level}{5}&space;+&space;2&space;\right&space;\rfloor&space;\times&space;Base&space;Power&space;\times&space;Attack}{Defense}&space;\right&space;\rfloor}{50}\right&space;\rfloor&space;+&space;2$

Plugging in our values, 100 for Level, 120 for Base Power, 1 for Attack and 7 for Defense, our base damage should have been 16. The random factor will allow this attack to have a range of damage from 13-16, but it cannot mathematically hit 1 damage.

However, if you had an initial value of 0 Attack, then the entire calculation gets essentially "zeroed out", leaving a lone 2 in its place. With the effect of the random factor, it should be possible to deal 1-2 damage with this attack - and that's exactly what Double-Edge did. Given that Defense enters the base damage formula as 0 as well (which is why we had to explain why the game didn't crash in an attempt to divide by 0), it seems consistent to say the following:
• For Attack, Defense, Base Power modifiers, and the final damage done at the end of damage calculation: after doing checks to make sure its value is at least 1, apply a 16-bit cutoff, so that the maximum amount of Attack, Defense, BP, or actual damage can at most be 65535.
EDIT: Speed also behaves in this way. A hacked Ditto with 32768 Speed and Quick Powder moved after a level 3 Caterpie. This notably implies the 16-bit check is done prior to the check for 10000 Speed.

Last edited:

#### Mijzelffan

Zoom Lens' description says "If the holder moves after the foe, its accuracy will be boosted.", does this include switches? I can't find research on this anywhere, and this mechanic has been known to differ between for instance analytic and payback.

#### Marty

##### Always more to find
Zoom Lens' description says "If the holder moves after the foe, its accuracy will be boosted.", does this include switches? I can't find research on this anywhere, and this mechanic has been known to differ between for instance analytic and payback.
Analytic and Payback behave differently because they're different mechanics. Payback checks if the target had its place in turn order before the user, and Analytic checks if the user moved last in turn order.

The difference between Payback in Gen 4 and Gen 5+ is that the action of switching in changed from counting as your position in turn order to counting as nothing for turn order, which is why it's boosted against switches in Gen 4 but not since then.

Since Analytic checks the user's own position in turn order, in Singles if your opponent switches out then the switch-in doesn't have a place in turn order, so even though technically you moved first you also moved last and you get the boost.

So to answer your question, Zoom Lens behaves the same way as Payback. Your target has to have been on the field and taken its turn before you.

#### VCrakeV

If a Pokemon holding a colbur berry is hit with knock off, can the berry be brought back with recycle or harvest?

Focus Sash, Colbur Berry, Enigma Berry, and Weakness Policy (assuming the target is weak to dark in the latter three cases) all get used up early enough that Knock Off will not print a message about knocking them off. Those items are then still eligible to be recovered with Recycle.

#### Feria-Aeris

I'm going to ask a weird question and use a weird replay for it, but I was told y'all might have an answer for me...

https://replay.pokemonshowdown.com/gen7metronomebattle-993197978

How was Kakuna's Synchronoise able to hit my Gallade and Gardevoir? Isn't that not supposed to happen? The current hypothesis is that since the other Kakuna was hit, the other guys were hit too... Any insight on this?