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] Flip Stats Challenge #5087

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

Conversation

Scoooom
Copy link

@Scoooom Scoooom commented Jan 5, 2025

What are the changes the user will see?

Users will see a new challenge mode called Flipped Stats. This game mode swaps stats on all Pokémon in this way:

HP will be swapped with Speed
Attack will be swapped with Special Defense
Defense will be swapped with Special Attack
Special Attack will be swapped with Defense
Special Defense will be swapped with Attack
Speed will be swapped with HP

This encourages the use of more unconventional Pokémon who may otherwise not be so good.

Why am I making these changes?

There is a need and a want for more challenges that are not simply: Restrict Pokémon Usage.

Additionally, this PR will serve as a guide to others on how one creates a challenge and adds an achievement for it.

What are the changes from a developer perspective?

src/data/challenge.ts:

  • Added FlipStatChallenge class
  • Added relevant switch case in copyChallenge
  • Call FlipStatChallenge inside of initChallenges

src/enums/challenges.ts:

  • Added FLIP_STAT to export enum Challenges

src/field/pokemon.ts:

  • Added code to calculateBaseStats to check if this.scene.gameMode.isFlipStatChallenge is valid, and swap stat values accordingly.

src/game-mode.ts:

  • Added isFlipStatChallenge helped method

src/system/achv.ts:

  • Added the actual achievement text by adding to the switch case inside of getAchievementDescription
  • Added FLIP_STATS to the const achvs
  • Add blockers to other challenges, In the future, we need a helper function with a switch case.

Screenshots/Videos

How to test the changes?

  • Merge the code, and go to New -> Challenges -> Flip Stats (Locales are not done as I don't know how, so you see the raw tags)
  • Go to Menu -> Achievements -> Go to the bottom. Observe the grayed out Flip Stat achievement.
  • Complete the run, observe that it is now filled in.

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 tested the changes manually?
  • Are all unit tests still passing? (npm run test)
    • Test running in a screen atm. will update PR
    • 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:

@Scoooom Scoooom requested a review from a team as a code owner January 5, 2025 14:38
@damocleas damocleas added the Challenges Challenge mode/s related label Jan 5, 2025
@Scoooom
Copy link
Author

Scoooom commented Jan 5, 2025

Added the locales PR and added flipstat.png (Uses Pika cause Pokémon Shuffle.)

@Scoooom
Copy link
Author

Scoooom commented Jan 5, 2025

A tester (<@1286607980036493359>) found that they were not awarded the ribbon. I would appreciate help with that

@Scoooom Scoooom force-pushed the flip_stats_challange branch from 8792ffe to 6e332e4 Compare January 5, 2025 18:38
@Scoooom
Copy link
Author

Scoooom commented Jan 5, 2025

That has been fixed in the latest PR

src/data/challenge.ts Show resolved Hide resolved
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
src/data/challenge.ts Outdated Show resolved Hide resolved
src/data/challenge.ts Outdated Show resolved Hide resolved
src/field/pokemon.ts Outdated Show resolved Hide resolved
src/data/challenge.ts Show resolved Hide resolved
src/game-mode.ts Outdated Show resolved Hide resolved
src/game-mode.ts Outdated Show resolved Hide resolved
@DayKev DayKev added the Enhancement New feature or request label Jan 6, 2025
@Scoooom
Copy link
Author

Scoooom commented Jan 7, 2025

This is ready for review @DayKev @damocleas.

I am still running a final npm run test in a screen. When it's done I will let you know of the result

@Scoooom
Copy link
Author

Scoooom commented Jan 7, 2025

All checks pass as far as I can tell

Test Files  323 passed | 1 skipped (324)
      Tests  1763 passed | 17 skipped | 5 todo (1785)
   Start at  19:05:57
   Duration  1125.30s (transform 30.40s, setup 2916.07s, collect 96.47s, tests 4221.87s, environment 336.62s, prepare 65.79s)

src/system/achv.ts Outdated Show resolved Hide resolved
src/system/achv.ts Outdated Show resolved Hide resolved
@Scoooom
Copy link
Author

Scoooom commented Jan 7, 2025

Accepted merge suggestion

@Scoooom
Copy link
Author

Scoooom commented Jan 7, 2025

Questions, is && c.value > 0 needed when c.value is already checked for mono gen and mono type?

  MONO_GEN_ONE_VICTORY: new ChallengeAchv("MONO_GEN_ONE", "",  "MONO_GEN_ONE.description", "ribbon_gen1", 100, (c, scene) => c instanceof SingleGenerationChallenge && c.value === 1 && !scene.gameMode.challenges.some(c => [ Challenges.INVERSE_BATTLE, Challenges.FLIP_STAT ].includes(c.id) && c.value > 0)),

@DayKev
Copy link
Collaborator

DayKev commented Jan 7, 2025

Questions, is && c.value > 0 needed when c.value is already checked for mono gen and mono type?

  MONO_GEN_ONE_VICTORY: new ChallengeAchv("MONO_GEN_ONE", "",  "MONO_GEN_ONE.description", "ribbon_gen1", 100, (c, scene) => c instanceof SingleGenerationChallenge && c.value === 1 && !scene.gameMode.challenges.some(c => [ Challenges.INVERSE_BATTLE, Challenges.FLIP_STAT ].includes(c.id) && c.value > 0)),

Each challenge has it's own value being checked there, it's not the same c.value each time.

@Scoooom
Copy link
Author

Scoooom commented Jan 7, 2025

Ah you're right. didn't see the nesting parans

@Scoooom
Copy link
Author

Scoooom commented Jan 7, 2025

Not sure if I needed to do this, but

 Test Files  323 passed | 1 skipped (324)
      Tests  1763 passed | 17 skipped | 5 todo (1785)
   Start at  21:20:32
   Duration  1114.71s (transform 30.85s, setup 2857.17s, collect 90.73s, tests 4264.32s, environment 335.74s, prepare 65.44s)

DayKev
DayKev previously approved these changes Jan 8, 2025
@DayKev
Copy link
Collaborator

DayKev commented Jan 8, 2025

Code should be good. 👍

@Scoooom
Copy link
Author

Scoooom commented Jan 9, 2025

One last change, after speaking with Art and Balance, you can now earn Flip Stat AND Inverse in the same run, and you gain an additional achievement for doing so. Swapped image for FLIP_STAT to Dubious Disc, and the combined achievement uses Cracked Pot

@Scoooom
Copy link
Author

Scoooom commented Jan 9, 2025

I slightly suspect that

scene.gameMode.challenges.some(c => [ Challenges.INVERSE_BATTLE, Challenges.FLIP_STAT ].includes(c.id)

is not the code I want to FLIP_INVERSE as won't that be true if only one is true?

@Scoooom
Copy link
Author

Scoooom commented Jan 9, 2025

Look at me, figured it out on my own.

scene.gameMode.challenges.every(c => [ Challenges.INVERSE_BATTLE, Challenges.FLIP_STAT ].includes(c.id)

@Scoooom
Copy link
Author

Scoooom commented Jan 9, 2025


 Test Files  323 passed | 1 skipped (324)
      Tests  1763 passed | 17 skipped | 5 todo (1785)
   Start at  00:47:15
   Duration  1110.46s (transform 32.66s, setup 2849.14s, collect 93.73s, tests 4238.51s, environment 334.74s, prepare 65.08s)

[rogue@rogue pokerogue]$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Challenges Challenge mode/s related Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants