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

Tera Blast vs Unaware #9381

Open
hreine2 opened this issue Feb 3, 2023 · 5 comments
Open

Tera Blast vs Unaware #9381

hreine2 opened this issue Feb 3, 2023 · 5 comments

Comments

@hreine2
Copy link

hreine2 commented Feb 3, 2023

https://replay.pokemonshowdown.com/gen9randombattle-1790972745

On turn 53, it appears that Dondozo's Unaware is causing Tera Blast to ignore stat stages, resulting in Regidrago's Tera Blast being special (as is default since at base it has equal Atk and SpAtk in randoms) despite being at +2 Atk. I don't know how this interaction works on cartridge, but at the very least the calc believes it should be doing physical damage.

+2 Lvl 81 84 Atk Life Orb Tera Steel Regidrago Tera Blast vs. +6 Lvl 79 84 HP / 84 Def Unaware Tera Fairy Dondozo: 42-55 (11.4 - 14.9%) -- possibly the worst move ever

It using SpAtk instead lines up with the calc if it weren't +2 Atk.

Lvl 81 84 SpA Life Orb Tera Steel Regidrago Tera Blast vs. Lvl 79 84 HP / 84 SpD Tera Fairy Dondozo: 257-304 (70 - 82.8%) -- guaranteed 2HKO after Leftovers recovery

@DaWoblefet
Copy link
Member

Confirming this is still a bug: https://replay.pokemonshowdown.com/gen9customgame-1902916108

Unaware shouldn't cause Tera Blast to change its category. I think there's potentially a lot more Unaware-related bugs like this out there, too, since we run the event for Unaware any time pokemon#getStat or pokemon#calculateStat are called.

@vingkan
Copy link
Contributor

vingkan commented Dec 27, 2023

Trying to understand the consequences of changing code related to this issue:

Why are there separate functions for getStat() and calculateStat()?

As far as I can tell, the major differences between the two functions are:

  1. getStat() has the parameters unboosted and unmodified that allow optionally ignoring boosts and modifiers. The Tera Blast onModifyMove() function uses this to ignore modifiers, but keep boosts.
  2. calculateStat() has a parameter statUser to change the target Pokemon when modifying boosts. This helped solve the issue affected Foul Play and Unaware in @pyuk-bot's PR Fix interaction between Unaware and Foul Play #9397.
  3. getStat() runs the Modify${statName} event, while calculateStat() does not.
  4. calculateStat() uses Battle.modify() to calculate the result of modifiers and check for truncation, while getStat() only seems to truncate if the speed stat is checked.

@vingkan
Copy link
Contributor

vingkan commented Dec 27, 2023

I proposed a solution in #10030 that only changes the logic for Tera Blast. Let me know what you think!

@vingkan
Copy link
Contributor

vingkan commented Dec 27, 2023

I think there's potentially a lot more Unaware-related bugs like this out there, too, since we run the event for Unaware any time pokemon#getStat or pokemon#calculateStat are called.

What other cases do you have in mind?

Maybe some of these moves have weird interactions with Unaware?

For abilities, I think Unaware is the only one that would cause this kind of interaction because no other ability (excluding mods) uses a ModifyBoost handler.

I spot-checked some stat-raising abilities (stat stage boosts only) and they used different kinds of handlers to apply their effects to the boost table before or after stat and damage calculation. I also spot-checked some stat-increasing abilities (stat/move modifiers and other methods) and these should already be ignored by Tera Blast because the unmodified parameter skips them.

@urkerab
Copy link
Contributor

urkerab commented Dec 27, 2023

Why are there separate functions for getStat() and calculateStat()?

Because damage calculation is complicated. A few examples:

  • Body Press' damage is boosted by effects such as Choice Band and Huge Power, even though it's based on your Def
  • Chip Away, Darkest Lariat and Sacred Sword ignore defensive boots
  • If the move is a critical hit then it ignores unfavourable boosts (both offensive and defensive)

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

5 participants
@vingkan @urkerab @DaWoblefet @hreine2 and others