You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am doing a static analysis of the damage formula in Gen 7 / 8. Currently work-in-progress. I will continue editing as I find more. I will assist in fixing these!
Some moves have hardcoded BP instead of move.bp; these should be swapped to move.bp and move.bp * 2, etc. Payback, Acrobatics, Weather Ball
Some moves attempt to code in move failures by setting BP to 0; it should be more like weight moves into Dynamax instead of setting BP to 0. Poltergeist, Steel Roller
Expanding Force is a BP modifier, not a move with variable base power.
Misty Explosion is a BP modifier, not a move with variable base power. It should be checking for groundedness.
Rising Voltage is a BP modifier, not a move with variable base power. [probably, still need to prove]
Gyro Ball's formula is wrong; should be 1 + floor((25*target Speed) / user speed)
Nature Power should probably add a desc indicating what move it transformed into and not hardcode BP
Triple Axel hack is hack (but may as well be applied to Triple Kick while you're there)
Crush Grip / Wring Out implementation could be refactored for readability; I think it's technically correct
Smelling Salts into paralyzed target is missing, should be easy to add
BP modifiers
Generally speaking these should be applied in the following order, with some Speed checks (see link at top of issue):
Move effects
Field effects
Abilities
Items
Technician checks if a move is 60 or less after it evaluates moves with custom base power. It doesn't consider any base power modifiers. This was mistaken in Gen 7, it works the same way in 7 & 8.
Auras are dichotomous and applied in the same step. It's 5448 with Aura, 3072 with Aura Break; they aren't two separate modifiers.
Generally speaking these should be applied in the following order, with some Speed checks (see link at top of issue):
Abilities
Items
Hustle should be a standard 6144 / 4096
If Gorilla Tactics boosts attack, it shouldn't list the weather in the damage calculation
Torrent etc. should be comparing to floor(max HP / 3)
Stakeout should probably be checking for target switching like Analytic does
Pursuit is a move with custom base power, not an attack modifier lol
Defense modifiers
Generally speaking these should be applied in the following order, with some Speed checks (see link at top of issue):
Abilities
Items
Sandstorm Rock type should be a standard 6144 / 4096
Final damage modifiers
Generally speaking these should be applied in the following order, with some Speed checks (see link at top of issue):
Move effects
Side conditions
Abilities
Items
Screens should check for not Infiltrator
Punk Rock (offensive) should be a base power modifier
Fluffy checks should be ordered contact first, Fire-type second and immediately after each other (I would do if (fluffy), then inside the block if (contact) and if (Fire-type)
General damage modifiers
Base damage is calculated BP * Atk * (level thing) first and that can overflow; nothing else in base damage can overflow
Checks for harsh sunshine / heavy rain stopping moves from working should be before this point
Critical hit modifier should be times 15, divided by 10
getFinalDamage()
STAB actually should always have an implicit 4096/4096 applied (past DaWoblefet, what were you telling pre?!?!)
The burn modifier is 50 / 100
Applying final modifiers occurs before Z-move / Max Move into Protect.
Z-move / Max Move into Protect should also check if damage is 0, set to 1.
I would make return OF16(damageAmount) the final step for clarity
Overall
Z-move + items are inconsistently handled. For example, Expert Belt checks to make sure the move isn't a Z-move, but Life Orb doesn't. Imo you shouldn't do that kind of check (i.e. allow Expert Belt + Z-move).
Shell Side Arm function is called a lot; probably should save it in a const somewhere.
Nature stat overflow is not accounted for; not sure if this is by design or not with custom format support
^ leads to concerns with 0 Def the base damage calculation which you probably have to hardcode a handler for
Speed
The order would matter if you ever decided to support Pledge Swamp. Probably best to actually order and add a note "Pledge Swamp would go here".
Paralysis is * 50 / 100.
Speed can have a min value of 0 by natural means; for Gyro Ball, it sets BP to 1 if user Speed is 0, and for Electro Ball, it sets BP to 40 if target Speed is 0.
Weight
Light Metal and Float Stone together should quarter weight.
Weight multiplication is done with integers hectograms, not kilograms (i.e. you can't have a weight of 0.15kg). It also should round.
The text was updated successfully, but these errors were encountered:
I am doing a static analysis of the damage formula in Gen 7 / 8. Currently work-in-progress. I will continue editing as I find more. I will assist in fixing these!
Reference for how modifiers are actually chained: https://www.smogon.com/forums/threads/sword-shield-battle-mechanics-research.3655528/post-8685465
Moves with custom base power
BP modifiers
Generally speaking these should be applied in the following order, with some Speed checks (see link at top of issue):
Attack modifiers
Generally speaking these should be applied in the following order, with some Speed checks (see link at top of issue):
Defense modifiers
Generally speaking these should be applied in the following order, with some Speed checks (see link at top of issue):
Final damage modifiers
Generally speaking these should be applied in the following order, with some Speed checks (see link at top of issue):
General damage modifiers
getFinalDamage()
Overall
Speed
Weight
The text was updated successfully, but these errors were encountered: