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

[Refactor][UI/UX] Reducing permanent memory occupation from Starter Select and Pokédex #5351

Draft
wants to merge 3 commits into
base: beta
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions src/ui/pokedex-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@

export default class PokedexUiHandler extends MessageUiHandler {
private starterSelectContainer: Phaser.GameObjects.Container;
private starterBoxContainer: Phaser.GameObjects.Container;
private starterSelectScrollBar: ScrollBar;
private filterBarContainer: Phaser.GameObjects.Container;
private filterBar: FilterBar;
Expand Down Expand Up @@ -437,23 +438,23 @@
this.pokemonFormText.setOrigin(0, 0);
this.starterSelectContainer.add(this.pokemonFormText);

const starterBoxContainer = globalScene.add.container(speciesContainerX + 6, 9); //115
this.starterBoxContainer = globalScene.add.container(speciesContainerX + 6, 9); //115

this.starterSelectScrollBar = new ScrollBar(161, 12, 5, pokemonContainerWindow.height - 6, 9);

starterBoxContainer.add(this.starterSelectScrollBar);
this.starterBoxContainer.add(this.starterSelectScrollBar);

this.pokerusCursorObjs = new Array(POKERUS_STARTER_COUNT).fill(null).map(() => {
const cursorObj = globalScene.add.image(0, 0, "select_cursor_pokerus");
cursorObj.setVisible(false);
cursorObj.setOrigin(0, 0);
starterBoxContainer.add(cursorObj);
this.starterBoxContainer.add(cursorObj);
return cursorObj;
});

this.cursorObj = globalScene.add.image(0, 0, "select_cursor");
this.cursorObj.setOrigin(0, 0);
starterBoxContainer.add(this.cursorObj);
this.starterBoxContainer.add(this.cursorObj);

for (const species of allSpecies) {
this.speciesLoaded.set(species.speciesId, false);
Expand All @@ -467,7 +468,7 @@
pokemonContainer.setPosition(pos.x, pos.y);
this.iconAnimHandler.addOrUpdate(pokemonContainer.icon, PokemonIconAnimMode.NONE);
this.pokemonContainers.push(pokemonContainer);
starterBoxContainer.add(pokemonContainer);

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (10) / Shard 10 of 10

test/abilities/dancer.test.ts > Abilities - Dancer > triggers when dance moves are used, doesn't consume extra PP

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/dancer.test.ts:25:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (10) / Shard 10 of 10

test/abilities/heatproof.test.ts > Abilities - Heatproof > reduces Fire type damage by half

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/heatproof.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (10) / Shard 10 of 10

test/abilities/heatproof.test.ts > Abilities - Heatproof > reduces Burn damage by half

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/heatproof.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (10) / Shard 10 of 10

test/abilities/libero.test.ts > Abilities - Libero > ability applies and changes a pokemon's type

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/libero.test.ts:32:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (10) / Shard 10 of 10

test/abilities/libero.test.ts > Abilities - Libero > ability applies correctly even if the pokemon's move has a variable type

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/libero.test.ts:32:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

test/abilities/battle_bond.test.ts > Abilities - BATTLE BOND > check if fainted pokemon switches to base form on arena reset

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/battle_bond.test.ts:29:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

test/abilities/battle_bond.test.ts > Abilities - BATTLE BOND > should not keep buffing Water Shuriken after Greninja switches to base form

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/battle_bond.test.ts:29:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

test/abilities/honey_gather.test.ts > Abilities - Honey Gather > should give money when winning a battle

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/honey_gather.test.ts:25:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

test/abilities/honey_gather.test.ts > Abilities - Honey Gather > should not give money when the enemy pokemon flees

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/honey_gather.test.ts:25:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (1) / Shard 1 of 10

test/abilities/honey_gather.test.ts > Abilities - Honey Gather > should not give money when the player flees

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/honey_gather.test.ts:25:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

test/escape-calculations.test.ts > Escape chance calculations > single non-boss opponent

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/escape-calculations.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

test/escape-calculations.test.ts > Escape chance calculations > double non-boss opponent

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/escape-calculations.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

test/escape-calculations.test.ts > Escape chance calculations > single boss opponent

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/escape-calculations.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

test/escape-calculations.test.ts > Escape chance calculations > double boss opponent

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/escape-calculations.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (7) / Shard 7 of 10

test/misc.test.ts > Test misc > test fetch mock async

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/misc.test.ts:22:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

test/abilities/arena_trap.test.ts > Abilities - Arena Trap > should guarantee double battle with any one LURE

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/arena_trap.test.ts:24:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

test/abilities/arena_trap.test.ts > Abilities - Arena Trap > should lift if pokemon with this ability leaves the field

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/arena_trap.test.ts:24:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

test/abilities/battery.test.ts > Abilities - Battery > raises the power of allies' special moves by 30%

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/battery.test.ts:28:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

test/abilities/battery.test.ts > Abilities - Battery > does not raise the power of allies' non-special moves

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/battery.test.ts:28:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (9) / Shard 9 of 10

test/abilities/battery.test.ts > Abilities - Battery > does not raise the power of the ability owner's special moves

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/abilities/battery.test.ts:28:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (6) / Shard 6 of 10

test/endless_boss.test.ts > Endless Boss > should spawn a minor boss every 250 waves in END biome in Endless

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/endless_boss.test.ts:23:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (6) / Shard 6 of 10

test/endless_boss.test.ts > Endless Boss > should spawn a major boss every 1000 waves in END biome in Endless

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/endless_boss.test.ts:23:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (6) / Shard 6 of 10

test/endless_boss.test.ts > Endless Boss > should spawn a minor boss every 250 waves in END biome in Spliced Endless

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/endless_boss.test.ts:23:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (6) / Shard 6 of 10

test/endless_boss.test.ts > Endless Boss > should spawn a major boss every 1000 waves in END biome in Spliced Endless

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/endless_boss.test.ts:23:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (6) / Shard 6 of 10

test/endless_boss.test.ts > Endless Boss > should NOT spawn major or minor boss outside wave 250s in END biome

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/endless_boss.test.ts:23:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (2) / Shard 2 of 10

test/boss-pokemon.test.ts > Boss Pokemon / Shields > Pokemon should get shields based on their Species and level and the current wave

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/boss-pokemon.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (2) / Shard 2 of 10

test/boss-pokemon.test.ts > Boss Pokemon / Shields > should reduce the number of shields if we are in a double battle

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/boss-pokemon.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (2) / Shard 2 of 10

test/boss-pokemon.test.ts > Boss Pokemon / Shields > shields should stop overflow damage and give stat stage boosts when broken

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/boss-pokemon.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (2) / Shard 2 of 10

test/boss-pokemon.test.ts > Boss Pokemon / Shields > breaking multiple shields at once requires extra damage

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/boss-pokemon.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (2) / Shard 2 of 10

test/boss-pokemon.test.ts > Boss Pokemon / Shields > the number of stat stage boosts is consistent when several shields are broken at once

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/boss-pokemon.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (3) / Shard 3 of 10

test/final_boss.test.ts > Final Boss > should spawn Eternatus on wave 200 in END biome

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/final_boss.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (3) / Shard 3 of 10

test/final_boss.test.ts > Final Boss > should NOT spawn Eternatus before wave 200 in END biome

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/final_boss.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (3) / Shard 3 of 10

test/final_boss.test.ts > Final Boss > should NOT spawn Eternatus outside of END biome

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/final_boss.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (3) / Shard 3 of 10

test/final_boss.test.ts > Final Boss > should not have passive enabled on Eternatus

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/final_boss.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (3) / Shard 3 of 10

test/final_boss.test.ts > Final Boss > should change form on direct hit down to last boss fragment

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/final_boss.test.ts:26:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (5) / Shard 5 of 10

test/reload.test.ts > Reload > should not have RNG inconsistencies in a Classic run

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/reload.test.ts:28:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (5) / Shard 5 of 10

test/reload.test.ts > Reload > should not have RNG inconsistencies after a biome switch

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/reload.test.ts:28:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (5) / Shard 5 of 10

test/reload.test.ts > Reload > should not have weather inconsistencies after a biome switch

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/reload.test.ts:28:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (5) / Shard 5 of 10

test/reload.test.ts > Reload > should not have RNG inconsistencies at a Daily run wild Pokemon fight

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/reload.test.ts:28:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (5) / Shard 5 of 10

test/reload.test.ts > Reload > should not have RNG inconsistencies at a Daily run double battle

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/reload.test.ts:28:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

test/battle-scene.test.ts > BattleScene > should remove LoadingScene on create

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/battle-scene.test.ts:16:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

test/battle-scene.test.ts > BattleScene > should also reset RNG on reset

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/battle-scene.test.ts:16:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

test/daily_mode.test.ts > Daily Mode > should initialize properly

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/daily_mode.test.ts:24:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

test/daily_mode.test.ts > Shop modifications > should not have Eviolite and Mini Black Hole available in Classic if not unlocked

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/daily_mode.test.ts:55:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (4) / Shard 4 of 10

test/daily_mode.test.ts > Shop modifications > should have Eviolite and Mini Black Hole available in Daily

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/daily_mode.test.ts:55:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

test/evolution.test.ts > Evolution > should keep hidden ability after evolving

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/evolution.test.ts:25:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

test/evolution.test.ts > Evolution > should keep same ability slot after evolving

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/evolution.test.ts:25:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

test/evolution.test.ts > Evolution > should handle illegal abilityIndex values

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/evolution.test.ts:25:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

test/evolution.test.ts > Evolution > should handle nincada's unique evolution

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/evolution.test.ts:25:12

Check failure on line 471 in src/ui/pokedex-ui-handler.ts

View workflow job for this annotation

GitHub Actions / Run Tests (8) / Shard 8 of 10

test/evolution.test.ts > Evolution > should set wild delay to NONE by default

ReferenceError: starterBoxContainer is not defined ❯ PokedexUiHandler.setup src/ui/pokedex-ui-handler.ts:471:7 ❯ UI.setup src/ui/ui.ts:227:15 ❯ BattleScene.launchBattle src/battle-scene.ts:804:8 ❯ BattleScene.create src/battle-scene.ts:525:10 ❯ GameWrapper.setScene test/testUtils/gameWrapper.ts:103:16 ❯ new GameManager test/testUtils/gameManager.ts:90:22 ❯ test/evolution.test.ts:25:12
}

// Tray to display forms
Expand All @@ -480,11 +481,11 @@
this.trayCursorObj = globalScene.add.image(0, 0, "select_cursor");
this.trayCursorObj.setOrigin(0, 0);
this.formTrayContainer.add(this.trayCursorObj);
starterBoxContainer.add(this.formTrayContainer);
starterBoxContainer.bringToTop(this.formTrayContainer);
this.starterBoxContainer.add(this.formTrayContainer);
this.starterBoxContainer.bringToTop(this.formTrayContainer);
this.formTrayContainer.setVisible(false);

this.starterSelectContainer.add(starterBoxContainer);
this.starterSelectContainer.add(this.starterBoxContainer);

this.pokemonSprite = globalScene.add.sprite(96, 143, "pkmn__sub");
this.pokemonSprite.setPipeline(globalScene.spritePipeline, { tone: [ 0.0, 0.0, 0.0, 0.0 ], ignoreTimeTint: true });
Expand Down Expand Up @@ -562,6 +563,13 @@

show(args: any[]): boolean {

for (const species of this.allSpecies) {
const pokemonContainer = new PokedexMonContainer(species).setVisible(false);
this.iconAnimHandler.addOrUpdate(pokemonContainer.icon, PokemonIconAnimMode.NONE);
this.pokemonContainers.push(pokemonContainer);
this.starterBoxContainer.add(pokemonContainer);
}

if (!this.starterPreferences) {
this.starterPreferences = StarterPrefs.load();
}
Expand Down Expand Up @@ -2165,6 +2173,14 @@
clear(): void {
super.clear();

this.pokemonContainers.forEach(obj => {
this.starterBoxContainer.remove(obj, true); // Removes from container and destroys it
});
this.pokemonContainers = [];
// These arrays must be emptied too, or garbage is not collected properly
this.validPokemonContainers = [];
this.filteredPokemonContainers = [];

this.cursor = -1;
this.oldCursor = -1;
globalScene.ui.hideTooltip();
Expand Down
39 changes: 24 additions & 15 deletions src/ui/starter-select-ui-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ interface SpeciesDetails {

export default class StarterSelectUiHandler extends MessageUiHandler {
private starterSelectContainer: Phaser.GameObjects.Container;
private starterBoxContainer: Phaser.GameObjects.Container;
private starterSelectScrollBar: ScrollBar;
private filterBarContainer: Phaser.GameObjects.Container;
private filterBar: FilterBar;
Expand Down Expand Up @@ -634,27 +635,25 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.randomCursorObj.setOrigin(0, 0);
this.starterSelectContainer.add(this.randomCursorObj);

const starterSpecies: Species[] = [];

const starterBoxContainer = globalScene.add.container(speciesContainerX + 6, 9); //115
this.starterBoxContainer = globalScene.add.container(speciesContainerX + 6, 9); //115

this.starterSelectScrollBar = new ScrollBar(161, 12, 5, starterContainerWindow.height - 6, 9);

starterBoxContainer.add(this.starterSelectScrollBar);
this.starterBoxContainer.add(this.starterSelectScrollBar);

this.pokerusCursorObjs = new Array(POKERUS_STARTER_COUNT).fill(null).map(() => {
const cursorObj = globalScene.add.image(0, 0, "select_cursor_pokerus");
cursorObj.setVisible(false);
cursorObj.setOrigin(0, 0);
starterBoxContainer.add(cursorObj);
this.starterBoxContainer.add(cursorObj);
return cursorObj;
});

this.starterCursorObjs = new Array(6).fill(null).map(() => {
const cursorObj = globalScene.add.image(0, 0, "select_cursor_highlight");
cursorObj.setVisible(false);
cursorObj.setOrigin(0, 0);
starterBoxContainer.add(cursorObj);
this.starterBoxContainer.add(cursorObj);
return cursorObj;
});

Expand All @@ -666,25 +665,19 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.starterIconsCursorObj.setOrigin(0, 0);
this.starterSelectContainer.add(this.starterIconsCursorObj);

starterBoxContainer.add(this.cursorObj);
this.starterBoxContainer.add(this.cursorObj);

this.starterSelectContainer.add(this.starterBoxContainer);

for (const species of allSpecies) {
if (!speciesStarterCosts.hasOwnProperty(species.speciesId) || !species.isObtainable()) {
continue;
}

starterSpecies.push(species.speciesId);
this.speciesLoaded.set(species.speciesId, false);
this.allSpecies.push(species);

const starterContainer = new StarterContainer(species).setVisible(false);
this.iconAnimHandler.addOrUpdate(starterContainer.icon, PokemonIconAnimMode.NONE);
this.starterContainers.push(starterContainer);
starterBoxContainer.add(starterContainer);
}

this.starterSelectContainer.add(starterBoxContainer);

this.starterIcons = new Array(6).fill(null).map((_, i) => {
const icon = globalScene.add.sprite(teamWindowX + 7, calcStarterIconY(i), "pokemon_icons_0");
icon.setScale(0.5);
Expand Down Expand Up @@ -947,6 +940,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}

show(args: any[]): boolean {

for (const species of this.allSpecies) {
const starterContainer = new StarterContainer(species).setVisible(false);
this.iconAnimHandler.addOrUpdate(starterContainer.icon, PokemonIconAnimMode.NONE);
this.starterContainers.push(starterContainer);
this.starterBoxContainer.add(starterContainer);
}

if (!this.starterPreferences) {
// starterPreferences haven't been loaded yet
this.starterPreferences = StarterPrefs.load();
Expand Down Expand Up @@ -3916,6 +3917,14 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.activeTooltip = undefined;
globalScene.ui.hideTooltip();

this.starterContainers.forEach(obj => {
this.starterBoxContainer.remove(obj, true); // Removes from container and destroys it
});
this.starterContainers = [];
// These arrays must be emptied too, or garbage is not collected properly
this.validStarterContainers = [];
this.filteredStarterContainers = [];

this.starterSelectContainer.setVisible(false);
this.blockInput = false;

Expand Down
Loading