Compare commits

...

3 Commits

Author SHA1 Message Date
Sirz Benjie
200cca9e8c
Add tracking for each generational ribbon 2025-08-11 19:10:27 -05:00
Sirz Benjie
a7e8f9a7e1
Replace mass getters with a single method 2025-08-11 17:25:20 -05:00
Sirz Benjie
6d4bc5f3bf
fix overlapping flag set 2025-08-11 17:01:06 -05:00
2 changed files with 56 additions and 137 deletions

View File

@ -13,55 +13,74 @@ export class RibbonData {
//#region Ribbons //#region Ribbons
//#region Monotype challenge ribbons //#region Monotype challenge ribbons
/** Flag for winning the normal monotype challenge */ /** Ribbon for winning the normal monotype challenge */
public static readonly MONO_NORMAL = 0x1 as RibbonFlag; public static readonly MONO_NORMAL = 0x1 as RibbonFlag;
/** Flag for winning the fighting monotype challenge */ /** Ribbon for winning the fighting monotype challenge */
public static readonly MONO_FIGHTING = 0x2 as RibbonFlag; public static readonly MONO_FIGHTING = 0x2 as RibbonFlag;
/** Flag for winning the flying monotype challenge */ /** Ribbon for winning the flying monotype challenge */
public static readonly MONO_FLYING = 0x4 as RibbonFlag; public static readonly MONO_FLYING = 0x4 as RibbonFlag;
/** Flag for winning the poision monotype challenge */ /** Ribbon for winning the poision monotype challenge */
public static readonly MONO_POISON = 0x8 as RibbonFlag; public static readonly MONO_POISON = 0x8 as RibbonFlag;
/** Flag for winning the ground monotype challenge */ /** Ribbon for winning the ground monotype challenge */
public static readonly MONO_GROUND = 0x10 as RibbonFlag; public static readonly MONO_GROUND = 0x10 as RibbonFlag;
/** Flag for winning the rock monotype challenge */ /** Ribbon for winning the rock monotype challenge */
public static readonly MONO_ROCK = 0x20 as RibbonFlag; public static readonly MONO_ROCK = 0x20 as RibbonFlag;
/** Flag for winning the bug monotype challenge */ /** Ribbon for winning the bug monotype challenge */
public static readonly MONO_BUG = 0x40 as RibbonFlag; public static readonly MONO_BUG = 0x40 as RibbonFlag;
/** Flag for winning the ghost monotype challenge */ /** Ribbon for winning the ghost monotype challenge */
public static readonly MONO_GHOST = 0x80 as RibbonFlag; public static readonly MONO_GHOST = 0x80 as RibbonFlag;
/** Flag for winning the steel monotype challenge */ /** Ribbon for winning the steel monotype challenge */
public static readonly MONO_STEEL = 0x100 as RibbonFlag; public static readonly MONO_STEEL = 0x100 as RibbonFlag;
/** Flag for winning the fire monotype challenge */ /** Ribbon for winning the fire monotype challenge */
public static readonly MONO_FIRE = 0x200 as RibbonFlag; public static readonly MONO_FIRE = 0x200 as RibbonFlag;
/** Flag for winning the water monotype challenge */ /** Ribbon for winning the water monotype challenge */
public static readonly MONO_WATER = 0x400 as RibbonFlag; public static readonly MONO_WATER = 0x400 as RibbonFlag;
/** Flag for winning the grass monotype challenge */ /** Ribbon for winning the grass monotype challenge */
public static readonly MONO_GRASS = 0x800 as RibbonFlag; public static readonly MONO_GRASS = 0x800 as RibbonFlag;
/** Flag for winning the electric monotype challenge */ /** Ribbon for winning the electric monotype challenge */
public static readonly MONO_ELECTRIC = 0x1000 as RibbonFlag; public static readonly MONO_ELECTRIC = 0x1000 as RibbonFlag;
/** Flag for winning the psychic monotype challenge */ /** Ribbon for winning the psychic monotype challenge */
public static readonly MONO_PSYCHIC = 0x2000 as RibbonFlag; public static readonly MONO_PSYCHIC = 0x2000 as RibbonFlag;
/** Flag for winning the ice monotype challenge */ /** Ribbon for winning the ice monotype challenge */
public static readonly MONO_ICE = 0x4000 as RibbonFlag; public static readonly MONO_ICE = 0x4000 as RibbonFlag;
/** Flag for winning the dragon monotype challenge */ /** Ribbon for winning the dragon monotype challenge */
public static readonly MONO_DRAGON = 0x8000 as RibbonFlag; public static readonly MONO_DRAGON = 0x8000 as RibbonFlag;
/** Flag for winning the dark monotype challenge */ /** Ribbon for winning the dark monotype challenge */
public static readonly MONO_DARK = 0x10000 as RibbonFlag; public static readonly MONO_DARK = 0x10000 as RibbonFlag;
/** Flag for winning the fairy monotype challenge */ /** Ribbon for winning the fairy monotype challenge */
public static readonly MONO_FAIRY = 0x20000 as RibbonFlag; public static readonly MONO_FAIRY = 0x20000 as RibbonFlag;
//#endregion Monotype ribbons //#endregion Monotype ribbons
/** Flag for winning a mono generation challenge */ //#region Monogen ribbons
public static readonly MONO_GEN = 0x40000 as RibbonFlag; /** Ribbon for winning the the mono gen 1 challenge */
public static readonly MONO_GEN_1 = 0x40000 as RibbonFlag;
/** Ribbon for winning the the mono gen 2 challenge */
public static readonly MONO_GEN_2 = 0x80000 as RibbonFlag;
/** Ribbon for winning the mono gen 3 challenge */
public static readonly MONO_GEN_3 = 0x100000 as RibbonFlag;
/** Ribbon for winning the mono gen 4 challenge */
public static readonly MONO_GEN_4 = 0x200000 as RibbonFlag;
/** Ribbon for winning the mono gen 5 challenge */
public static readonly MONO_GEN_5 = 0x400000 as RibbonFlag;
/** Ribbon for winning the mono gen 6 challenge */
public static readonly MONO_GEN_6 = 0x800000 as RibbonFlag;
/** Ribbon for winning the mono gen 7 challenge */
public static readonly MONO_GEN_7 = 0x1000000 as RibbonFlag;
/** Ribbon for winning the mono gen 8 challenge */
public static readonly MONO_GEN_8 = 0x2000000 as RibbonFlag;
/** Ribbon for winning the mono gen 9 challenge */
public static readonly MONO_GEN_9 = 0x4000000 as RibbonFlag;
//#endregion Monogen ribbons
/** Flag for winning classic */ /** Ribbon for winning classic */
public static readonly CLASSIC = 0x80000 as RibbonFlag; public static readonly CLASSIC = 0x8000000 as RibbonFlag;
/** Flag for winning the nuzzlocke challenge */ /** Ribbon for winning the nuzzlocke challenge */
public static readonly NUZLOCKE = 0x80000 as RibbonFlag; public static readonly NUZLOCKE = 0x10000000 as RibbonFlag;
/** Flag for reaching max friendship */ /** Ribbon for reaching max friendship */
public static readonly FRIENDSHIP = 0x100000 as RibbonFlag; public static readonly FRIENDSHIP = 0x20000000 as RibbonFlag;
//#endregion Ribbons //#endregion Ribbons
/** Create a new instance of RibbonData. Generally, {@linkcode fromJSON} is used instead. */
constructor(value: number) { constructor(value: number) {
this.payload = value; this.payload = value;
} }
@ -96,115 +115,12 @@ export class RibbonData {
} }
} }
//#region getters /**
/** Ribbon for completing the game in classic mode */ * Check if a specific ribbon has been awarded
public get classic(): boolean { * @param flag - The ribbon to check
return !!(this.payload & RibbonData.CLASSIC); * @returns Whether the specified flag has been awarded
*/
public has(flag: RibbonFlag): boolean {
return !!(this.payload & flag);
} }
/** Ribbon for completing a Nuzlocke challenge */
public get nuzlocke(): boolean {
return !!(this.payload & RibbonData.NUZLOCKE);
}
/** Ribbon for reaching max friendship with a Pokémon */
public get maxFriendship(): boolean {
return !!(this.payload & RibbonData.FRIENDSHIP);
}
/** Ribbon for completing the normal monotype challenge */
public get monoNormal(): boolean {
return !!(this.payload & RibbonData.MONO_NORMAL);
}
/** Ribbon for completing the flying monotype challenge */
public get monoFlying(): boolean {
return !!(this.payload & RibbonData.MONO_FLYING);
}
/** Ribbon for completing the poison monotype challenge */
public get monoPoison(): boolean {
return !!(this.payload & RibbonData.MONO_POISON);
}
/** Ribbon for completing the ground monotype challenge */
public get monoGround(): boolean {
return !!(this.payload & RibbonData.MONO_GROUND);
}
/** Ribbon for completing the rock monotype challenge */
public get monoRock(): boolean {
return !!(this.payload & RibbonData.MONO_ROCK);
}
/** Ribbon for completing the bug monotype challenge */
public get monoBug(): boolean {
return !!(this.payload & RibbonData.MONO_BUG);
}
/** Ribbon for completing the ghost monotype challenge */
public get monoGhost(): boolean {
return !!(this.payload & RibbonData.MONO_GHOST);
}
/** Ribbon for completing the steel monotype challenge */
public get monoSteel(): boolean {
return !!(this.payload & RibbonData.MONO_STEEL);
}
/** Ribbon for completing the fire monotype challenge */
public get monoFire(): boolean {
return !!(this.payload & RibbonData.MONO_FIRE);
}
/** Ribbon for completing the water monotype challenge */
public get monoWater(): boolean {
return !!(this.payload & RibbonData.MONO_WATER);
}
/** Ribbon for completing the grass monotype challenge */
public get monoGrass(): boolean {
return !!(this.payload & RibbonData.MONO_GRASS);
}
/** Ribbon for completing the electric monotype challenge */
public get monoElectric(): boolean {
return !!(this.payload & RibbonData.MONO_ELECTRIC);
}
/** Ribbon for completing the psychic monotype challenge */
public get monoPsychic(): boolean {
return !!(this.payload & RibbonData.MONO_PSYCHIC);
}
/** Ribbon for completing the ice monotype challenge */
public get monoIce(): boolean {
return !!(this.payload & RibbonData.MONO_ICE);
}
/** Ribbon for completing the dragon monotype challenge */
public get monoDragon(): boolean {
return !!(this.payload & RibbonData.MONO_DRAGON);
}
/** Ribbon for completing the dark monotype challenge */
public get monoDark(): boolean {
return !!(this.payload & RibbonData.MONO_DARK);
}
/** Ribbon for completing the fairy monotype challenge */
public get monoFairy(): boolean {
return !!(this.payload & RibbonData.MONO_FAIRY);
}
/** Ribbon for completing fighting the monotype challenge */
public get monoFighting(): boolean {
return !!(this.payload & RibbonData.MONO_FIGHTING);
}
/** Ribbon for completing any monogen challenge */
public get monoGen(): boolean {
return !!(this.payload & RibbonData.MONO_GEN);
}
//#endregion getters
} }

View File

@ -45,6 +45,7 @@ import type { Variant } from "#sprites/variant";
import { getVariantIcon, getVariantTint } from "#sprites/variant"; import { getVariantIcon, getVariantTint } from "#sprites/variant";
import { achvs } from "#system/achv"; import { achvs } from "#system/achv";
import type { DexAttrProps, StarterAttributes, StarterMoveset } from "#system/game-data"; import type { DexAttrProps, StarterAttributes, StarterMoveset } from "#system/game-data";
import { RibbonData } from "#system/ribbons/ribbon-data";
import { SettingKeyboard } from "#system/settings-keyboard"; import { SettingKeyboard } from "#system/settings-keyboard";
import type { DexEntry } from "#types/dex-data"; import type { DexEntry } from "#types/dex-data";
import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler"; import type { OptionSelectItem } from "#ui/abstract-option-select-ui-handler";
@ -3290,7 +3291,9 @@ export class StarterSelectUiHandler extends MessageUiHandler {
); );
container.classicWinIcon container.classicWinIcon
.setVisible(gameData.starterData[speciesId].classicWinCount > 0) .setVisible(gameData.starterData[speciesId].classicWinCount > 0)
.setTexture(gameData.dexData[speciesId].ribbons.nuzlocke ? "champion_ribbon_emerald" : "champion_ribbon"); .setTexture(
gameData.dexData[speciesId].ribbons.has(RibbonData.NUZLOCKE) ? "champion_ribbon_emerald" : "champion_ribbon",
);
container.favoriteIcon.setVisible(this.starterPreferences[speciesId]?.favorite ?? false); container.favoriteIcon.setVisible(this.starterPreferences[speciesId]?.favorite ?? false);
// 'Candy Icon' mode // 'Candy Icon' mode