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;
/**
* 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.
*/
export const RARE_CANDY_FRIENDSHIP_CAP = 200;

View File

@ -44,7 +44,7 @@ export abstract class Challenge {
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
*/
@ -434,11 +434,8 @@ type ChallengeCondition = (data: GameData) => boolean;
*/
export class SingleGenerationChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
// NOTE: This logic will not work for the eventual mono gen 10 ribbon, as
// 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;
return RibbonData.MONO_GEN;
}
constructor() {
super(Challenges.SINGLE_GENERATION, 9);
}
@ -706,7 +703,7 @@ export class SingleTypeChallenge extends Challenge {
// `this.value` represents the 1-based index of pokemon type
// `RibbonData.MONO_NORMAL` starts the flag position for the types,
// 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[] = [
{ species: SpeciesId.CASTFORM, type: PokemonType.NORMAL, fusion: false },
@ -777,9 +774,6 @@ export class SingleTypeChallenge extends Challenge {
* Implements a fresh start challenge.
*/
export class FreshStartChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? RibbonData.FRESH_START : 0;
}
constructor() {
super(Challenges.FRESH_START, 2);
}
@ -853,9 +847,6 @@ export class FreshStartChallenge extends Challenge {
* Implements an inverse battle challenge.
*/
export class InverseBattleChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? RibbonData.INVERSE : 0;
}
constructor() {
super(Challenges.INVERSE_BATTLE, 1);
}
@ -889,9 +880,6 @@ export class InverseBattleChallenge extends Challenge {
* Implements a flip stat challenge.
*/
export class FlipStatChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? RibbonData.FLIP_STATS : 0;
}
constructor() {
super(Challenges.FLIP_STAT, 1);
}
@ -972,9 +960,6 @@ export class LowerStarterPointsChallenge extends Challenge {
* Implements a No Support challenge
*/
export class LimitedSupportChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? ((RibbonData.NO_HEAL << (this.value - 1)) as RibbonFlag) : 0;
}
constructor() {
super(Challenges.LIMITED_SUPPORT, 3);
}
@ -1007,9 +992,6 @@ export class LimitedSupportChallenge extends Challenge {
* Implements a Limited Catch challenge
*/
export class LimitedCatchChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? RibbonData.LIMITED_CATCH : 0;
}
constructor() {
super(Challenges.LIMITED_CATCH, 1);
}
@ -1034,9 +1016,6 @@ export class LimitedCatchChallenge extends Challenge {
* Implements a Permanent Faint challenge
*/
export class HardcoreChallenge extends Challenge {
public override get ribbonAwarded(): RibbonFlag {
return this.value ? RibbonData.HARDCORE : 0;
}
constructor() {
super(Challenges.HARDCORE, 1);
}

View File

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

View File

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

View File

@ -1,6 +1,5 @@
import type { Brander } from "#types/type-helpers";
export type RibbonFlag = (number & Brander<"RibbonFlag">) | 0;
export type RibbonFlag = number & Brander<"RibbonFlag">;
/**
* 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;
/** Ribbon for reaching max friendship */
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
/** 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
*
* @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 {
const dexData = globalScene.gameData.dexData;