diff --git a/src/phases.ts b/src/phases.ts index 7a0c74b748c..af2815e8b56 100644 --- a/src/phases.ts +++ b/src/phases.ts @@ -55,7 +55,7 @@ import { OptionSelectConfig, OptionSelectItem } from "./ui/abstact-option-select import { SaveSlotUiMode } from "./ui/save-slot-select-ui-handler"; import { fetchDailyRunSeed, getDailyRunStarters } from "./data/daily-run"; import { GameModes, gameModes } from "./game-mode"; -import { getPokemonSpecies, speciesStarters } from "./data/pokemon-species"; +import PokemonSpecies, { getPokemonSpecies, speciesStarters } from "./data/pokemon-species"; import i18next from './plugins/i18n'; import { STARTER_FORM_OVERRIDE, STARTER_SPECIES_OVERRIDE } from './overrides'; @@ -3500,8 +3500,11 @@ export class GameOverPhase extends BattlePhase { 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); + this.awardRibbon(pokemon.species); + + if (pokemon.species.getRootSpeciesId() != pokemon.species.getRootSpeciesId(true)) { + this.awardRibbon(pokemon.species, true); + } } } else if (this.scene.gameMode.isDaily && success[1]) this.scene.gameData.gameStats.dailyRunSessionsWon++; @@ -3534,6 +3537,16 @@ export class GameOverPhase extends BattlePhase { this.scene.unshiftPhase(new UnlockPhase(this.scene, Unlockables.MINI_BLACK_HOLE)); } } + + awardRibbon(species: PokemonSpecies, forStarter: boolean = false): void { + const speciesId = getPokemonSpecies(species.speciesId) + const speciesRibbonCount = this.scene.gameData.incrementRibbonCount(speciesId, forStarter); + // first time classic win, award voucher + if (speciesRibbonCount === 1) { + const rootSpeciesId = species.getRootSpeciesId(true); + this.scene.pushPhase(new ModifierRewardPhase(this.scene, modifierTypes.VOUCHER_PLUS)); + } + } } export class UnlockPhase extends Phase { diff --git a/src/system/game-data.ts b/src/system/game-data.ts index fa715e7738c..dff7bc2d67c 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -1079,8 +1079,8 @@ export class GameData { }); } - incrementStarterWinCount(species: PokemonSpecies): void { - const speciesIdToIncrement: Species = species.getRootSpeciesId(); + incrementRibbonCount(species: PokemonSpecies, forStarter: boolean = false): integer { + const speciesIdToIncrement: Species = species.getRootSpeciesId(forStarter); if (!this.starterData[speciesIdToIncrement].winCount) { this.starterData[speciesIdToIncrement].winCount = 0; @@ -1102,8 +1102,7 @@ export class GameData { if(ribbonsInStats >= 10) this.scene.validateAchv(achvs._10_RIBBONS); - this.starterData[speciesIdToIncrement].winCount++; - + return this.starterData[speciesIdToIncrement].winCount++; } addStarterCandy(species: PokemonSpecies, count: integer): void {