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 crash if enemy Future Sight user is caught #4905

Merged
merged 4 commits into from
Nov 18, 2024

Conversation

DayKev
Copy link
Collaborator

@DayKev DayKev commented Nov 18, 2024

What are the changes the user will see?

The game will no longer crash if a Pokémon that used Future Sight is caught.

Why am I making these changes?

Bug report: https://discord.com/channels/1125469663833370665/1307871092261523567

What are the changes from a developer perspective?

If the user of the move in MoveEffectPhase has no turn data and it's a delayed attack (ie: Future Sight), initialize it.
Pokemon.pushMoveHistory() checks if the Pokémon is on the field and returns early if it isn't.

Screenshots/Videos

future.sight.crash.fix.mp4

How to test the changes?

Use these overrides and start a new run. Stall the first turn so the enemy Pokémon uses Future Sight, then catch it the next turn. In the following turn, do whatever, and get hit by the Future Sight attack. At this point the game should continue on as normal instead of crashing.

const overrides = {
  OPP_MOVESET_OVERRIDE: Moves.FUTURE_SIGHT,
  POKEBALL_OVERRIDE: {
    active: true,
    pokeballs: {
      [PokeballType.POKEBALL]: 5,
      [PokeballType.GREAT_BALL]: 0,
      [PokeballType.ULTRA_BALL]: 0,
      [PokeballType.ROGUE_BALL]: 0,
      [PokeballType.MASTER_BALL]: 110,
    },
  }
} satisfies Partial<InstanceType<typeof DefaultOverrides>>;

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?

@DayKev DayKev added Move Affects a move P1 Bug Major. Game crashing move/ability/interaction labels Nov 18, 2024
@DayKev DayKev requested a review from a team as a code owner November 18, 2024 01:50
xsn34kzx
xsn34kzx previously approved these changes Nov 18, 2024
Copy link
Collaborator

@xsn34kzx xsn34kzx left a comment

Choose a reason for hiding this comment

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

Make sure to bump the patch version with npm version patch --force --no-git-tag-version 🏃🏼 otherwise, lgtm!

@DayKev DayKev merged commit dd904fe into pagefaultgames:main Nov 18, 2024
14 checks passed
@DayKev DayKev deleted the fix-future-sight branch November 18, 2024 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Move Affects a move P1 Bug Major. Game crashing move/ability/interaction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants