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

[Hotfix] Prevent Future Sight crash with new catches, attempt 2 #4910

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

MokaStitcher
Copy link
Collaborator

@MokaStitcher MokaStitcher commented Nov 18, 2024

What are the changes the user will see?

Catching and releasing a Pokemon that used Future Sight on the turn FS was supposed to trigger will no longer freeze the game.

Why am I making these changes?

Discord bug report

What are the changes from a developer perspective?

At the moment FS goes through a move effect phase so it expects the user Pokemon to be around to perform hit checks and other things. For a Pokemon that was caught and released the turn FS would hit a lot of its attributes are gone at this point, causing the checks to crash the game.
One of the undefined attributes is the Pokemon's scene reference, which should get solved in the future with PR #4766
So hopefully this will just resolve itself with that in the future

As FS is still P and I'm not entirely sure that it should go through hit checks and everything in the first place, I don't really want to add null/undefined checks everywhere for this. So for now instead the Move Effect Phase is just ended and so FS will not hit in this specific scenario. Of note, FS already does not trigger if you catch and release the Pokemon one turn before FS is supposed to hit, so this makes the overall behavior a little more consistent.

Screenshots/Videos

Before:
image

After:

screen-20241118-190151.2.mp4

How to test the changes?

Overrides:
  MOVESET_OVERRIDE: Moves.FALSE_SWIPE,
  OPP_MOVESET_OVERRIDE: Moves.FUTURE_SIGHT,
  STARTING_LEVEL_OVERRIDE: 50,
  STARTING_WAVE_OVERRIDE: 9,
  POKEBALL_OVERRIDE: {
    active: true,
    pokeballs: {
      [PokeballType.POKEBALL]: 5,
      [PokeballType.GREAT_BALL]: 0,
      [PokeballType.ULTRA_BALL]: 0,
      [PokeballType.ROGUE_BALL]: 0,
      [PokeballType.MASTER_BALL]: 99,
    }
  }

Start the run with a full team

  • Turn 1: Stall so that the Pokemon uses Future Sight
  • Turn 2: Stall
  • Turn 3: Catch the Pokemon and release it. Game should continue as normal. FS will not hit
Unchanged scenarios:
  • Release - 1 turn before FS hit

    • Turn 1: Stall so that the Pokemon uses Future Sight
    • Turn 2: Catch it. Release it. Game should continue as normal. FS will not hit (was already the case before this PR)
  • Keep - 1 turn before FS hit

    • Turn 1: Stall so that the Pokemon uses Future Sight
    • Turn 2: Catch it. Put in the team. Game should continue as normal and FS will hit the following turn
  • Keep - turn of FS hit

    • Turn 1: Stall so that the Pokemon uses Future Sight
    • Turn 2: Stall
    • Turn 3: Catch it. Put in the team. Game should continue as normal and FS will hit

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)
  • Are the changes visual?
    • Have I provided screenshots/videos of the changes?

@MokaStitcher MokaStitcher merged commit 0c920ba into pagefaultgames:main Nov 18, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants