Adds ribbon in starter screen if mon has beat classic mode (#370)

* adds the ribbon asset, hooking it up

* works if override. need to add field on server side I imagine

* moves count to starterData, increments on win

* formatting

* increment works properly

* recursively check for prevolution

* cleaned up to use getRootSpeciesId()

* changes ribbon to gold medal version

* adds Akuma's ribbon achievements

* ribbons increment correctly

* missed ui handler update

* reorder achievements

* ribbon correct, vouchers not. currently investigating

* increments properly, but voucher reward phase not appearing

* some cleanup

* works great, need to better reflect who is getting ribbon in message and cry

* plays level fanfare, tabling cry for now

* reran items.bat

* Minor fixes

---------

Co-authored-by: Flashfyre <flashfireex@gmail.com>
This commit is contained in:
alpacaandFlashfyre authored and GitHub committed 2024-05-07 00:44:41 -04:00
1 parent 2d740f1952
commit 36cde21ce3
17 files changed
+5588 -5370

No files matched your search

+17 -2
View File
@@ -51,9 +51,9 @@ export class Achv {
}
getTier(): AchvTier {
if (this.score >= 150)
return AchvTier.MASTER;
if (this.score >= 100)
return AchvTier.MASTER;
if (this.score >= 75)
return AchvTier.ROGUE;
if (this.score >= 50)
return AchvTier.ULTRA;
@@ -73,6 +73,16 @@ export class MoneyAchv extends Achv {
}
}
export class RibbonAchv extends Achv {
private ribbonAmount: integer;
constructor(name: string, ribbonAmount: integer, iconImage: string, score: integer) {
super(name, `Accumulate a total of ${ribbonAmount.toLocaleString('en-US')} Ribbons`, iconImage, score, (scene: BattleScene, _args: any[]) => scene.gameData.gameStats.ribbonsOwned >= this.ribbonAmount);
this.ribbonAmount = ribbonAmount;
}
}
export class DamageAchv extends Achv {
private damageAmount: integer;
@@ -125,6 +135,11 @@ export const achvs = {
LV_100: new LevelAchv('But Wait, There\'s More!', 100, 'rare_candy', 25).setSecret(),
LV_250: new LevelAchv('Elite', 250, 'rarer_candy', 50).setSecret(true),
LV_1000: new LevelAchv('To Go Even Further Beyond', 1000, 'candy_jar', 100).setSecret(true),
_10_RIBBONS: new RibbonAchv('Pokémon League Champion', 10, 'bronze_ribbon', 10),
_25_RIBBONS: new RibbonAchv('Great League Champion', 25, 'great_ribbon', 25).setSecret(true),
_50_RIBBONS: new RibbonAchv('Ultra League Champion', 50, 'ultra_ribbon', 50).setSecret(true),
_75_RIBBONS: new RibbonAchv('Rogue League Champion', 75, 'rogue_ribbon', 75).setSecret(true),
_100_RIBBONS: new RibbonAchv('Master League Champion', 100, 'master_ribbon', 100).setSecret(true),
TRANSFER_MAX_BATTLE_STAT: new Achv('Teamwork', 'Baton pass to another party member with at least one stat maxed out', 'stick', 20),
MAX_FRIENDSHIP: new Achv('Friendmaxxing', 'Reach max friendship on a Pokémon', 'soothe_bell', 25),
MEGA_EVOLVE: new Achv('Megamorph', 'Mega evolve a Pokémon', 'mega_bracelet', 50),
+31 -2
View File
@@ -173,6 +173,7 @@ export interface StarterDataEntry {
abilityAttr: integer;
passiveAttr: integer;
valueReduction: integer;
classicWinCount: integer;
}
export interface StarterData {
@@ -194,7 +195,8 @@ const systemShortKeys = {
eggMoves: '$em',
candyCount: '$x',
passive: '$p',
valueReduction: '$vr'
valueReduction: '$vr',
classicWinCount: '$wc'
};
export class GameData {
@@ -995,7 +997,8 @@ export class GameData {
friendship: 0,
abilityAttr: defaultStarterSpecies.includes(speciesId) ? AbilityAttr.ABILITY_1 : 0,
passiveAttr: 0,
valueReduction: 0
valueReduction: 0,
classicWinCount: 0
};
}
@@ -1089,6 +1092,32 @@ export class GameData {
});
}
incrementRibbonCount(species: PokemonSpecies, forStarter: boolean = false): integer {
const speciesIdToIncrement: Species = species.getRootSpeciesId(forStarter);
if (!this.starterData[speciesIdToIncrement].classicWinCount) {
this.starterData[speciesIdToIncrement].classicWinCount = 0;
}
if (!this.starterData[speciesIdToIncrement].classicWinCount)
this.scene.gameData.gameStats.ribbonsOwned++;
const ribbonsInStats: integer = this.scene.gameData.gameStats.ribbonsOwned;
if (ribbonsInStats >= 100)
this.scene.validateAchv(achvs._100_RIBBONS);
if (ribbonsInStats >= 75)
this.scene.validateAchv(achvs._75_RIBBONS);
if (ribbonsInStats >= 50)
this.scene.validateAchv(achvs._50_RIBBONS);
if (ribbonsInStats >= 25)
this.scene.validateAchv(achvs._25_RIBBONS);
if (ribbonsInStats >= 10)
this.scene.validateAchv(achvs._10_RIBBONS);
return ++this.starterData[speciesIdToIncrement].classicWinCount;
}
addStarterCandy(species: PokemonSpecies, count: integer): void {
this.scene.candyBar.showStarterSpeciesCandy(species.speciesId, count);
this.starterData[species.speciesId].candyCount += count;
+2
View File
@@ -6,6 +6,7 @@ export class GameStats {
public battles: integer;
public classicSessionsPlayed: integer;
public sessionsWon: integer;
public ribbonsOwned: integer;
public dailyRunSessionsPlayed: integer;
public dailyRunSessionsWon: integer;
public endlessSessionsPlayed: integer;
@@ -43,6 +44,7 @@ export class GameStats {
this.battles = source?.battles || 0;
this.classicSessionsPlayed = source?.classicSessionsPlayed || 0;
this.sessionsWon = source?.sessionsWon || 0;
this.ribbonsOwned = source?.ribbonsOwned || 0;
this.dailyRunSessionsPlayed = source?.dailyRunSessionsPlayed || 0;
this.dailyRunSessionsWon = source?.dailyRunSessionsWon || 0;
this.endlessSessionsPlayed = source?.endlessSessionsPlayed || 0;