-
-
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
[Challenge] Add Trick room challenge #4343
base: beta
Are you sure you want to change the base?
[Challenge] Add Trick room challenge #4343
Conversation
Co-authored-by: NightKev <[email protected]>
Co-authored-by: NightKev <[email protected]>
Co-authored-by: NightKev <[email protected]>
@@ -52,6 +53,7 @@ export class TurnStartPhase extends FieldPhase { | |||
// Next, a check for Trick Room is applied. If Trick Room is present, the order is reversed. | |||
const speedReversed = new Utils.BooleanHolder(false); | |||
this.scene.arena.applyTags(TrickRoomTag, speedReversed); | |||
applyChallenges(this.scene.gameMode, ChallengeType.TRICK_ROOM, speedReversed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think optimize this you should instead do that check before orderedTargets.sort
is ran and adjust the sort function instead. Cause afaik the reverse()
+ a sort before takes quite some resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about this?
// Next, a check for Trick Room is applied to determine sort order.
const speedReversed = new Utils.BooleanHolder(false);
this.scene.arena.applyTags(TrickRoomTag, speedReversed);
applyChallenges(this.scene.gameMode, ChallengeType.TRICK_ROOM, speedReversed);
// Adjust the sort function based on whether Trick Room is active.
orderedTargets.sort((a: Pokemon, b: Pokemon) => {
const aSpeed = a?.getEffectiveStat(Stat.SPD) || 0;
const bSpeed = b?.getEffectiveStat(Stat.SPD) || 0;
return speedReversed.value ? aSpeed - bSpeed : bSpeed - aSpeed;
});
What are the changes the user will see?
can enjoy trick room challenge! let's Snorlax!
Why am I making these changes?
@Tempo-anon 's suggestion! thanks for the idea!
What are the changes from a developer perspective?
Screenshots/Videos
( overrided starting level=100 and starting wave = 21 and 201 for clear screenshot )
Screen.Recording.2024-09-21.at.12.14.01.AM.mp4
How to test the changes?
Checklist
beta
as my base branchnpm run test
)