Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current mechanics inaccuracies [WIP] #443

Open
DaWoblefet opened this issue Apr 25, 2021 · 1 comment
Open

Current mechanics inaccuracies [WIP] #443

DaWoblefet opened this issue Apr 25, 2021 · 1 comment

Comments

@DaWoblefet
Copy link
Member

DaWoblefet commented Apr 25, 2021

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

  • 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):

  1. Move effects
  2. Field effects
  3. Abilities
  4. Items

Attack modifiers

Generally speaking these should be applied in the following order, with some Speed checks (see link at top of issue):

  1. Abilities
  2. 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):

  1. Abilities
  2. 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):

  1. Move effects
  2. Side conditions
  3. Abilities
  4. 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@DaWoblefet and others