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

[Challenge] Add Trick room challenge #4343

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

Conversation

KimJeongSun
Copy link
Collaborator

@KimJeongSun KimJeongSun commented Sep 20, 2024

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?

  • add trick room challenge
  • reverse TrickRoomTag when challenge activated
  • add achievement for it (update achievement logic to disable other challenges' achievement like inverse battle challenge)
  • invert starting speed IV

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
Screenshot 2024-09-21 at 1 42 56 AM Screenshot 2024-09-21 at 1 43 21 AM

How to test the changes?

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 considered writing automated tests for the issue?
  • If I have text, did I make it translatable and add a key in the English locale file(s)?
  • Have I tested the changes (manually)?
    • Are all unit tests still passing? (npm run test)
  • Are the changes visual?
    • Have I provided screenshots/videos of the changes?

@KimJeongSun KimJeongSun added the Challenges Challenge mode/s related label Sep 20, 2024
@KimJeongSun KimJeongSun changed the base branch from main to beta September 20, 2024 15:49
@KimJeongSun KimJeongSun marked this pull request as ready for review September 20, 2024 16:48
@KimJeongSun KimJeongSun requested review from a team as code owners September 20, 2024 16:48
src/data/challenge.ts Outdated Show resolved Hide resolved
src/data/challenge.ts Outdated Show resolved Hide resolved
src/data/challenge.ts Outdated Show resolved Hide resolved
@KimJeongSun KimJeongSun marked this pull request as draft September 20, 2024 17:12
src/data/challenge.ts Outdated Show resolved Hide resolved
src/data/challenge.ts Outdated Show resolved Hide resolved
src/data/challenge.ts Show resolved Hide resolved
src/data/challenge.ts Outdated Show resolved Hide resolved
@@ -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);
Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

image

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;
    });

src/system/achv.ts Outdated Show resolved Hide resolved
@KimJeongSun KimJeongSun marked this pull request as ready for review September 20, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Challenges Challenge mode/s related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants