diff --git a/src/phases.ts b/src/phases.ts index ceba555f2ce..8cc8cb78d79 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -3499,6 +3499,10 @@ export class GameOverPhase extends BattlePhase { if (this.scene.gameMode.isClassic) { firstClear = this.scene.validateAchv(achvs.CLASSIC_VICTORY); this.scene.gameData.gameStats.sessionsWon++; + for (let pokemon of this.scene.getParty()) { + const speciesId = getPokemonSpecies(pokemon.species.speciesId) + this.scene.gameData.incrementStarterWinCount(speciesId); + } } else if (this.scene.gameMode.isDaily && success[1]) this.scene.gameData.gameStats.dailyRunSessionsWon++; } diff --git a/src/system/game-data.ts b/src/system/game-data.ts index b9803a1dc57..6c5540b1b7d 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -128,7 +128,6 @@ export interface DexEntry { seenCount: integer; caughtCount: integer; hatchedCount: integer; - winCount: integer; ivs: integer[]; } @@ -173,6 +172,7 @@ export interface StarterDataEntry { abilityAttr: integer; passiveAttr: integer; valueReduction: integer; + winCount: integer; } export interface StarterData { @@ -952,7 +952,7 @@ export class GameData { for (let species of allSpecies) { data[species.speciesId] = { - seenAttr: 0n, caughtAttr: 0n, natureAttr: 0, seenCount: 0, caughtCount: 0, hatchedCount: 0, winCount: 0, ivs: [ 0, 0, 0, 0, 0, 0 ] + seenAttr: 0n, caughtAttr: 0n, natureAttr: 0, seenCount: 0, caughtCount: 0, hatchedCount: 0, ivs: [ 0, 0, 0, 0, 0, 0 ] }; } @@ -991,7 +991,8 @@ export class GameData { candyCount: 0, abilityAttr: defaultStarterSpecies.includes(speciesId) ? AbilityAttr.ABILITY_1 : 0, passiveAttr: 0, - valueReduction: 0 + valueReduction: 0, + winCount: 0 }; } @@ -1078,6 +1079,16 @@ export class GameData { }); } + incrementStarterWinCount(species: PokemonSpecies):void { + const speciesWinCount = this.starterData[species.speciesId].winCount; + + if(Number.isNaN(speciesWinCount)) + this.starterData[species.speciesId].winCount = 0; + + this.starterData[species.speciesId].winCount++; + console.log(this.starterData[species.speciesId].winCount); + } + addStarterCandy(species: PokemonSpecies, count: integer): void { this.scene.candyBar.showStarterSpeciesCandy(species.speciesId, count); this.starterData[species.speciesId].candyCount += count; diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index 7cee89b2e53..2113abe8f96 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -1188,7 +1188,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler { this.shinyIcons[s][v].setTint(getVariantTint(speciesVariants[v] === DexAttr.DEFAULT_VARIANT ? 0 : speciesVariants[v] === DexAttr.VARIANT_2 ? 1 : 2)); } this.hiddenAbilityIcons[s].setVisible(slotVisible && !!this.scene.gameData.dexData[speciesId].caughtAttr && !!(this.scene.gameData.starterData[speciesId].abilityAttr & 4)); - this.classicWinIcons[s].setVisible(slotVisible && this.scene.gameData.dexData[speciesId].winCount > 0); + this.classicWinIcons[s].setVisible(slotVisible && this.scene.gameData.starterData[speciesId].winCount > 0); } } else { changed = super.setCursor(cursor);