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] Moved code preventing MBH's transfer to post modifier generation #4858

Open
wants to merge 8 commits into
base: beta
Choose a base branch
from

Conversation

frutescens
Copy link
Collaborator

What are the changes the user will see?

MBH will no longer be able to be stolen from the opponent.

Why am I making these changes?

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

What are the changes from a developer perspective?

Code moved down to correct location.

How to test the changes?

Try to steal MBH when generated.

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)

@frutescens frutescens added the P2 Bug Minor. Non crashing Incorrect move/ability/interaction label Nov 12, 2024
@frutescens frutescens requested a review from a team as a code owner November 12, 2024 21:48
src/phases/encounter-phase.ts Outdated Show resolved Hide resolved
src/phases/encounter-phase.ts Outdated Show resolved Hide resolved
flx-sta
flx-sta previously approved these changes Nov 12, 2024
Copy link
Collaborator

@flx-sta flx-sta left a comment

Choose a reason for hiding this comment

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

Except that 1 comment lgtm

src/battle.ts Outdated Show resolved Hide resolved
DayKev
DayKev previously approved these changes Nov 13, 2024
@DayKev DayKev added the Item Affects an item label Nov 13, 2024
@PigeonBar
Copy link
Collaborator

It turns out that even with this fix, MBH becomes stealable again after reloading, because when the session data gets saved and reloaded, PersistentModifierData doesn't keep track of whether or not each individual modifier was set to be transferrable.

20241112.Stealable.MBH.mp4

@frutescens
Copy link
Collaborator Author

@PigeonBar I think I decided just to stop a potential transfer of MBH at the heart of the code - tryTransferModifier(). Not sure if it leads to other problems though.

@PigeonBar
Copy link
Collaborator

The issue is that tryTransferHeldItemModifier() is used in many places in the code. For example, your new changes would prevent transferring an MBH between party members during the rewards screen.

Some possible other approaches to fixing the bug:

  1. Give held items an isStealable property separate from isTransferrable -- This is needed anyway in the long run, but would also require more care and effort.
  2. Set the MBH to be non-transferrable during EncounterPhase.end() -- this runs after the MBH is generated, and it also runs no matter whether or not there was a reload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Item Affects an item P2 Bug Minor. Non crashing Incorrect move/ability/interaction
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

5 participants