Compare commits

..

6 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
Sirz Benjie
580ce6f046
Add tracking for friendship ribbon 2025-08-11 07:06:28 -05:00
Sirz Benjie
b96dfa92b8
Add ribbon to legacy ui folder 2025-08-11 07:06:27 -05:00
Sirz Benjie
fec202c103
Add tracking for nuzlocke completion 2025-08-11 07:06:23 -05:00
8 changed files with 17 additions and 76 deletions

Binary file not shown.

Binary file not shown.

View File

@ -103,7 +103,7 @@ export const ANTI_VARIANCE_WEIGHT_MODIFIER = 15;
export const FAKE_TITLE_LOGO_CHANCE = 10000; export const FAKE_TITLE_LOGO_CHANCE = 10000;
/** /**
* The ceiling on friendship amount that can be reached through the use of rare candies. * The ceiling on friendshp amount that can be reached through the use of rare candies.
* Using rare candies will never increase friendship beyond this value. * Using rare candies will never increase friendship beyond this value.
*/ */
export const RARE_CANDY_FRIENDSHIP_CAP = 200; export const RARE_CANDY_FRIENDSHIP_CAP = 200;

View File

@ -44,7 +44,7 @@ export abstract class Challenge {
public conditions: ChallengeCondition[]; public conditions: ChallengeCondition[];
/** /**
* The Ribbon awarded on challenge completion, or 0 if the challenge has no ribbon or is not enabled * The Ribbon awarded on challenge completion, or 0 if the challenge has no ribbon.
* *
* @defaultValue 0 * @defaultValue 0
*/ */
@ -434,11 +434,8 @@ type ChallengeCondition = (data: GameData) => boolean;
*/ */
export class SingleGenerationChallenge extends Challenge { export class SingleGenerationChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag { public override get ribbonAwarded(): RibbonFlag {
// NOTE: This logic will not work for the eventual mono gen 10 ribbon, as return RibbonData.MONO_GEN;
// as its flag will not be in sequence with the other mono gen ribbons.
return this.value ? ((RibbonData.MONO_GEN_1 << (this.value - 1)) as RibbonFlag) : 0;
} }
constructor() { constructor() {
super(Challenges.SINGLE_GENERATION, 9); super(Challenges.SINGLE_GENERATION, 9);
} }
@ -706,7 +703,7 @@ export class SingleTypeChallenge extends Challenge {
// `this.value` represents the 1-based index of pokemon type // `this.value` represents the 1-based index of pokemon type
// `RibbonData.MONO_NORMAL` starts the flag position for the types, // `RibbonData.MONO_NORMAL` starts the flag position for the types,
// and we shift it by 1 for the specific type. // and we shift it by 1 for the specific type.
return this.value ? ((RibbonData.MONO_NORMAL << (this.value - 1)) as RibbonFlag) : 0; return (RibbonData.MONO_NORMAL << (this.value - 1)) as RibbonFlag;
} }
private static TYPE_OVERRIDES: monotypeOverride[] = [ private static TYPE_OVERRIDES: monotypeOverride[] = [
{ species: SpeciesId.CASTFORM, type: PokemonType.NORMAL, fusion: false }, { species: SpeciesId.CASTFORM, type: PokemonType.NORMAL, fusion: false },
@ -777,9 +774,6 @@ export class SingleTypeChallenge extends Challenge {
* Implements a fresh start challenge. * Implements a fresh start challenge.
*/ */
export class FreshStartChallenge extends Challenge { export class FreshStartChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? RibbonData.FRESH_START : 0;
}
constructor() { constructor() {
super(Challenges.FRESH_START, 2); super(Challenges.FRESH_START, 2);
} }
@ -853,9 +847,6 @@ export class FreshStartChallenge extends Challenge {
* Implements an inverse battle challenge. * Implements an inverse battle challenge.
*/ */
export class InverseBattleChallenge extends Challenge { export class InverseBattleChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? RibbonData.INVERSE : 0;
}
constructor() { constructor() {
super(Challenges.INVERSE_BATTLE, 1); super(Challenges.INVERSE_BATTLE, 1);
} }
@ -889,9 +880,6 @@ export class InverseBattleChallenge extends Challenge {
* Implements a flip stat challenge. * Implements a flip stat challenge.
*/ */
export class FlipStatChallenge extends Challenge { export class FlipStatChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? RibbonData.FLIP_STATS : 0;
}
constructor() { constructor() {
super(Challenges.FLIP_STAT, 1); super(Challenges.FLIP_STAT, 1);
} }
@ -972,9 +960,6 @@ export class LowerStarterPointsChallenge extends Challenge {
* Implements a No Support challenge * Implements a No Support challenge
*/ */
export class LimitedSupportChallenge extends Challenge { export class LimitedSupportChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? ((RibbonData.NO_HEAL << (this.value - 1)) as RibbonFlag) : 0;
}
constructor() { constructor() {
super(Challenges.LIMITED_SUPPORT, 3); super(Challenges.LIMITED_SUPPORT, 3);
} }
@ -1007,9 +992,6 @@ export class LimitedSupportChallenge extends Challenge {
* Implements a Limited Catch challenge * Implements a Limited Catch challenge
*/ */
export class LimitedCatchChallenge extends Challenge { export class LimitedCatchChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? RibbonData.LIMITED_CATCH : 0;
}
constructor() { constructor() {
super(Challenges.LIMITED_CATCH, 1); super(Challenges.LIMITED_CATCH, 1);
} }
@ -1034,9 +1016,6 @@ export class LimitedCatchChallenge extends Challenge {
* Implements a Permanent Faint challenge * Implements a Permanent Faint challenge
*/ */
export class HardcoreChallenge extends Challenge { export class HardcoreChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? RibbonData.HARDCORE : 0;
}
constructor() { constructor() {
super(Challenges.HARDCORE, 1); super(Challenges.HARDCORE, 1);
} }

View File

@ -1865,43 +1865,27 @@ export const trainerConfigs: TrainerConfigs = {
.setPartyMemberFunc( .setPartyMemberFunc(
0, 0,
getRandomPartyMemberFunc([ getRandomPartyMemberFunc([
SpeciesId.METAPOD,
SpeciesId.LEDYBA,
SpeciesId.CLEFFA,
SpeciesId.WOOPER,
SpeciesId.TEDDIURSA,
SpeciesId.REMORAID,
SpeciesId.HOUNDOUR,
SpeciesId.SILCOON,
SpeciesId.PLUSLE, SpeciesId.PLUSLE,
SpeciesId.VOLBEAT, SpeciesId.VOLBEAT,
SpeciesId.SPINDA, SpeciesId.PACHIRISU,
SpeciesId.BONSLY, SpeciesId.SILCOON,
SpeciesId.METAPOD,
SpeciesId.IGGLYBUFF,
SpeciesId.PETILIL, SpeciesId.PETILIL,
SpeciesId.SPRITZEE, SpeciesId.EEVEE,
SpeciesId.MILCERY,
SpeciesId.PICHU,
]), ]),
) )
.setPartyMemberFunc( .setPartyMemberFunc(
1, 1,
getRandomPartyMemberFunc( getRandomPartyMemberFunc(
[ [
SpeciesId.KAKUNA,
SpeciesId.SPINARAK,
SpeciesId.IGGLYBUFF,
SpeciesId.PALDEA_WOOPER,
SpeciesId.PHANPY,
SpeciesId.MANTYKE,
SpeciesId.ELECTRIKE,
SpeciesId.CASCOON,
SpeciesId.MINUN, SpeciesId.MINUN,
SpeciesId.ILLUMISE, SpeciesId.ILLUMISE,
SpeciesId.SPINDA, SpeciesId.EMOLGA,
SpeciesId.MIME_JR, SpeciesId.CASCOON,
SpeciesId.KAKUNA,
SpeciesId.CLEFFA,
SpeciesId.COTTONEE, SpeciesId.COTTONEE,
SpeciesId.SWIRLIX,
SpeciesId.FIDOUGH,
SpeciesId.EEVEE, SpeciesId.EEVEE,
], ],
TrainerSlot.TRAINER_PARTNER, TrainerSlot.TRAINER_PARTNER,

View File

@ -895,7 +895,7 @@ export class Arena {
case BiomeId.CAVE: case BiomeId.CAVE:
return 14.24; return 14.24;
case BiomeId.DESERT: case BiomeId.DESERT:
return 9.02; return 1.143;
case BiomeId.ICE_CAVE: case BiomeId.ICE_CAVE:
return 0.0; return 0.0;
case BiomeId.MEADOW: case BiomeId.MEADOW:
@ -923,7 +923,7 @@ export class Arena {
case BiomeId.JUNGLE: case BiomeId.JUNGLE:
return 0.0; return 0.0;
case BiomeId.FAIRY_CAVE: case BiomeId.FAIRY_CAVE:
return 0.0; return 4.542;
case BiomeId.TEMPLE: case BiomeId.TEMPLE:
return 2.547; return 2.547;
case BiomeId.ISLAND: case BiomeId.ISLAND:

View File

@ -1,6 +1,5 @@
import type { Brander } from "#types/type-helpers"; import type { Brander } from "#types/type-helpers";
export type RibbonFlag = number & Brander<"RibbonFlag">;
export type RibbonFlag = (number & Brander<"RibbonFlag">) | 0;
/** /**
* Class for ribbon data management. Usually constructed via the {@linkcode fromJSON} method. * Class for ribbon data management. Usually constructed via the {@linkcode fromJSON} method.
@ -79,27 +78,6 @@ export class RibbonData {
public static readonly NUZLOCKE = 0x10000000 as RibbonFlag; public static readonly NUZLOCKE = 0x10000000 as RibbonFlag;
/** Ribbon for reaching max friendship */ /** Ribbon for reaching max friendship */
public static readonly FRIENDSHIP = 0x20000000 as RibbonFlag; public static readonly FRIENDSHIP = 0x20000000 as RibbonFlag;
/** Ribbon for winning the flip stats challenge */
public static readonly FLIP_STATS = 0x40000000 as RibbonFlag;
/** Ribbon for winning the inverse challenge */
public static readonly INVERSE = 0x80000000 as RibbonFlag;
/** Ribbon for winning the fresh start challenge */
public static readonly FRESH_START = 0x100000000 as RibbonFlag;
/** Ribbon for winning the hardcore challenge */
public static readonly HARDCORE = 0x200000000 as RibbonFlag;
/** Ribbon for winning the limited catch challenge */
public static readonly LIMITED_CATCH = 0x400000000 as RibbonFlag;
/** Ribbon for winning the limited support challenge set to no heal */
public static readonly NO_HEAL = 0x800000000 as RibbonFlag;
/** Ribbon for winning the limited uspport challenge set to no shop */
public static readonly NO_SHOP = 0x1000000000 as RibbonFlag;
/** Ribbon for winning the limited support challenge set to both*/
public static readonly NO_SUPPORT = 0x2000000000 as RibbonFlag;
// NOTE: max possible ribbon flag is 0x20000000000000 (53 total ribbons)
// Once this is exceeded, bitfield needs to be changed to a bigint or even a uint array
// Note that this has no impact on serialization as it is stored in hex.
//#endregion Ribbons //#endregion Ribbons
/** Create a new instance of RibbonData. Generally, {@linkcode fromJSON} is used instead. */ /** Create a new instance of RibbonData. Generally, {@linkcode fromJSON} is used instead. */

View File

@ -8,7 +8,7 @@ import { isNullOrUndefined } from "#utils/common";
* Award one or more ribbons to a species and its pre-evolutions * Award one or more ribbons to a species and its pre-evolutions
* *
* @param id - The ID of the species to award ribbons to * @param id - The ID of the species to award ribbons to
* @param ribbons - The ribbon(s) to award (use bitwise OR to combine multiple) * @param ribbons The ribbon(s) to award (use bitwise OR to combine multiple)
*/ */
export function awardRibbonsToSpeciesLine(id: SpeciesId, ribbons: RibbonFlag): void { export function awardRibbonsToSpeciesLine(id: SpeciesId, ribbons: RibbonFlag): void {
const dexData = globalScene.gameData.dexData; const dexData = globalScene.gameData.dexData;