pokerogue icon indicating copy to clipboard operation
pokerogue copied to clipboard

Add window showing number of eggs hatching during hatch phase

Open torranx opened this issue 8 months ago • 1 comments

Resolves #1289

What are the changes?

  • Window on top left of screen showing number of eggs hatching during hatch phase. This will only show up if there are 2 or more eggs hatching.

Why am I doing these changes?

  • To let the user know how many eggs are queued for hatching, giving an idea how long will it take to finish hatching.

What did change?

  • Added new class container for the hatching eggs count window.

Screenshots/Videos

Screenshot 2024-05-27 at 3 42 06 PM
  • 1 egg hatching

https://github.com/pagefaultgames/pokerogue/assets/68144167/49ce5c23-f4e1-4f43-ba41-0516ec189e13

  • 2 or more eggs hatching

https://github.com/pagefaultgames/pokerogue/assets/68144167/07f4b0f8-29d1-4b30-bcf0-04da27314570

  • > 9 eggs hatching (window will adjust if it reaches <= 9)

https://github.com/pagefaultgames/pokerogue/assets/68144167/b3f2dd02-d182-419b-b678-34b43ec62363

How to test the changes?

  • In src/system/game-data.ts, find the code:
this.eggs = systemData.eggs
          ? systemData.eggs.map(e => e.toEgg())
          : [];

Replace the above code with:

const eggsTestData = [
          { id: 1, gachaType: GachaType.MOVE, hatchWaves: 1, timestamp: 1625123456 },
          { id: 2, gachaType: GachaType.LEGENDARY, hatchWaves: 1, timestamp: 1625124567 },
          { id: 3, gachaType: GachaType.SHINY, hatchWaves: 1, timestamp: 1625125678 },
          { id: 4, gachaType: GachaType.MOVE, hatchWaves: 1, timestamp: 1625126789 },
          { id: 5, gachaType: GachaType.LEGENDARY, hatchWaves: 1, timestamp: 1625127890 },
          { id: 6, gachaType: GachaType.SHINY, hatchWaves: 1, timestamp: 1625128901 },
          { id: 7, gachaType: GachaType.MOVE, hatchWaves: 1, timestamp: 1625129012 },
          { id: 8, gachaType: GachaType.LEGENDARY, hatchWaves: 1, timestamp: 1625130123 },
          { id: 9, gachaType: GachaType.SHINY, hatchWaves: 1, timestamp: 1625131234 },
          { id: 10, gachaType: GachaType.MOVE, hatchWaves: 1, timestamp: 1625132345 }
        ];

        const eggDataArray: EggData[] = eggsTestData.map(data => new EggData(data));

        this.eggs = eggDataArray.map(eggData => eggData.toEgg());
  • In src/phases.ts, find the code:
const eggsToHatch: Egg[] = this.scene.gameData.eggs.filter((egg: Egg) => {
      return --egg.hatchWaves < 1;
    });

Replace the return value with 1

Checklist

  • [x] Have I checked that there is no overlap with another PR?
  • [x] Have I made sure the PR is self-contained and cannot be split into smaller PRs?
  • [x] Have I provided a clear explanation of the changes?
  • [x] Have I tested the changes (manually)?
  • [x] Are the changes visual?
  • [x] Have I provided screenshots/videos of the changes?

torranx avatar May 27 '24 07:05 torranx