-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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] Rewrite Move Effect Phase #4887
Open
innerthunder
wants to merge
9
commits into
pagefaultgames:beta
Choose a base branch
from
innerthunder:move-effect-phase-refactor
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] Rewrite Move Effect Phase #4887
innerthunder
wants to merge
9
commits into
pagefaultgames:beta
from
innerthunder:move-effect-phase-refactor
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
innerthunder
force-pushed
the
move-effect-phase-refactor
branch
from
November 17, 2024 20:34
c6702d1
to
e9b4ed5
Compare
innerthunder
force-pushed
the
move-effect-phase-refactor
branch
from
November 17, 2024 20:43
06a6ab4
to
f421b5d
Compare
PigeonBar
reviewed
Nov 19, 2024
Co-authored-by: PigeonBar <[email protected]>
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?
What are the changes from a developer perspective?
I figure it's better to list the changes before justifying them...
phases/move-effect-phase
:hitCheck
now returns aHitCheckEntry
, which consists of aHitCheckResult
and the type effectiveness multiplier of the phase's move against the given target. TheHitCheckResults
this function can now return are as follows:HIT
: The move successfully hit the targetNO_EFFECT
: The target is immune to the move.NO_EFFECT_NO_MESSAGE
: The target is immune to the move, and the immunity effect plays its own message instead of the default "It doesn't affect {target}!"PROTECTED
: The target protected itself against the move.MISS
: The move failed the accuracy check and missed the target.ERROR
: The move failed unexpectedly (e.g. the move's user isundefined
)Hit check entries against each of the move's targets are cached in the phase's new
hitChecks
field to be used throughout the phase's other functions. Hit check entries are initialized in aPENDING
state, but each hit check should be overwritten before effects apply.If no hit check results in a
HIT
, the phase will end without playing the move's animation (unless the move has aPOST_TARGET
effect like Explosion).Pokemon.apply
has been moved from thePokemon
class toMoveEffectPhase.applyMove
. Critical hit resolution and damage calculations are still done withinPokemon
methods.PRE_APPLY
move effects are now triggered before this method is called (but only when the move successfully hits).POST_APPLY
andHIT
move effect triggers have been condensed into a singlePOST_APPLY
trigger (WIP). Target-facing secondary effects generally no longer trigger when the move hits a substitute (fixes [Bug] Certain Move and Ability Effects (BattlerTags) Work through Substitute #4764 )Helper functions for different move effect trigger types have been generalized into a single
triggerMoveEffect
function.Removed
MoveEffectPhase.stopMultiHit
andPokemon.stopMultiHit
. Multi-hit early stopping is now done with the help of added code inMEPhase.end
(and modifications tohitCount
andhitsLeft
in some edge cases)Other minor adjustments to field-targeting moves (not a complete fix), immunity checks, and general cleanup.
Why am I making these changes?
Aside from fixing the bugs listed above (among others), this should allow for cleaner implementations of moves and abilities that interact with the phase for several reasons:
Pokemon
function to apply move damage brought about unnecessary scope issues, especially having to do with type immunity checks and multi-hit logic. Moving this function toMoveEffectPhase
allows developers to modify most, if not all, aspects of a move's effects in one place.POST_APPLY
andHIT
move effect triggers has become increasingly unclear. It'd be nice to condense trigger types that are ultimately redundant.PRE_APPLY
move effects currently have no way of actually applying before the move's effectiveness and/or damage were calculated. This fixes that.Screenshots/Videos
How to test the changes?
npm run test
(still fixing some tests)Checklist
beta
as my base branchnpm run test
)