[Bug][Ability] Fix mold breaker effect lingering if the user's move runs out of PP #5265
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the changes the user will see?
Mold breaker will now no longer suppress abilities when its user uses a move with its last pp.
Why am I making these changes?
I was asked to look into this odd interaction with mold breaker

What are the changes from a developer perspective?
In
move-phase
'send
method,MoveEndPhase
will always be unshifted, instead of only if the move was not called via a follow up and an erroneous check to thecanMove
call (which would previously returnfalse
after the move's pp had been deducted, as thecanMove
check also looks at the remaining pp).Instead,
this.followUp
is now passed as an argument to theMoveEndPhase
constructor which is called unconditionally byend
.MoveEndPhase
takes a new optional parameter -wasFollowUp
that is checked before lapsingBattlerTagLapseType.AFTER_MOVE
.I don't know the interactions that would cause this lapse to need to not happen when a move is called via a follow up (something with Encore it looks like). This behavior, however, is consistent with what would happen prior to this PR.
Screenshots/Videos
Note me highlighting the lack (or presence of, in the fixed version) of the MoveEndPhase in the console.
Before the fix
mold-breaker-lure-bug-trimmed.mp4
After the fix
mold-breaker-pp-fix-condensed.mp4
How to test the changes?
Boy oh boy is testing this complicated. We went through a lot of discussion in the
#endless-grinding
channel on discord to figure out exactly how to trigger this bug. (first message link here: https://discord.com/channels/1125469663833370665/1225619031156064317/1337131126992539725)In short, I was able to reproduce this after a lot of effort with the following set up:
Alternatively, you can have an ally with the double-lure abilities/passive where one of them is ignorable (e.g. watchog with illuminate / no guard).
For the lure test (which the video depicts), you'll need to get yourself into a situation where you have run out of PP at the same time as you KO the last enemy pokemon in a double battle with your mold breaker user, AND make sure your watchog ally has used its move that turn already. (If a move is used after the PP drops, the ignoreAbilities arena flag will be cleared by that move's MoveEndPhase).
The wave that you do this on has to be before there will be a trainer or boss, as these will nullify the lures. I did my test on wave 109.
When you KO the last pokemon, without this bugfix, the
ignoreAbilities
modifier will be true. Since No Guard is an ignorable ability, when checking for abilities that have the lure effect, it will be ignored. When moving on to the next battle, if it isn't a double battle, that means that no guard's lure ability didn't trigger.Alternatively, you may be able to whip up a scenario with a slightly easier way to test it, though I didn't end up testing it this way:
Get a pokemon to have mold breaker and an easily-confirmed ignorable passive, like earth eater / levitate. Make sure your ally pokemon does not have mold breaker or an intervening ability. Have your ally have a single-target ground type move, and have it go after your mold breaker ally. Have your mold breaker ally use a damaging move on its last PP, and then have its ally use a ground move on your mold breaker pokemon. This must happen before any enemy moves intervene, so it's best if you use a spread move and KO both opponents.
Before the change, mold breaker would have erroneously still been active, and so the ground move would go through levitate / earth eater.
With the change, this should not happen.
Checklist
beta
as my base branchnpm run test
)npm run create-test
) or updated existing tests related to the PR's changes?[ ] Have I made sure that any UI change works for both UI themes (default and legacy)?Are there any localization additions or changes? If so:
[ ] Has a locales PR been created on the locales repo?[ ] If so, please leave a link to it here:[ ] Has the translation team been contacted for proofreading/translation?