Add WiP logic for daily run and fix some performance issues

pull/16/head
Flashfyre 2024-03-15 21:59:34 -04:00
parent eab1ba7ab9
commit 81f9e2da36
22 changed files with 213 additions and 70 deletions

View File

Before

Width:  |  Height:  |  Size: 104 B

After

Width:  |  Height:  |  Size: 104 B

View File

Before

Width:  |  Height:  |  Size: 104 B

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 B

View File

Before

Width:  |  Height:  |  Size: 103 B

After

Width:  |  Height:  |  Size: 103 B

View File

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 106 B

View File

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 106 B

View File

@ -53,12 +53,16 @@ import PokemonSpriteSparkleHandler from './field/pokemon-sprite-sparkle-handler'
import CharSprite from './ui/char-sprite'; import CharSprite from './ui/char-sprite';
import DamageNumberHandler from './field/damage-number-handler'; import DamageNumberHandler from './field/damage-number-handler';
import PokemonInfoContainer from './ui/pokemon-info-container'; import PokemonInfoContainer from './ui/pokemon-info-container';
import { biomeDepths } from './data/biomes';
export const bypassLogin = false; export const bypassLogin = false;
export const startingLevel = 5;
export const startingWave = 1; export const STARTING_LEVEL_OVERRIDE = 0;
export const startingBiome = Biome.TOWN; export const STARTING_WAVE_OVERRIDE = 0;
export const startingMoney = 1000; export const STARTING_BIOME_OVERRIDE = Biome.TOWN;
export const STARTING_MONEY_OVERRIDE = 0;
export const startingWave = STARTING_WAVE_OVERRIDE || 1;
const expSpriteKeys: string[] = []; const expSpriteKeys: string[] = [];
@ -146,6 +150,7 @@ export default class BattleScene extends Phaser.Scene {
public seed: string; public seed: string;
public waveSeed: string; public waveSeed: string;
public waveCycleOffset: integer;
public damageNumberHandler: DamageNumberHandler public damageNumberHandler: DamageNumberHandler
private spriteSparkleHandler: PokemonSpriteSparkleHandler; private spriteSparkleHandler: PokemonSpriteSparkleHandler;
@ -298,11 +303,12 @@ export default class BattleScene extends Phaser.Scene {
this.loadImage(`summary_tabs_${t}`, 'ui'); this.loadImage(`summary_tabs_${t}`, 'ui');
this.loadImage('starter_select_bg', 'ui'); this.loadImage('starter_select_bg', 'ui');
this.loadImage('starter_select_cursor', 'ui'); this.loadImage('select_cursor', 'ui');
this.loadImage('starter_select_cursor_highlight', 'ui'); this.loadImage('select_cursor_highlight', 'ui');
this.loadImage('starter_select_cursor_pokerus', 'ui'); this.loadImage('select_cursor_highlight_thick', 'ui');
this.loadImage('starter_select_gen_cursor', 'ui'); this.loadImage('select_cursor_pokerus', 'ui');
this.loadImage('starter_select_gen_cursor_highlight', 'ui'); this.loadImage('select_gen_cursor', 'ui');
this.loadImage('select_gen_cursor_highlight', 'ui');
this.loadImage('default_bg', 'arenas'); this.loadImage('default_bg', 'arenas');
@ -744,13 +750,18 @@ export default class BattleScene extends Phaser.Scene {
return pokemon; return pokemon;
} }
setSeed(seed: string): void {
this.seed = seed;
this.waveCycleOffset = this.getGenerateWaveCycleOffset();
}
reset(clearScene?: boolean): void { reset(clearScene?: boolean): void {
this.seed = Utils.randomString(16); this.setSeed(Utils.randomString(16));
console.log('Seed:', this.seed); console.log('Seed:', this.seed);
this.gameMode = gameModes[GameModes.CLASSIC]; this.gameMode = gameModes[GameModes.CLASSIC];
this.money = startingMoney; this.money = 0;
this.pokeballCounts = Object.fromEntries(Utils.getEnumValues(PokeballType).filter(p => p <= PokeballType.MASTER_BALL).map(t => [ t, 0 ])); this.pokeballCounts = Object.fromEntries(Utils.getEnumValues(PokeballType).filter(p => p <= PokeballType.MASTER_BALL).map(t => [ t, 0 ]));
this.pokeballCounts[PokeballType.POKEBALL] += 5; this.pokeballCounts[PokeballType.POKEBALL] += 5;
@ -767,13 +778,14 @@ export default class BattleScene extends Phaser.Scene {
p.destroy(); p.destroy();
this.currentBattle = null; this.currentBattle = null;
this.waveCountText.setText(startingWave.toString()); this.waveCountText.setText(startingWave.toString());
this.waveCountText.setVisible(false); this.waveCountText.setVisible(false);
this.updateMoneyText(); this.updateMoneyText();
this.moneyText.setVisible(false); this.moneyText.setVisible(false);
this.newArena(startingBiome, true); this.newArena(STARTING_BIOME_OVERRIDE || Biome.TOWN, true);
this.arenaBgTransition.setPosition(0, 0); this.arenaBgTransition.setPosition(0, 0);
this.arenaPlayer.setPosition(300, 0); this.arenaPlayer.setPosition(300, 0);
@ -1009,7 +1021,7 @@ export default class BattleScene extends Phaser.Scene {
return this.arena.getSpeciesFormIndex(species); return this.arena.getSpeciesFormIndex(species);
} }
getWaveCycleOffset(): integer { private getGenerateWaveCycleOffset(): integer {
let ret = 0; let ret = 0;
this.executeWithSeedOffset(() => { this.executeWithSeedOffset(() => {
ret = Utils.randSeedInt(8) * 5; ret = Utils.randSeedInt(8) * 5;
@ -1170,6 +1182,29 @@ export default class BattleScene extends Phaser.Scene {
return filteredSpecies[Utils.randSeedInt(filteredSpecies.length)]; 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 { checkInput(): boolean {
if (this.blockInput) if (this.blockInput)
return; return;

47
src/data/daily-run.ts Normal file
View File

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

View File

@ -11,7 +11,6 @@ import { Type } from "../data/type";
import Move from "../data/move"; import Move from "../data/move";
import { ArenaTag, ArenaTagSide, getArenaTag } from "../data/arena-tag"; import { ArenaTag, ArenaTagSide, getArenaTag } from "../data/arena-tag";
import { ArenaTagType } from "../data/enums/arena-tag-type"; import { ArenaTagType } from "../data/enums/arena-tag-type";
import { GameModes } from "../game-mode";
import { TrainerType } from "../data/enums/trainer-type"; import { TrainerType } from "../data/enums/trainer-type";
import { BattlerIndex } from "../battle"; import { BattlerIndex } from "../battle";
import { Moves } from "../data/enums/moves"; import { Moves } from "../data/enums/moves";
@ -357,7 +356,7 @@ export class Arena {
return TimeOfDay.NIGHT; 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) if (waveCycle < 15)
return TimeOfDay.DAY; return TimeOfDay.DAY;

View File

@ -1932,7 +1932,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
destroy(): void { destroy(): void {
this.battleInfo.destroy(); this.battleInfo?.destroy();
super.destroy(); super.destroy();
} }
} }
@ -2046,8 +2046,10 @@ export class PlayerPokemon extends Pokemon {
this.abilityIndex = abilityCount - 1; this.abilityIndex = abilityCount - 1;
this.compatibleTms.splice(0, this.compatibleTms.length); this.compatibleTms.splice(0, this.compatibleTms.length);
this.generateCompatibleTms(); this.generateCompatibleTms();
this.scene.gameData.setPokemonSeen(this, false); if (!this.scene.gameMode.isDaily || this.metBiome > -1) {
this.scene.gameData.setPokemonCaught(this, false); this.scene.gameData.setPokemonSeen(this, false);
this.scene.gameData.setPokemonCaught(this, false);
}
this.loadAssets().then(() => { this.loadAssets().then(() => {
this.calculateStats(); this.calculateStats();
this.updateInfo(true).then(() => resolve()); this.updateInfo(true).then(() => resolve());
@ -2091,8 +2093,10 @@ export class PlayerPokemon extends Pokemon {
this.abilityIndex = abilityCount - 1; this.abilityIndex = abilityCount - 1;
this.compatibleTms.splice(0, this.compatibleTms.length); this.compatibleTms.splice(0, this.compatibleTms.length);
this.generateCompatibleTms(); this.generateCompatibleTms();
this.scene.gameData.setPokemonSeen(this, false); if (!this.scene.gameMode.isDaily || this.metBiome > -1) {
this.scene.gameData.setPokemonCaught(this, false); this.scene.gameData.setPokemonSeen(this, false);
this.scene.gameData.setPokemonCaught(this, false);
}
this.loadAssets().then(() => { this.loadAssets().then(() => {
this.calculateStats(); this.calculateStats();
this.scene.updateModifiers(true, true); this.scene.updateModifiers(true, true);

View File

@ -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 { export enum GameModes {
CLASSIC, CLASSIC,
ENDLESS, ENDLESS,
@ -32,6 +35,30 @@ export class GameMode implements GameModeConfig {
Object.assign(this, config); 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 { getWaveForDifficulty(waveIndex: integer): integer {
switch (this.modeId) { switch (this.modeId) {
case GameModes.DAILY: case GameModes.DAILY:

View File

@ -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 { default as Pokemon, PlayerPokemon, EnemyPokemon, PokemonMove, MoveResult, DamageResult, FieldPosition, HitResult, TurnMove } from "./field/pokemon";
import * as Utils from './utils'; import * as Utils from './utils';
import { Moves } from "./data/enums/moves"; import { Moves } from "./data/enums/moves";
@ -16,7 +16,7 @@ import EvolutionSceneHandler from "./ui/evolution-scene-handler";
import { EvolutionPhase } from "./evolution-phase"; import { EvolutionPhase } from "./evolution-phase";
import { Phase } from "./phase"; import { Phase } from "./phase";
import { BattleStat, getBattleStatLevelChangeDescription, getBattleStatName } from "./data/battle-stat"; 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 { Biome } from "./data/enums/biome";
import { ModifierTier } from "./modifier/modifier-tier"; 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"; 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 { TerrainType } from "./data/terrain";
import { OptionSelectConfig, OptionSelectItem } from "./ui/abstact-option-select-ui-handler"; import { OptionSelectConfig, OptionSelectItem } from "./ui/abstact-option-select-ui-handler";
import { SaveSlotUiMode } from "./ui/save-slot-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 { export class LoginPhase extends Phase {
private showText: boolean; 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, handler: () => this.scene.ui.setOverlayMode(Mode.SAVE_SLOT, SaveSlotUiMode.LOAD,
(slotId: integer) => { (slotId: integer) => {
if (slotId === -1) if (slotId === -1)
@ -167,13 +169,10 @@ export class TitlePhase extends Phase {
this.loadSaveSlot(slotId); this.loadSaveSlot(slotId);
} }
) )
}, }/*,
/*{ {
label: 'Daily Run', label: 'Daily Run',
handler: () => { handler: () => this.initDailyRun(),
//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));
},
keepOpen: true keepOpen: true
}*/); }*/);
const config: OptionSelectConfig = { 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<void>[] = [];
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 { end(): void {
if (!this.loaded) { if (!this.loaded && !this.scene.gameMode.isDaily) {
this.scene.arena.preloadBgm(); this.scene.arena.preloadBgm();
this.scene.pushPhase(new SelectStarterPhase(this.scene)); this.scene.pushPhase(new SelectStarterPhase(this.scene));
} else } else
this.scene.playBgm(); 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)); this.scene.pushPhase(new EncounterPhase(this.scene, this.loaded));
if (this.loaded) { if (this.loaded) {
@ -338,7 +381,7 @@ export class SelectStarterPhase extends Phase {
? !starterProps.female ? Gender.MALE : Gender.FEMALE ? !starterProps.female ? Gender.MALE : Gender.FEMALE
: Gender.GENDERLESS; : Gender.GENDERLESS;
const starterIvs = this.scene.gameData.dexData[starter.species.speciesId].ivs.slice(0); 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); starterPokemon.tryPopulateMoveset(starter.moveset);
if (starter.pokerus) if (starter.pokerus)
starterPokemon.pokerus = true; starterPokemon.pokerus = true;
@ -869,28 +912,7 @@ export class SelectBiomePhase extends BattlePhase {
generateNextBiome(): Biome { generateNextBiome(): Biome {
if (!(this.scene.currentBattle.waveIndex % 50)) if (!(this.scene.currentBattle.waveIndex % 50))
return Biome.END; return Biome.END;
else { return this.scene.generateRandomBiome(this.scene.currentBattle.waveIndex);
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)];
}
} }
} }

View File

@ -234,7 +234,7 @@ export default class FieldSpritePipeline extends Phaser.Renderer.WebGL.Pipelines
const terrainColorRatio = data['terrainColorRatio'] as number || 0; const terrainColorRatio = data['terrainColorRatio'] as number || 0;
let time = scene.currentBattle?.waveIndex 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(); : Utils.getCurrentTime();
this.set1f('time', time); this.set1f('time', time);
this.set1i('ignoreTimeTint', ignoreTimeTint ? 1 : 0); this.set1i('ignoreTimeTint', ignoreTimeTint ? 1 : 0);

View File

@ -537,7 +537,7 @@ export class GameData {
this.getSession(slotId).then(async sessionData => { this.getSession(slotId).then(async sessionData => {
console.debug(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.resetSeed();
scene.sessionPlayTime = sessionData.playTime || 0; scene.sessionPlayTime = sessionData.playTime || 0;

View File

@ -6,6 +6,8 @@ export class GameStats {
public battles: integer; public battles: integer;
public classicSessionsPlayed: integer; public classicSessionsPlayed: integer;
public sessionsWon: integer; public sessionsWon: integer;
public dailyRunSessionsPlayed: integer;
public dailyRunSessionsWon: integer;
public endlessSessionsPlayed: integer; public endlessSessionsPlayed: integer;
public highestEndlessWave: integer; public highestEndlessWave: integer;
public highestLevel: integer; public highestLevel: integer;
@ -38,6 +40,8 @@ export class GameStats {
this.battles = source?.battles || 0; this.battles = source?.battles || 0;
this.classicSessionsPlayed = source?.classicSessionsPlayed || 0; this.classicSessionsPlayed = source?.classicSessionsPlayed || 0;
this.sessionsWon = source?.sessionsWon || 0; this.sessionsWon = source?.sessionsWon || 0;
this.dailyRunSessionsPlayed = source?.dailyRunSessionsPlayed || 0;
this.dailyRunSessionsWon = source?.dailyRunSessionsWon || 0;
this.endlessSessionsPlayed = source?.endlessSessionsPlayed || 0; this.endlessSessionsPlayed = source?.endlessSessionsPlayed || 0;
this.highestEndlessWave = source?.highestEndlessWave || 0; this.highestEndlessWave = source?.highestEndlessWave || 0;
this.highestLevel = source?.highestLevel || 0; this.highestLevel = source?.highestLevel || 0;

View File

@ -185,7 +185,7 @@ export default class AchvsUiHandler extends MessageUiHandler {
let updateAchv = ret; let updateAchv = ret;
if (!this.cursorObj) { 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.cursorObj.setOrigin(0, 0);
this.achvIconsContainer.add(this.cursorObj); this.achvIconsContainer.add(this.cursorObj);
updateAchv = true; updateAchv = true;

View File

@ -66,7 +66,7 @@ export default class EggListUiHandler extends MessageUiHandler {
this.eggListIconContainer = this.scene.add.container(115, 9); this.eggListIconContainer = this.scene.add.container(115, 9);
this.eggListContainer.add(this.eggListIconContainer); 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.cursorObj.setOrigin(0, 0);
this.eggListContainer.add(this.cursorObj); this.eggListContainer.add(this.cursorObj);

View File

@ -70,9 +70,11 @@ const displayStats: DisplayStats = {
return `${caughtCount} (${Math.floor((caughtCount / dexKeys.length) * 1000) / 10}%)`; return `${caughtCount} (${Math.floor((caughtCount / dexKeys.length) * 1000) / 10}%)`;
} }
}, },
classicSessionsPlayed: 'Runs (Classic)', classicSessionsPlayed: 'Classic Runs',
sessionsWon: 'Wins (Classic)', sessionsWon: 'Classic Wins',
endlessSessionsPlayed: 'Runs (Endless)?', dailyRunSessionsPlayed: 'Daily Run Attempts',
dailyRunSessionsWon: 'Daily Run Wins',
endlessSessionsPlayed: 'Endless Runs?',
highestEndlessWave: 'Highest Wave (Endless)?', highestEndlessWave: 'Highest Wave (Endless)?',
highestMoney: 'Highest Money', highestMoney: 'Highest Money',
highestDamage: 'Highest Damage', highestDamage: 'Highest Damage',

View File

@ -172,7 +172,7 @@ export default class SaveSlotSelectUiHandler extends MessageUiHandler {
let changed = super.setCursor(cursor); let changed = super.setCursor(cursor);
if (!this.cursorObj) { 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.cursorObj.setOrigin(0, 0);
this.sessionSlotsContainer.add(this.cursorObj); this.sessionSlotsContainer.add(this.cursorObj);
} }
@ -254,6 +254,8 @@ class SessionSlot extends Phaser.GameObjects.Container {
iconContainer.add(text); iconContainer.add(text);
pokemonIconsContainer.add(iconContainer); pokemonIconsContainer.add(iconContainer);
pokemon.destroy();
}); });
this.add(pokemonIconsContainer); this.add(pokemonIconsContainer);

View File

@ -156,7 +156,7 @@ export default class SettingsUiHandler extends UiHandler {
const ret = super.setCursor(cursor); const ret = super.setCursor(cursor);
if (!this.cursorObj) { 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.cursorObj.setOrigin(0, 0);
this.optionsContainer.add(this.cursorObj); this.optionsContainer.add(this.cursorObj);
} }

View File

@ -31,7 +31,7 @@ export interface Starter {
species: PokemonSpecies; species: PokemonSpecies;
dexAttr: bigint; dexAttr: bigint;
nature: Nature; nature: Nature;
moveset: StarterMoveset; moveset?: StarterMoveset;
pokerus: boolean; pokerus: boolean;
} }
@ -214,7 +214,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}); });
this.pokerusCursorObjs = new Array(3).fill(null).map(() => { 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.setVisible(false);
cursorObj.setOrigin(0, 0); cursorObj.setOrigin(0, 0);
this.starterSelectContainer.add(cursorObj); this.starterSelectContainer.add(cursorObj);
@ -222,22 +222,22 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
}); });
this.starterCursorObjs = new Array(6).fill(null).map(() => { 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.setVisible(false);
cursorObj.setOrigin(0, 0); cursorObj.setOrigin(0, 0);
this.starterSelectContainer.add(cursorObj); this.starterSelectContainer.add(cursorObj);
return 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.cursorObj.setOrigin(0, 0);
this.starterSelectContainer.add(this.cursorObj); 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.genCursorHighlightObj.setOrigin(0, 0);
this.starterSelectContainer.add(this.genCursorHighlightObj); 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.setVisible(false);
this.genCursorObj.setOrigin(0, 0); this.genCursorObj.setOrigin(0, 0);
this.starterSelectContainer.add(this.genCursorObj); this.starterSelectContainer.add(this.genCursorObj);
@ -250,7 +250,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
startLabel.setOrigin(0.5, 0); startLabel.setOrigin(0.5, 0);
this.starterSelectContainer.add(startLabel); 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.setVisible(false);
this.startCursorObj.setOrigin(0, 0); this.startCursorObj.setOrigin(0, 0);
this.starterSelectContainer.add(this.startCursorObj); this.starterSelectContainer.add(this.startCursorObj);
@ -1212,6 +1212,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
ui.setModeWithoutClear(Mode.CONFIRM, () => { ui.setModeWithoutClear(Mode.CONFIRM, () => {
const startRun = (gameMode: GameModes) => { const startRun = (gameMode: GameModes) => {
this.scene.gameMode = gameModes[gameMode]; this.scene.gameMode = gameModes[gameMode];
this.scene.money = this.scene.gameMode.getStartingMoney();
ui.setMode(Mode.STARTER_SELECT); ui.setMode(Mode.STARTER_SELECT);
const thisObj = this; const thisObj = this;
const originalStarterSelectCallback = this.starterSelectCallback; const originalStarterSelectCallback = this.starterSelectCallback;

View File

@ -183,7 +183,7 @@ export default class VouchersUiHandler extends MessageUiHandler {
let updateVoucher = ret; let updateVoucher = ret;
if (!this.cursorObj) { 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.cursorObj.setOrigin(0, 0);
this.voucherIconsContainer.add(this.cursorObj); this.voucherIconsContainer.add(this.cursorObj);
updateVoucher = true; updateVoucher = true;