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][Beta] Fix hit check so Poison-types do not brick semi-invuln. #4567

Merged

Conversation

Lneacx
Copy link
Contributor

@Lneacx Lneacx commented Oct 3, 2024

What are the changes the user will see?

Currently on beta, all Poison-type Pokemon ignore opposing semi-invulnerability due to a bug introduced by my PR #4445. This bug has not yet hit live servers. This PR fixes the issue so that only Toxic bypasses semi-invuln when used by Poison-types, which is the intended behavior.

Why am I making these changes?

I broke semi-invuln sorry but this should fix it. Thank you DerTapp, Snailman, and PigeonBar for noticing the bug that I caused and raising it to my attention so quickly on discord.

What are the changes from a developer perspective?

Previously my check for Toxic Accuracy attr was incorrect. What I intended to do was bypass semi-invuln if the move used has Toxic Accuracy attr and the user is Poison-type. But instead of checking if the move has a Toxic Accuracy attr, I got the array of all the move's attrs matching Toxic Accuracy attr. For all moves other than Toxic itself, this array would be empty. But all arrays in ts/js, even empty ones, are truthy. So in other words my implementation then caused all moves, when used by a Poison-type, to bypass semi-invuln.

This alters the hit check logic to match its intent, which is to actually check if the move has Toxic's accuracy instead of always evaluating that condition to true. I've also added a unit test for Toxic to test for this bug.

Screenshots/Videos

Before: Screen recording 2024-10-03 4.54.00 PM.webm

After: Screen recording 2024-10-03 4.56.59 PM.webm

How to test the changes?

Load
20241003 Semi-Invulnerable.txt (Credit: PigeonBar) and select Dive. Without this change, Crobat can hit you even through Dive; with this change, Crobat will no longer be able to hit you.

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 considered writing automated tests for the issue?
  • [ ] If I have text, did I make it translatable and add a key in the English locale file(s)?
  • Have I tested the changes (manually)?
    • Are all unit tests still passing? (npm run test) -> no, src/test/system/game_data.test.ts is failing. But it's also failing on beta, so I think this change is not the culprit.
  • Are the changes visual?
    • Have I provided screenshots/videos of the changes?

@Lneacx Lneacx requested a review from a team as a code owner October 3, 2024 23:59
@DayKev DayKev changed the title [Bug] Fix hit check so Poison-types do not brick semi-invuln. [Bug][Beta] Fix hit check so Poison-types do not brick semi-invuln. Oct 4, 2024
@DayKev DayKev added the P2 Bug Minor. Non crashing Incorrect move/ability/interaction label Oct 4, 2024
@Tempo-anon Tempo-anon merged commit 74ea358 into pagefaultgames:beta Oct 4, 2024
14 checks passed
@Lneacx Lneacx deleted the poison-semi-invulnerable-bugfix branch October 4, 2024 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Bug Minor. Non crashing Incorrect move/ability/interaction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants