-
-
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] Align ability display with mainline #5267
Draft
emdeann
wants to merge
40
commits into
pagefaultgames:beta
Choose a base branch
from
emdeann:ability_display
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.
Draft
+1,346
−1,061
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
…to ability_display
…into ability_display
…to ability_display
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
Todo:
Ability issues are quite prevalent right now, probably best to leave this one in draft until some of them are sorted
HideAbilityPhase
need to be separate fromShowAbilityPhase
? Think I like it better this way but it's a lot of duplicate codeapply
, which almost certainly existapply
Why am I making these changes?
To make ability display as a whole stop feeling janky
What are the changes from a developer perspective?
apply
(and friends) ofAbAttr
is now split into two functions:canApply
, which handles the logic of whether an ability can apply or not in the current situation, andapply
, which actually applies the ability's effects. This is necessary to allow "looking into the future" to see whether an ability will succeed.applyAbAttrsInternal
now takes an additional function parametersuccessFunc
, which is treated essentially identically toapplyFunc
. The various forms ofapply...AbAttrs
are edited to match this.In the process of refactoring I pulled some code common to Magician and Pickpocket's attributes and made it into helper functions. I also added a
simulated
parameter totryTransferHeldItemModifier
inBattleScene
so that that method can be used either as a test (i.e. incanApply...
) or to apply its effect (i.e. inapply...
). For the most part I separated "can" and "do" logic for these changes, but with the promise weirdness of magician and pickpocket it didn't seem worth it.Arena
now hascanSet(Weather/Terrain)
in addition totrySet(Weather/Terrain)
to allow checking those conditions without actually changing the arena.Phase.start()
andMessagePhase
no longer do anything ability bar related. It's all handled by the ability-related phases nowShowAbilityPhase
now stores the pokemon and ability names as strings rather than storing the object, because abilities which directly modify properties may change the pokemon object before it's shown (i.e. imposter would show the copied ability from the opponent, not "Imposter").HideAbilityPhase
now handles hiding the ability. This is done as a separate phase as opposed to just a timer on the tween inAbilityBar
because in mainline, the ability shows -> the ability's effects happen -> the ability hides. That is how it's implemented here; ifapply
adds a phase (stat change, etc.) the bar won't be hidden until that phase finishes. Worth noting thatHideAbilityPhase
is extremely similar toShowAbilityPhase
to the point where it might be worth making them one class to avoid duplication of code.(Show/Hide)AbilityPhase
being blocking allowed significant simplification ofAbilityBar
.Screenshots/Videos
Old ability bar:
old.mp4
old2.mp4
New:
new.mp4
new2.mp4
(Post summon abilities aren't the only things changed by this, but are the easiest to show)
How to test the changes?
hopefully automated tests sometime
Checklist
beta
as my base branchnpm run test
)npm run create-test
) or updated existing tests related to the PR's changes?