rh-hideout / pokeemerald-expansion

Feature branches for the pokeemerald decompilation. See the wiki for more info.
310 stars 832 forks source link

Dynamax and Tera expire early or incorrectly #4827

Open Pokabbie opened 3 weeks ago

Pokabbie commented 3 weeks ago

Description

I don't have a lot to go off sadly, but my project has a modified version of 1.7.4 which contains the tera changes During my last week of play tests I have had an issue reported 3 times where dynamax/tera will just switch off seemingly randomly (no animation or indication that it happens)

In the case of Dynamax, it's immediately obvious as the player will be able to suddenly select their regular moves the indicator disappears but the red tint is still applied. Entering the bag or pokemon menu and backing out will remove the tint. However the HP never gets reverted which to me implies it's not going through the usual UndoDynamax method. image

Tera is much harder to spot, in the reported case the mon was hit by a water type move that was super effective even though he had previously tera'd into an Electric type. Entering a menu had the same effect of clearing the visual tint. image

Sadly I have no solid repo for this atm I'll keep this post updated whenever I next learn anything on this issue

Version

1.7.4

Upcoming/master Version

No response

Discord contact info

Pokabbie

Pokabbie commented 1 week ago

Somehow, I found it! It was AI_CalcDamage altering the dynamax & tera state for it's calcs but not correctly restoring the state at the end of the method

I found this in some debugging session. I had Dynamax enabled. Both me and the opponent had this team https://pokepast.es/20227ca909302ebc I had all lvl100s, the AI had all lvl5s

The steps which reproduced this 100% for me were: -Start Battle -Swap into Skeledirge -Spam hex and 1 shot each mon until Brambleghast comes up (The mons should get sent out in the order they are listed due to the level difference) -Dynamax and select max flare -Mimikyu comes out next -Entered the bugged state

In that bugged state you have regular moves and massive HP but you will never revert back to normal I'll try to pull a fix across and setup tests when I have time. But I'm incredibly busy atm so can't promise I'll be able to any time soon 😅

If anyone does need the fix, this is how I fixed it: https://github.com/Pokabbie/pokeemerald-rogue/commit/c9499beab94ab4abf18251c4cc8b880e2fc760f0