-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Refactor] [Docs] Minor refactor of move.checkFlags
into move.doesFlagEffectApply
#5264
Open
SirzBenjie
wants to merge
8
commits into
pagefaultgames:beta
Choose a base branch
from
SirzBenjie:refactor-move-check-flag
base: beta
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Refactor] [Docs] Minor refactor of move.checkFlags
into move.doesFlagEffectApply
#5264
SirzBenjie
wants to merge
8
commits into
pagefaultgames:beta
from
SirzBenjie:refactor-move-check-flag
+40
−19
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6315dfc
to
33957b8
Compare
Wlowscha
previously approved these changes
Feb 7, 2025
Xavion3
previously approved these changes
Feb 13, 2025
Madmadness65
previously approved these changes
Feb 16, 2025
06da392
8f4d978
to
06da392
Compare
Wlowscha
previously approved these changes
Feb 25, 2025
DayKev
reviewed
Mar 6, 2025
7fb32de
to
2474553
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the changes the user will see?
Technically, this fixes an unreported bug where moves called by metronome would improperly not ignore abilities if the user had mold breaker.
Why am I making these changes?
@Wlowscha and I had a long discussion in discord about the fact that the
checkFlags
method inside moves was confusing.This class is the ideal place, adhering to the Separation of Concerns design principal, for moves to check whether a flag of theirs can be applied in a given situation (given that the existing structure of the code does not have move instances for moves that are in flight).
However, the name of the method is potentially confusing, and has likely contributed to the method not being used in cases where it probably should be (note, refactoring those uses is not in the scope of this PR).
The signature of the method was also changed in a proactive effort to keep the function's signature from looking like
which is very unwieldly to invoke in cases where you just want to override the default for a later parameter (e.g., in the above case,
simulated
).There are likely circumstances where this method would want to be called with additional options to check. For example, in my implementation of Magic Bounce which would like to have its logic for checking the
reflectable
flag reside here, rather than in the body of themove-effect
phase. Using the parameter destructuring pattern keeps code churn small and improves readability. It also has the added benefit of making the arguments at callsites more explicit w.r.t. the parameter they correspond to.What are the changes from a developer perspective?
moves.checkFlags
has been renamed tomoves.doesFlagEffectApply
. Its signature has similarly been changed to use parameter destructring.The check for
this.followUp
when determining whether or not to set theignoreAbilities
global inmove-phase
has been removed, as the check is now done inside this method. The check logic forMoveFlags.IGNORE_ABILITIES
has been modified to returnfalse
if the source of the flag was from a move that was being used as a follow up.Screenshots/Videos
N/A
How to test the changes?
N/A
Checklist
beta
as my base branch[ ] Have I tested the changes manually?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?[ ] Has the translation team been contacted for proofreading/translation?