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

[Bug] Prevent battle skip with Wimp Out #4931

Merged
merged 18 commits into from
Nov 30, 2024

Conversation

muscode13
Copy link
Contributor

@muscode13 muscode13 commented Nov 21, 2024

What are the changes the user will see?

Wimp Out triggering in a double battle shouldn't skip battles

Why am I making these changes?

Bug: https://discord.com/channels/1125469663833370665/1290778513363959941

What are the changes from a developer perspective?

Pokémon are prevented from taking damage if they're switching out or fleeing, via checks of Pokemon.switchOutStatus.

Checks also added to turn-end-phase.ts and weather-effect-phase.ts to prevent messages showing up for fled pokemon

Screenshots/Videos

Wimpod
https://github.com/user-attachments/assets/650fa836-bf52-4874-9369-ca8cc2f669af

Thundercage (Posturn effect)

thundercage.mp4

Toxic

toxic.mp4

Weather

weather.mp4

How to test the changes?

Double battle with Wimpods, target Right Wimpod with a priority move to make it flee, target both with a spread move. It shouldn't skip battles.

Checklist

  • I'm using beta as my base branch
  • There is no overlap with another PR?
  • The PR is self-contained and cannot be split into smaller PRs?
  • Have I provided a clear explanation of the changes?
  • Have I tested the changes manually?
  • Are all unit tests still passing? (npm run test)
    • Have I created new automated tests (npm run create-test) or updated existing tests related to the PR's changes?
  • Have I provided screenshots/videos of the changes (if applicable)?
    • 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?

@muscode13 muscode13 requested a review from a team as a code owner November 21, 2024 21:01
@DayKev
Copy link
Collaborator

DayKev commented Nov 22, 2024

Couldn't you use Pokemon.switchOutStatus instead? From what I can tell it's supposed to be true when a Pokémon is switching out or fleeing.

@muscode13 muscode13 changed the title [Bug] Add flee variable to turnData, prevent battle skip with Wimp Out [Bug] Prevent battle skip with Wimp Out Nov 22, 2024
Copy link
Collaborator

@DayKev DayKev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine to me, a simple fix. We still need a test added though.

src/field/pokemon.ts Outdated Show resolved Hide resolved
muscode13 and others added 2 commits November 22, 2024 09:52
@muscode13 muscode13 requested a review from DayKev November 22, 2024 17:20
@Tempo-anon Tempo-anon added Ability Affects an ability P2 Bug Minor. Non crashing Incorrect move/ability/interaction labels Nov 22, 2024
Copy link
Collaborator

@DayKev DayKev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple test nits.

src/test/abilities/wimp_out.test.ts Outdated Show resolved Hide resolved
src/test/abilities/wimp_out.test.ts Outdated Show resolved Hide resolved
src/test/abilities/wimp_out.test.ts Outdated Show resolved Hide resolved
@muscode13 muscode13 requested a review from DayKev November 23, 2024 20:28
@muscode13
Copy link
Contributor Author

@DayKev Added some more checks to turn-end-phase.ts and weather-effect-phase.ts to prevent messages showing up from weather, traps, etc. I've also attached new videos to show that. Let me know what you think!

DayKev
DayKev previously approved these changes Nov 26, 2024
innerthunder
innerthunder previously approved these changes Nov 28, 2024
torranx
torranx previously approved these changes Nov 28, 2024
@frutescens frutescens dismissed stale reviews from innerthunder and DayKev via d32d7dc November 29, 2024 01:48
src/field/pokemon.ts Outdated Show resolved Hide resolved
@PigeonBar
Copy link
Contributor

Based on a quick search for other places where updateAndDamage() is called, here are a few more edge cases that probably need a check for switchOutStatus:

PostWeatherLapseAbAttr (e.g., Dry Skin in harsh sun):

this.executeForAll((pokemon: Pokemon) => applyPostWeatherLapseAbAttrs(PostWeatherLapseAbAttr, pokemon, this.weather));

Flame Burst splash damage:
targetAlly.damageAndUpdate(Math.max(1, Math.floor(1 / 16 * targetAlly.getMaxHp())), HitResult.OTHER);

Grass + Fire Pledge arena effect:
pokemon.damageAndUpdate(toDmgValue(pokemon.getMaxHp() / 8));

Bad Dreams ability:
opp.damageAndUpdate(Utils.toDmgValue(opp.getMaxHp() / 8), HitResult.OTHER);

(There may be a cleaner approach than having to place switchOutStatus checks everywhere, but I'm not sure how to attempt something like that.)

@DayKev
Copy link
Collaborator

DayKev commented Nov 30, 2024

Based on a quick search for other places where updateAndDamage() is called, here are a few more edge cases that probably need a check for switchOutStatus:

Added checks in the mentioned places.

@MokaStitcher
Copy link
Contributor

MokaStitcher commented Nov 30, 2024

ugh, I managed to trigger a battle skip when testing, but i wasn't recording so i don't remember exactly how 😭
I'll try and do it again...

edit: Good news, I have it on tape. Bad news, the first time I did it it was a double battle, and the second time was a single battle...
(i've been using the override to switch between single and double battles though so maybe that doesn't help...)
I have also been testing with using multi hit moves so that may be part of the issue and wouldn't happen with the fix in #4935

Copy link
Contributor

@MokaStitcher MokaStitcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty sure my issues when testing were related to multi hit moves as I couldn't reproduce them without. lgtm

Copy link
Contributor

@PigeonBar PigeonBar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time to find out what this green button does

@MokaStitcher
Copy link
Contributor

Time to find out what this green button does

For a moment I thought you were talking about the merge button :D

@DayKev DayKev merged commit 5af2bcd into pagefaultgames:beta Nov 30, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ability Affects an ability P2 Bug Minor. Non crashing Incorrect move/ability/interaction
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants