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

Improve Dynamax/Max-Move support #390

Open
8 of 10 tasks
scheibo opened this issue Apr 21, 2020 · 6 comments
Open
8 of 10 tasks

Improve Dynamax/Max-Move support #390

scheibo opened this issue Apr 21, 2020 · 6 comments

Comments

@scheibo
Copy link
Contributor

scheibo commented Apr 21, 2020

https://www.smogon.com/forums/threads/sword-shield-battle-mechanics-research.3655528/

Original Max HP

  • It appears effects which deal damage or heal in fractions of max HP do so by calculating with the original max HP

This is difficult, because right now Pokemon#maxHP looks like

/* get */ maxHP() {
    return this.isDynamaxed ? this.rawStats.hp * 2 : this.rawStats.hp;
  }

We need to add an originalMaxHP method:

// Effects which deal damage or heal in fractions of max HP do sousing the original max HP
// (https://www.smogon.com/forums/threads/sword-shield-battle-mechanics-research.3655528/)
/* get */ originalMaxHP() {
    return this.rawStats.hp;
 }

I don't know everywhere this applies in the damage calc. in gen78.ts it seems fairly straightforward (though I could be wrong), but the difficult comes in desc.ts where recoil/healing/weather effects damage etc is taken into account.

SEE BELOW

@Lusamine @Marty-D @DaWoblefet might be able to help us here to figure out when we should be using which HP

Brine deals double damage based on the Dynamax HP (Anubis)

Huh? I would have naively just changed this check to use the defenders original max HP:

      (move.named('Brine') && defender.curHP <= defender.maxHP() / 2) ||

But this seems to contradict that?

Choice Band

  • Choice Band/Scarf/Specs move lock and stat boosts are ignored during the effect (Anubis)

Shedinja

  • Shedinja still has 1 max HP during the effect even if its Dynamax Level is maxed out (DaWoblefet)

Gorilla Tactics

  • Gorilla Tactics has no effect during Dynamax (Anubis)

I think we make a stab at implementing this, but its gotta be wrong - why is this not checking attacker.isDynamaxed?

 (attacker.hasAbility('Gorilla Tactics') &&
     !['Gmax', 'Dynamax'].some(s => attacker.name.includes(s)))

Max Guard

  • Deal 1/4 damage through protection moves other than Max Guard (Anubis and DaWoblefet

G-Max EOT

In progress: #395

  • G-Max Wildfire's end of turn damage is 1/6 max HP (Anubis)

  • G-Max Finale heals 1/6 of active allies' max HP, and does take into account the Dynamax max HP unlike other fractional healing effects (SolaceAcheron)

  • G-Max Centiferno and G-Max Sandblast start the Fire Spin and Sand Tomb effects, respectively, on both opponents, even if they have substitutes (Anubis), but the trapping and damage continues even if the user leaves the field. (Tangrowth_Fan) Both effects last 4-5 turns or 7 turns with Grip Claw. It appears both opponents receive the same turn count. (Anubis)

These would need to be implemented in desc.ts given they are EOT

Sheer Force

  • Sheer Force does not power up the moves or remove the effects (SadisticMystic)

-ate Moves

  • -ate moves should change typing while Dynamaxing, but should not get any increase in base power.
@Marty-D
Copy link
Contributor

Marty-D commented Apr 21, 2020

Sorry, that line is definitely unclear now. I'll make sure to clarify it next time I update the OP.

The difference is subtle for sure. For example, Super Fang, Pain Split, Endeavor, Innards Out, etc all look at current HP only (i.e. non-Dynamax current HP), while stuff like Brine and Zen Mode check both current and max HP to determine their threshold percentages, which is actually the same whether or not Dynamax is active since the HP scales. So really, "uses Dynamax HP" is a misnomer for everything but G-Max Finale. That's my understanding of everything at the moment, anyway.

@scheibo
Copy link
Contributor Author

scheibo commented Apr 21, 2020

We have 8 places where we call maxHP() in mechanics/gen78.ts and.... lots and lots in desc.ts. The hard part of implementing original max HP semantics is simply going through each of these places and changing calls to originalMaxHP() where appropriate, but from the sounds of it even research doesn't know where all of those places are?

while stuff like Brine and Zen Mode check both current and max HP to determine their threshold percentages, which is actually the same whether or not Dynamax is active since the HP scales.

I take back what I said above, I think given how we handle current HP in the calc this is not true, because its going to be a 'dynamax current HP' and we've lost the 'original current HP'. This is fairly problematic - I think:

  • curHP passed to the Pokemon constructor needs to be the current HP if the user was not dynamaxed
  • curHP turns into a method call like maxHP instead of being a property
  • curHP() and maxHP() do the this.isDynamaxed check to know whether to return a value which is 2x or not
  • curHP and maxHP both take an original = false parameter to determine whether or not to elide the this.isDynamaxed check, so the both the original and max current HPs can be obtatined for calculation purposes.

@Marty-D
Copy link
Contributor

Marty-D commented Apr 21, 2020

but from the sounds of it even research doesn't know where all of those places are?

Not off the top of my head! 😉
Given an effect and the above understanding of HP stuff, it can be figured out:

Does the effect check only one of current HP or max HP? --> use original HP
Does the effect check both current HP and max HP? --> use original or Dynamax HP, just be consistent
Is the effect G-Max Finale's 1/6 healing? --> use Dynamax HP

@DaWoblefet
Copy link
Member

DaWoblefet commented Apr 21, 2020

I personally think of it like this (which tends to be consistent for everything but G-Max Finale)

if a Pokemon has a certain % of HP (i.e. must be at a % of HP for condition to trigger), use Dynamaxed HP
otherwise, use max HP

I think Marty and I use the term "Dynamaxed HP" differently; when I say Dynamaxed HP, I'm encompassing both current HP while Dynamaxed and also max HP while Dynamaxed, but for base HP I'm referring to current HP sans Dynamax and also max HP sans Dynamax.

Also missing from this list in the OP (unless this is a to-do list): -ate moves should change typing while Dynamaxing, but should not get any increase in base power.

@scheibo
Copy link
Contributor Author

scheibo commented Apr 21, 2020

Did the low hanging fruit here. Better half implemented than not implemented at all. Thanks for all the research!

@Amaterasu5
Copy link

Hey! I'm not sure if this belongs here, but based on the thread title, it appears that it would. The calc currently doesn't handle max weather ball and terrain pulse correctly, where they should change into the max move corresponding to the weather and gain the damage+weather boost as well. I've attached a photo:
Screen Shot 2020-08-07 at 9 53 02 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants