From 81f9e2da365e69f2ee8a9f7d662d8c5727780816 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 15 Mar 2024 21:59:34 -0400 Subject: [PATCH] Add WiP logic for daily run and fix some performance issues --- ...er_select_cursor.png => select_cursor.png} | Bin ...hlight.png => select_cursor_highlight.png} | Bin .../ui/select_cursor_highlight_thick.png | Bin 0 -> 115 bytes ..._pokerus.png => select_cursor_pokerus.png} | Bin ...t_gen_cursor.png => select_gen_cursor.png} | Bin ...ht.png => select_gen_cursor_highlight.png} | Bin src/battle-scene.ts | 61 +++++++++--- src/data/daily-run.ts | 47 ++++++++++ src/field/arena.ts | 3 +- src/field/pokemon.ts | 14 ++- src/game-mode.ts | 27 ++++++ src/phases.ts | 88 +++++++++++------- src/pipelines/field-sprite.ts | 2 +- src/system/game-data.ts | 2 +- src/system/game-stats.ts | 4 + src/ui/achvs-ui-handler.ts | 2 +- src/ui/egg-list-ui-handler.ts | 2 +- src/ui/game-stats-ui-handler.ts | 8 +- src/ui/save-slot-select-ui-handler.ts | 4 +- src/ui/settings-ui-handler.ts | 2 +- src/ui/starter-select-ui-handler.ts | 15 +-- src/ui/vouchers-ui-handler.ts | 2 +- 22 files changed, 213 insertions(+), 70 deletions(-) rename public/images/ui/{starter_select_cursor.png => select_cursor.png} (100%) rename public/images/ui/{starter_select_cursor_highlight.png => select_cursor_highlight.png} (100%) create mode 100644 public/images/ui/select_cursor_highlight_thick.png rename public/images/ui/{starter_select_cursor_pokerus.png => select_cursor_pokerus.png} (100%) rename public/images/ui/{starter_select_gen_cursor.png => select_gen_cursor.png} (100%) rename public/images/ui/{starter_select_gen_cursor_highlight.png => select_gen_cursor_highlight.png} (100%) create mode 100644 src/data/daily-run.ts diff --git a/public/images/ui/starter_select_cursor.png b/public/images/ui/select_cursor.png similarity index 100% rename from public/images/ui/starter_select_cursor.png rename to public/images/ui/select_cursor.png diff --git a/public/images/ui/starter_select_cursor_highlight.png b/public/images/ui/select_cursor_highlight.png similarity index 100% rename from public/images/ui/starter_select_cursor_highlight.png rename to public/images/ui/select_cursor_highlight.png diff --git a/public/images/ui/select_cursor_highlight_thick.png b/public/images/ui/select_cursor_highlight_thick.png new file mode 100644 index 0000000000000000000000000000000000000000..d9a1532862ebd1eae7ede5684d7d1bef94c9c78c GIT binary patch literal 115 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|D^C~45R22vDG3P)1~I??+cUF1 zs4-AhR$kh6fPs6{$|n*G#T>%SQxB|gT+G%h p <= PokeballType.MASTER_BALL).map(t => [ t, 0 ])); this.pokeballCounts[PokeballType.POKEBALL] += 5; @@ -767,13 +778,14 @@ export default class BattleScene extends Phaser.Scene { p.destroy(); this.currentBattle = null; + this.waveCountText.setText(startingWave.toString()); this.waveCountText.setVisible(false); this.updateMoneyText(); this.moneyText.setVisible(false); - this.newArena(startingBiome, true); + this.newArena(STARTING_BIOME_OVERRIDE || Biome.TOWN, true); this.arenaBgTransition.setPosition(0, 0); this.arenaPlayer.setPosition(300, 0); @@ -1009,7 +1021,7 @@ export default class BattleScene extends Phaser.Scene { return this.arena.getSpeciesFormIndex(species); } - getWaveCycleOffset(): integer { + private getGenerateWaveCycleOffset(): integer { let ret = 0; this.executeWithSeedOffset(() => { ret = Utils.randSeedInt(8) * 5; @@ -1170,6 +1182,29 @@ export default class BattleScene extends Phaser.Scene { return filteredSpecies[Utils.randSeedInt(filteredSpecies.length)]; } + generateRandomBiome(waveIndex: integer): Biome { + const relWave = waveIndex % 250; + const biomes = Utils.getEnumValues(Biome).slice(1, Utils.getEnumValues(Biome).filter(b => b >= 40).length * -1); + const maxDepth = biomeDepths[Biome.END][0] - 2; + const depthWeights = new Array(maxDepth + 1).fill(null) + .map((_, i: integer) => ((1 - Math.min(Math.abs((i / (maxDepth - 1)) - (relWave / 250)) + 0.25, 1)) / 0.75) * 250); + const biomeThresholds: integer[] = []; + let totalWeight = 0; + for (let biome of biomes) { + totalWeight += Math.ceil(depthWeights[biomeDepths[biome][0] - 1] / biomeDepths[biome][1]); + biomeThresholds.push(totalWeight); + } + + const randInt = Utils.randSeedInt(totalWeight); + + for (let biome of biomes) { + if (randInt < biomeThresholds[biome]) + return biome; + } + + return biomes[Utils.randSeedInt(biomes.length)]; + } + checkInput(): boolean { if (this.blockInput) return; diff --git a/src/data/daily-run.ts b/src/data/daily-run.ts new file mode 100644 index 00000000000..69870205463 --- /dev/null +++ b/src/data/daily-run.ts @@ -0,0 +1,47 @@ +import BattleScene from "../battle-scene"; +import { PlayerPokemon } from "../field/pokemon"; +import { GameModes, gameModes } from "../game-mode"; +import { Starter } from "../ui/starter-select-ui-handler"; +import * as Utils from "../utils"; +import { Species } from "./enums/species"; +import { getPokemonSpecies, speciesStarters } from "./pokemon-species"; + +export interface DailyRunConfig { + seed: integer; + starters: Starter; +} + +export function getDailyRunSeed(scene: BattleScene): string { + return 'Test';//Utils.randomString(16) +} + +export function getDailyRunStarters(scene: BattleScene): Starter[] { + const seed = getDailyRunSeed(scene); + const starters: Starter[] = []; + + scene.executeWithSeedOffset(() => { + const starterWeights = []; + starterWeights.push(Math.round(3.5 + Math.abs(Utils.randSeedGauss(1)))); + starterWeights.push(Utils.randSeedInt(9 - starterWeights[0], 1)); + starterWeights.push(10 - (starterWeights[0] + starterWeights[1])); + + for (let s = 0; s < starterWeights.length; s++) { + const weight = starterWeights[s]; + const weightSpecies = Object.keys(speciesStarters) + .map(s => parseInt(s) as Species) + .filter(s => speciesStarters[s] === weight); + const starterSpecies = getPokemonSpecies(Phaser.Math.RND.pick(weightSpecies)); + const pokemon = new PlayerPokemon(scene, starterSpecies, gameModes[GameModes.DAILY].getStartingLevel(), undefined, undefined, undefined, undefined, undefined, undefined, undefined); + const starter: Starter = { + species: starterSpecies, + dexAttr: pokemon.getDexAttr(), + nature: pokemon.nature, + pokerus: pokemon.pokerus + }; + starters.push(starter); + pokemon.destroy(); + } + }, 0, seed); + + return starters; +} \ No newline at end of file diff --git a/src/field/arena.ts b/src/field/arena.ts index 033b39f101e..4ab21af474e 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -11,7 +11,6 @@ import { Type } from "../data/type"; import Move from "../data/move"; import { ArenaTag, ArenaTagSide, getArenaTag } from "../data/arena-tag"; import { ArenaTagType } from "../data/enums/arena-tag-type"; -import { GameModes } from "../game-mode"; import { TrainerType } from "../data/enums/trainer-type"; import { BattlerIndex } from "../battle"; import { Moves } from "../data/enums/moves"; @@ -357,7 +356,7 @@ export class Arena { return TimeOfDay.NIGHT; } - const waveCycle = ((this.scene.currentBattle?.waveIndex || 0) + this.scene.getWaveCycleOffset()) % 40; + const waveCycle = ((this.scene.currentBattle?.waveIndex || 0) + this.scene.waveCycleOffset) % 40; if (waveCycle < 15) return TimeOfDay.DAY; diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index d5b2b0f1543..cbfaea49d45 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1932,7 +1932,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { } destroy(): void { - this.battleInfo.destroy(); + this.battleInfo?.destroy(); super.destroy(); } } @@ -2046,8 +2046,10 @@ export class PlayerPokemon extends Pokemon { this.abilityIndex = abilityCount - 1; this.compatibleTms.splice(0, this.compatibleTms.length); this.generateCompatibleTms(); - this.scene.gameData.setPokemonSeen(this, false); - this.scene.gameData.setPokemonCaught(this, false); + if (!this.scene.gameMode.isDaily || this.metBiome > -1) { + this.scene.gameData.setPokemonSeen(this, false); + this.scene.gameData.setPokemonCaught(this, false); + } this.loadAssets().then(() => { this.calculateStats(); this.updateInfo(true).then(() => resolve()); @@ -2091,8 +2093,10 @@ export class PlayerPokemon extends Pokemon { this.abilityIndex = abilityCount - 1; this.compatibleTms.splice(0, this.compatibleTms.length); this.generateCompatibleTms(); - this.scene.gameData.setPokemonSeen(this, false); - this.scene.gameData.setPokemonCaught(this, false); + if (!this.scene.gameMode.isDaily || this.metBiome > -1) { + this.scene.gameData.setPokemonSeen(this, false); + this.scene.gameData.setPokemonCaught(this, false); + } this.loadAssets().then(() => { this.calculateStats(); this.scene.updateModifiers(true, true); diff --git a/src/game-mode.ts b/src/game-mode.ts index 45f30388527..439b1b95d79 100644 --- a/src/game-mode.ts +++ b/src/game-mode.ts @@ -1,3 +1,6 @@ +import BattleScene, { STARTING_BIOME_OVERRIDE, STARTING_LEVEL_OVERRIDE, STARTING_MONEY_OVERRIDE } from "./battle-scene"; +import { Biome } from "./data/enums/biome"; + export enum GameModes { CLASSIC, ENDLESS, @@ -32,6 +35,30 @@ export class GameMode implements GameModeConfig { Object.assign(this, config); } + getStartingLevel(): integer { + if (STARTING_LEVEL_OVERRIDE) + return STARTING_LEVEL_OVERRIDE; + switch (this.modeId) { + case GameModes.DAILY: + return 20; + default: + return 5; + } + } + + getStartingMoney(): integer { + return STARTING_MONEY_OVERRIDE || 1000; + } + + getStartingBiome(scene: BattleScene): Biome { + switch (this.modeId) { + case GameModes.DAILY: + return scene.generateRandomBiome(this.getWaveForDifficulty(1)); + default: + return STARTING_BIOME_OVERRIDE || Biome.TOWN; + } + } + getWaveForDifficulty(waveIndex: integer): integer { switch (this.modeId) { case GameModes.DAILY: diff --git a/src/phases.ts b/src/phases.ts index 0d41af5d805..d801c73c825 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -1,4 +1,4 @@ -import BattleScene, { bypassLogin, startingLevel, startingWave } from "./battle-scene"; +import BattleScene, { STARTING_BIOME_OVERRIDE, bypassLogin, startingWave } from "./battle-scene"; import { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult, FieldPosition, HitResult, TurnMove } from "./field/pokemon"; import * as Utils from './utils'; import { Moves } from "./data/enums/moves"; @@ -16,7 +16,7 @@ import EvolutionSceneHandler from "./ui/evolution-scene-handler"; import { EvolutionPhase } from "./evolution-phase"; import { Phase } from "./phase"; import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat"; -import { biomeDepths, biomeLinks } from "./data/biomes"; +import { biomeLinks } from "./data/biomes"; import { Biome } from "./data/enums/biome"; import { ModifierTier } from "./modifier/modifier-tier"; import { FusePokemonModifierType, ModifierPoolType, ModifierType, ModifierTypeFunc, ModifierTypeOption, PokemonModifierType, PokemonMoveModifierType, RememberMoveModifierType, TmModifierType, getEnemyBuffModifierForWave, getModifierType, getPlayerModifierTypeOptionsForWave, getPlayerShopModifierTypeOptionsForWave, modifierTypes, regenerateModifierPoolThresholds } from "./modifier/modifier-type"; @@ -53,6 +53,8 @@ import { Tutorial, handleTutorial } from "./tutorial"; import { TerrainType } from "./data/terrain"; import { OptionSelectConfig, OptionSelectItem } from "./ui/abstact-option-select-ui-handler"; import { SaveSlotUiMode } from "./ui/save-slot-select-ui-handler"; +import { getDailyRunSeed, getDailyRunStarters } from "./data/daily-run"; +import { GameModes, gameModes } from "./game-mode"; export class LoginPhase extends Phase { private showText: boolean; @@ -159,7 +161,7 @@ export class TitlePhase extends Phase { } }, { - label: 'Load', + label: 'Load Game', handler: () => this.scene.ui.setOverlayMode(Mode.SAVE_SLOT, SaveSlotUiMode.LOAD, (slotId: integer) => { if (slotId === -1) @@ -167,13 +169,10 @@ export class TitlePhase extends Phase { this.loadSaveSlot(slotId); } ) - }, - /*{ + }/*, + { label: 'Daily Run', - handler: () => { - //this.scene.ui.setMode(Mode.MESSAGE); - this.scene.ui.showText('This feature is not available yet.\nPlease check back soon!', null, () => this.scene.ui.clearText(), Utils.fixedInt(1000)); - }, + handler: () => this.initDailyRun(), keepOpen: true }*/); const config: OptionSelectConfig = { @@ -198,13 +197,57 @@ export class TitlePhase extends Phase { }); } + initDailyRun(): void { + this.scene.ui.setMode(Mode.SAVE_SLOT, SaveSlotUiMode.SAVE, (slotId: integer) => { + this.scene.clearPhaseQueue(); + if (slotId === -1) { + this.scene.pushPhase(new TitlePhase(this.scene)); + return this.end(); + } + this.scene.sessionSlotId = slotId; + this.scene.setSeed(getDailyRunSeed(this.scene)); + + this.scene.gameMode = gameModes[GameModes.DAILY]; + this.scene.money = this.scene.gameMode.getStartingMoney(); + + const starters = getDailyRunStarters(this.scene); + + const party = this.scene.getParty(); + const loadPokemonAssets: Promise[] = []; + for (let starter of starters) { + const starterProps = this.scene.gameData.getSpeciesDexAttrProps(starter.species, starter.dexAttr); + const starterFormIndex = Math.min(starterProps.formIndex, Math.max(starter.species.forms.length - 1, 0)); + const starterGender = starter.species.malePercent !== null + ? !starterProps.female ? Gender.MALE : Gender.FEMALE + : Gender.GENDERLESS; + const starterIvs = this.scene.gameData.dexData[starter.species.speciesId].ivs.slice(0); + const starterPokemon = this.scene.addPlayerPokemon(starter.species, this.scene.gameMode.getStartingLevel(), starterProps.abilityIndex, starterFormIndex, starterGender, starterProps.shiny, starterIvs, starter.nature); + if (starter.moveset) + starterPokemon.tryPopulateMoveset(starter.moveset); + starterPokemon.setVisible(false); + party.push(starterPokemon); + loadPokemonAssets.push(starterPokemon.loadAssets()); + } + Promise.all(loadPokemonAssets).then(() => { + this.scene.time.delayedCall(500, () => this.scene.playBgm()); + this.scene.gameData.gameStats.dailyRunSessionsPlayed++; + this.scene.newBattle(); + this.scene.sessionPlayTime = 0; + this.end(); + }); + }); + } + end(): void { - if (!this.loaded) { + if (!this.loaded && !this.scene.gameMode.isDaily) { this.scene.arena.preloadBgm(); this.scene.pushPhase(new SelectStarterPhase(this.scene)); } else this.scene.playBgm(); + if (!this.loaded) + this.scene.newArena(this.scene.gameMode.getStartingBiome(this.scene), true); + this.scene.pushPhase(new EncounterPhase(this.scene, this.loaded)); if (this.loaded) { @@ -338,7 +381,7 @@ export class SelectStarterPhase extends Phase { ? !starterProps.female ? Gender.MALE : Gender.FEMALE : Gender.GENDERLESS; const starterIvs = this.scene.gameData.dexData[starter.species.speciesId].ivs.slice(0); - const starterPokemon = this.scene.addPlayerPokemon(starter.species, startingLevel, starterProps.abilityIndex, starterFormIndex, starterGender, starterProps.shiny, starterIvs, starter.nature); + const starterPokemon = this.scene.addPlayerPokemon(starter.species, this.scene.gameMode.getStartingLevel(), starterProps.abilityIndex, starterFormIndex, starterGender, starterProps.shiny, starterIvs, starter.nature); starterPokemon.tryPopulateMoveset(starter.moveset); if (starter.pokerus) starterPokemon.pokerus = true; @@ -869,28 +912,7 @@ export class SelectBiomePhase extends BattlePhase { generateNextBiome(): Biome { if (!(this.scene.currentBattle.waveIndex % 50)) return Biome.END; - else { - const relWave = this.scene.currentBattle.waveIndex % 250; - const biomes = Utils.getEnumValues(Biome).slice(1, Utils.getEnumValues(Biome).filter(b => b >= 40).length * -1); - const maxDepth = biomeDepths[Biome.END][0] - 2; - const depthWeights = new Array(maxDepth + 1).fill(null) - .map((_, i: integer) => ((1 - Math.min(Math.abs((i / (maxDepth - 1)) - (relWave / 250)) + 0.25, 1)) / 0.75) * 250); - const biomeThresholds: integer[] = []; - let totalWeight = 0; - for (let biome of biomes) { - totalWeight += Math.ceil(depthWeights[biomeDepths[biome][0] - 1] / biomeDepths[biome][1]); - biomeThresholds.push(totalWeight); - } - - const randInt = Utils.randSeedInt(totalWeight); - - for (let biome of biomes) { - if (randInt < biomeThresholds[biome]) - return biome; - } - - return biomes[Utils.randSeedInt(biomes.length)]; - } + return this.scene.generateRandomBiome(this.scene.currentBattle.waveIndex); } } diff --git a/src/pipelines/field-sprite.ts b/src/pipelines/field-sprite.ts index 822bbd733ae..22a2ba31994 100644 --- a/src/pipelines/field-sprite.ts +++ b/src/pipelines/field-sprite.ts @@ -234,7 +234,7 @@ export default class FieldSpritePipeline extends Phaser.Renderer.WebGL.Pipelines const terrainColorRatio = data['terrainColorRatio'] as number || 0; let time = scene.currentBattle?.waveIndex - ? ((scene.currentBattle.waveIndex + scene.getWaveCycleOffset()) % 40) / 40 // ((new Date().getSeconds() * 1000 + new Date().getMilliseconds()) % 10000) / 10000 + ? ((scene.currentBattle.waveIndex + scene.waveCycleOffset) % 40) / 40 // ((new Date().getSeconds() * 1000 + new Date().getMilliseconds()) % 10000) / 10000 : Utils.getCurrentTime(); this.set1f('time', time); this.set1i('ignoreTimeTint', ignoreTimeTint ? 1 : 0); diff --git a/src/system/game-data.ts b/src/system/game-data.ts index f8fbc546d22..47032742733 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -537,7 +537,7 @@ export class GameData { this.getSession(slotId).then(async sessionData => { console.debug(sessionData); - scene.seed = sessionData.seed || scene.game.config.seed[0]; + scene.setSeed(sessionData.seed || scene.game.config.seed[0]); scene.resetSeed(); scene.sessionPlayTime = sessionData.playTime || 0; diff --git a/src/system/game-stats.ts b/src/system/game-stats.ts index 068c6595e1b..9a564b3c3b8 100644 --- a/src/system/game-stats.ts +++ b/src/system/game-stats.ts @@ -6,6 +6,8 @@ export class GameStats { public battles: integer; public classicSessionsPlayed: integer; public sessionsWon: integer; + public dailyRunSessionsPlayed: integer; + public dailyRunSessionsWon: integer; public endlessSessionsPlayed: integer; public highestEndlessWave: integer; public highestLevel: integer; @@ -38,6 +40,8 @@ export class GameStats { this.battles = source?.battles || 0; this.classicSessionsPlayed = source?.classicSessionsPlayed || 0; this.sessionsWon = source?.sessionsWon || 0; + this.dailyRunSessionsPlayed = source?.dailyRunSessionsPlayed || 0; + this.dailyRunSessionsWon = source?.dailyRunSessionsWon || 0; this.endlessSessionsPlayed = source?.endlessSessionsPlayed || 0; this.highestEndlessWave = source?.highestEndlessWave || 0; this.highestLevel = source?.highestLevel || 0; diff --git a/src/ui/achvs-ui-handler.ts b/src/ui/achvs-ui-handler.ts index 913a92bb129..75ec27e4b46 100644 --- a/src/ui/achvs-ui-handler.ts +++ b/src/ui/achvs-ui-handler.ts @@ -185,7 +185,7 @@ export default class AchvsUiHandler extends MessageUiHandler { let updateAchv = ret; if (!this.cursorObj) { - this.cursorObj = this.scene.add.nineslice(0, 0, 'starter_select_cursor_highlight', null, 16, 16, 1, 1, 1, 1); + this.cursorObj = this.scene.add.nineslice(0, 0, 'select_cursor_highlight', null, 16, 16, 1, 1, 1, 1); this.cursorObj.setOrigin(0, 0); this.achvIconsContainer.add(this.cursorObj); updateAchv = true; diff --git a/src/ui/egg-list-ui-handler.ts b/src/ui/egg-list-ui-handler.ts index 489566651f5..e81677031b6 100644 --- a/src/ui/egg-list-ui-handler.ts +++ b/src/ui/egg-list-ui-handler.ts @@ -66,7 +66,7 @@ export default class EggListUiHandler extends MessageUiHandler { this.eggListIconContainer = this.scene.add.container(115, 9); this.eggListContainer.add(this.eggListIconContainer); - this.cursorObj = this.scene.add.image(0, 0, 'starter_select_cursor'); + this.cursorObj = this.scene.add.image(0, 0, 'select_cursor'); this.cursorObj.setOrigin(0, 0); this.eggListContainer.add(this.cursorObj); diff --git a/src/ui/game-stats-ui-handler.ts b/src/ui/game-stats-ui-handler.ts index 497a9463253..52b12a9ad82 100644 --- a/src/ui/game-stats-ui-handler.ts +++ b/src/ui/game-stats-ui-handler.ts @@ -70,9 +70,11 @@ const displayStats: DisplayStats = { return `${caughtCount} (${Math.floor((caughtCount / dexKeys.length) * 1000) / 10}%)`; } }, - classicSessionsPlayed: 'Runs (Classic)', - sessionsWon: 'Wins (Classic)', - endlessSessionsPlayed: 'Runs (Endless)?', + classicSessionsPlayed: 'Classic Runs', + sessionsWon: 'Classic Wins', + dailyRunSessionsPlayed: 'Daily Run Attempts', + dailyRunSessionsWon: 'Daily Run Wins', + endlessSessionsPlayed: 'Endless Runs?', highestEndlessWave: 'Highest Wave (Endless)?', highestMoney: 'Highest Money', highestDamage: 'Highest Damage', diff --git a/src/ui/save-slot-select-ui-handler.ts b/src/ui/save-slot-select-ui-handler.ts index 8d96d1fb854..4a3030fceb4 100644 --- a/src/ui/save-slot-select-ui-handler.ts +++ b/src/ui/save-slot-select-ui-handler.ts @@ -172,7 +172,7 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler { let changed = super.setCursor(cursor); if (!this.cursorObj) { - this.cursorObj = this.scene.add.nineslice(0, 0, 'starter_select_cursor_highlight', null, 296, 44, 1, 1, 1, 1); + this.cursorObj = this.scene.add.nineslice(0, 0, 'select_cursor_highlight_thick', null, 296, 44, 2, 2, 2, 2); this.cursorObj.setOrigin(0, 0); this.sessionSlotsContainer.add(this.cursorObj); } @@ -254,6 +254,8 @@ class SessionSlot extends Phaser.GameObjects.Container { iconContainer.add(text); pokemonIconsContainer.add(iconContainer); + + pokemon.destroy(); }); this.add(pokemonIconsContainer); diff --git a/src/ui/settings-ui-handler.ts b/src/ui/settings-ui-handler.ts index 65b75c22a53..a60e05932cb 100644 --- a/src/ui/settings-ui-handler.ts +++ b/src/ui/settings-ui-handler.ts @@ -156,7 +156,7 @@ export default class SettingsUiHandler extends UiHandler { const ret = super.setCursor(cursor); if (!this.cursorObj) { - this.cursorObj = this.scene.add.nineslice(0, 0, 'starter_select_cursor_highlight', null, (this.scene.game.canvas.width / 6) - 10, 16, 1, 1, 1, 1); + this.cursorObj = this.scene.add.nineslice(0, 0, 'select_cursor_highlight', null, (this.scene.game.canvas.width / 6) - 10, 16, 1, 1, 1, 1); this.cursorObj.setOrigin(0, 0); this.optionsContainer.add(this.cursorObj); } diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 01bb11341a6..ec081cccdc9 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -31,7 +31,7 @@ export interface Starter { species: PokemonSpecies; dexAttr: bigint; nature: Nature; - moveset: StarterMoveset; + moveset?: StarterMoveset; pokerus: boolean; } @@ -214,7 +214,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { }); this.pokerusCursorObjs = new Array(3).fill(null).map(() => { - const cursorObj = this.scene.add.image(0, 0, 'starter_select_cursor_pokerus'); + const cursorObj = this.scene.add.image(0, 0, 'select_cursor_pokerus'); cursorObj.setVisible(false); cursorObj.setOrigin(0, 0); this.starterSelectContainer.add(cursorObj); @@ -222,22 +222,22 @@ export default class StarterSelectUiHandler extends MessageUiHandler { }); this.starterCursorObjs = new Array(6).fill(null).map(() => { - const cursorObj = this.scene.add.image(0, 0, 'starter_select_cursor_highlight'); + const cursorObj = this.scene.add.image(0, 0, 'select_cursor_highlight'); cursorObj.setVisible(false); cursorObj.setOrigin(0, 0); this.starterSelectContainer.add(cursorObj); return cursorObj; }); - this.cursorObj = this.scene.add.image(0, 0, 'starter_select_cursor'); + this.cursorObj = this.scene.add.image(0, 0, 'select_cursor'); this.cursorObj.setOrigin(0, 0); this.starterSelectContainer.add(this.cursorObj); - this.genCursorHighlightObj = this.scene.add.image(111, 5, 'starter_select_gen_cursor_highlight'); + this.genCursorHighlightObj = this.scene.add.image(111, 5, 'select_gen_cursor_highlight'); this.genCursorHighlightObj.setOrigin(0, 0); this.starterSelectContainer.add(this.genCursorHighlightObj); - this.genCursorObj = this.scene.add.image(111, 5, 'starter_select_gen_cursor'); + this.genCursorObj = this.scene.add.image(111, 5, 'select_gen_cursor'); this.genCursorObj.setVisible(false); this.genCursorObj.setOrigin(0, 0); this.starterSelectContainer.add(this.genCursorObj); @@ -250,7 +250,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { startLabel.setOrigin(0.5, 0); this.starterSelectContainer.add(startLabel); - this.startCursorObj = this.scene.add.nineslice(111, 160, 'starter_select_cursor', null, 26, 15, 1, 1, 1, 1); + this.startCursorObj = this.scene.add.nineslice(111, 160, 'select_cursor', null, 26, 15, 1, 1, 1, 1); this.startCursorObj.setVisible(false); this.startCursorObj.setOrigin(0, 0); this.starterSelectContainer.add(this.startCursorObj); @@ -1212,6 +1212,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { ui.setModeWithoutClear(Mode.CONFIRM, () => { const startRun = (gameMode: GameModes) => { this.scene.gameMode = gameModes[gameMode]; + this.scene.money = this.scene.gameMode.getStartingMoney(); ui.setMode(Mode.STARTER_SELECT); const thisObj = this; const originalStarterSelectCallback = this.starterSelectCallback; diff --git a/src/ui/vouchers-ui-handler.ts b/src/ui/vouchers-ui-handler.ts index 39f525db2fa..491180556e0 100644 --- a/src/ui/vouchers-ui-handler.ts +++ b/src/ui/vouchers-ui-handler.ts @@ -183,7 +183,7 @@ export default class VouchersUiHandler extends MessageUiHandler { let updateVoucher = ret; if (!this.cursorObj) { - this.cursorObj = this.scene.add.nineslice(0, 0, 'starter_select_cursor_highlight', null, 16, 16, 1, 1, 1, 1); + this.cursorObj = this.scene.add.nineslice(0, 0, 'select_cursor_highlight', null, 16, 16, 1, 1, 1, 1); this.cursorObj.setOrigin(0, 0); this.voucherIconsContainer.add(this.cursorObj); updateVoucher = true;