This commit is contained in:
Wlowscha 2025-06-30 04:56:05 -07:00 committed by GitHub
commit 55fcd0098b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 4437 additions and 4484 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 327 B

View File

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 327 B

View File

@ -54,7 +54,7 @@ export const TheStrongStuffEncounter: MysteryEncounter = MysteryEncounterBuilder
.withFleeAllowed(false) .withFleeAllowed(false)
.withIntroSpriteConfigs([ .withIntroSpriteConfigs([
{ {
spriteKey: "berry_juice", spriteKey: "berry_juice_good",
fileRoot: "items", fileRoot: "items",
hasShadow: true, hasShadow: true,
isItem: true, isItem: true,
@ -171,11 +171,11 @@ export const TheStrongStuffEncounter: MysteryEncounter = MysteryEncounterBuilder
sortedParty.forEach((pokemon, index) => { sortedParty.forEach((pokemon, index) => {
if (index < 2) { if (index < 2) {
// -15 to the two highest BST mons // -15 to the two highest BST mons
modifyPlayerPokemonBST(pokemon, -HIGH_BST_REDUCTION_VALUE); modifyPlayerPokemonBST(pokemon, false);
encounter.setDialogueToken("highBstPokemon" + (index + 1), pokemon.getNameToRender()); encounter.setDialogueToken("highBstPokemon" + (index + 1), pokemon.getNameToRender());
} else { } else {
// +10 for the rest // +10 for the rest
modifyPlayerPokemonBST(pokemon, BST_INCREASE_VALUE); modifyPlayerPokemonBST(pokemon, true);
} }
}); });

View File

@ -33,7 +33,6 @@ import {
TransformationScreenPosition, TransformationScreenPosition,
} from "#app/data/mystery-encounters/utils/encounter-transformation-sequence"; } from "#app/data/mystery-encounters/utils/encounter-transformation-sequence";
import { getLevelTotalExp } from "#app/data/exp"; import { getLevelTotalExp } from "#app/data/exp";
import { Stat } from "#enums/stat";
import { Challenges } from "#enums/challenges"; import { Challenges } from "#enums/challenges";
import { ModifierTier } from "#enums/modifier-tier"; import { ModifierTier } from "#enums/modifier-tier";
import { PlayerGender } from "#enums/player-gender"; import { PlayerGender } from "#enums/player-gender";
@ -104,8 +103,6 @@ const EXCLUDED_TRANSFORMATION_SPECIES = [
const SUPER_LEGENDARY_BST_THRESHOLD = 600; const SUPER_LEGENDARY_BST_THRESHOLD = 600;
const NON_LEGENDARY_BST_THRESHOLD = 570; const NON_LEGENDARY_BST_THRESHOLD = 570;
const OLD_GATEAU_STATS_UP = 20;
/** 0-100 */ /** 0-100 */
const PERCENT_LEVEL_LOSS_ON_REFUSE = 10; const PERCENT_LEVEL_LOSS_ON_REFUSE = 10;
@ -275,12 +272,8 @@ export const WeirdDreamEncounter: MysteryEncounter = MysteryEncounterBuilder.wit
} }
// Any pokemon that is below 570 BST gets +20 permanent BST to 3 stats // Any pokemon that is below 570 BST gets +20 permanent BST to 3 stats
if (shouldGetOldGateau(newPokemon)) { if (shouldGetOldGateau(newPokemon)) {
const stats = getOldGateauBoostedStats(newPokemon);
newPokemonHeldItemConfigs.push({ newPokemonHeldItemConfigs.push({
modifier: generateModifierType(modifierTypes.MYSTERY_ENCOUNTER_OLD_GATEAU, [ modifier: generateModifierType(modifierTypes.MYSTERY_ENCOUNTER_OLD_GATEAU) as PokemonHeldItemModifierType,
OLD_GATEAU_STATS_UP,
stats,
]) as PokemonHeldItemModifierType,
stackCount: 1, stackCount: 1,
isTransferable: false, isTransferable: false,
}); });
@ -461,11 +454,7 @@ async function doNewTeamPostProcess(transformations: PokemonTransformation[]) {
} }
// Any pokemon that is below 570 BST gets +20 permanent BST to 3 stats // Any pokemon that is below 570 BST gets +20 permanent BST to 3 stats
if (shouldGetOldGateau(newPokemon)) { if (shouldGetOldGateau(newPokemon)) {
const stats = getOldGateauBoostedStats(newPokemon); const modType = modifierTypes.MYSTERY_ENCOUNTER_OLD_GATEAU();
const modType = modifierTypes
.MYSTERY_ENCOUNTER_OLD_GATEAU()
.generateType(globalScene.getPlayerParty(), [OLD_GATEAU_STATS_UP, stats])
?.withIdFromFunc(modifierTypes.MYSTERY_ENCOUNTER_OLD_GATEAU);
const modifier = modType?.newModifier(newPokemon); const modifier = modType?.newModifier(newPokemon);
if (modifier) { if (modifier) {
globalScene.addModifier(modifier, false, false, false, true); globalScene.addModifier(modifier, false, false, false, true);
@ -616,22 +605,6 @@ function shouldGetOldGateau(pokemon: Pokemon): boolean {
return pokemon.getSpeciesForm().getBaseStatTotal() < NON_LEGENDARY_BST_THRESHOLD; return pokemon.getSpeciesForm().getBaseStatTotal() < NON_LEGENDARY_BST_THRESHOLD;
} }
/**
* Get the lowest of HP/Spd, lowest of Atk/SpAtk, and lowest of Def/SpDef
* @returns Array of 3 {@linkcode Stat}s to boost
*/
function getOldGateauBoostedStats(pokemon: Pokemon): Stat[] {
const stats: Stat[] = [];
const baseStats = pokemon.getSpeciesForm().baseStats.slice(0);
// HP or Speed
stats.push(baseStats[Stat.HP] < baseStats[Stat.SPD] ? Stat.HP : Stat.SPD);
// Attack or SpAtk
stats.push(baseStats[Stat.ATK] < baseStats[Stat.SPATK] ? Stat.ATK : Stat.SPATK);
// Def or SpDef
stats.push(baseStats[Stat.DEF] < baseStats[Stat.SPDEF] ? Stat.DEF : Stat.SPDEF);
return stats;
}
function getTransformedSpecies( function getTransformedSpecies(
originalBst: number, originalBst: number,
bstSearchRange: [number, number], bstSearchRange: [number, number],

View File

@ -375,10 +375,10 @@ export function applyHealToPokemon(pokemon: PlayerPokemon, heal: number) {
* @param pokemon * @param pokemon
* @param value * @param value
*/ */
export async function modifyPlayerPokemonBST(pokemon: PlayerPokemon, value: number) { export async function modifyPlayerPokemonBST(pokemon: PlayerPokemon, good: boolean) {
const modType = modifierTypes const modType = modifierTypes
.MYSTERY_ENCOUNTER_SHUCKLE_JUICE() .MYSTERY_ENCOUNTER_SHUCKLE_JUICE()
.generateType(globalScene.getPlayerParty(), [value]) .generateType(globalScene.getPlayerParty(), [good ? 10 : -15])
?.withIdFromFunc(modifierTypes.MYSTERY_ENCOUNTER_SHUCKLE_JUICE); ?.withIdFromFunc(modifierTypes.MYSTERY_ENCOUNTER_SHUCKLE_JUICE);
const modifier = modType?.newModifier(pokemon); const modifier = modType?.newModifier(pokemon);
if (modifier) { if (modifier) {

View File

@ -967,31 +967,23 @@ export class PokemonBaseStatTotalModifierType
extends PokemonHeldItemModifierType extends PokemonHeldItemModifierType
implements GeneratedPersistentModifierType implements GeneratedPersistentModifierType
{ {
private readonly statModifier: number; private readonly statModifier: 10 | -15;
constructor(statModifier: number) { constructor(statModifier: 10 | -15) {
super( super(
"modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE", statModifier > 0
"berry_juice", ? "modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_GOOD"
(_type, args) => new PokemonBaseStatTotalModifier(this, (args[0] as Pokemon).id, this.statModifier), : "modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_BAD",
statModifier > 0 ? "berry_juice_good" : "berry_juice_bad",
(_type, args) => new PokemonBaseStatTotalModifier(this, (args[0] as Pokemon).id, statModifier),
); );
this.statModifier = statModifier; this.statModifier = statModifier;
} }
override getDescription(): string { override getDescription(): string {
return i18next.t("modifierType:ModifierType.PokemonBaseStatTotalModifierType.description", { return this.statModifier > 0
increaseDecrease: i18next.t( ? i18next.t("modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_GOOD.description")
this.statModifier >= 0 : i18next.t("modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_BAD.description");
? "modifierType:ModifierType.PokemonBaseStatTotalModifierType.extra.increase"
: "modifierType:ModifierType.PokemonBaseStatTotalModifierType.extra.decrease",
),
blessCurse: i18next.t(
this.statModifier >= 0
? "modifierType:ModifierType.PokemonBaseStatTotalModifierType.extra.blessed"
: "modifierType:ModifierType.PokemonBaseStatTotalModifierType.extra.cursed",
),
statValue: this.statModifier,
});
} }
public getPregenArgs(): any[] { public getPregenArgs(): any[] {
@ -999,38 +991,6 @@ export class PokemonBaseStatTotalModifierType
} }
} }
/**
* Old Gateau item
*/
export class PokemonBaseStatFlatModifierType
extends PokemonHeldItemModifierType
implements GeneratedPersistentModifierType
{
private readonly statModifier: number;
private readonly stats: Stat[];
constructor(statModifier: number, stats: Stat[]) {
super(
"modifierType:ModifierType.MYSTERY_ENCOUNTER_OLD_GATEAU",
"old_gateau",
(_type, args) => new PokemonBaseStatFlatModifier(this, (args[0] as Pokemon).id, this.statModifier, this.stats),
);
this.statModifier = statModifier;
this.stats = stats;
}
override getDescription(): string {
return i18next.t("modifierType:ModifierType.PokemonBaseStatFlatModifierType.description", {
stats: this.stats.map(stat => i18next.t(getStatKey(stat))).join("/"),
statValue: this.statModifier,
});
}
public getPregenArgs(): any[] {
return [this.statModifier, this.stats];
}
}
class AllPokemonFullHpRestoreModifierType extends ModifierType { class AllPokemonFullHpRestoreModifierType extends ModifierType {
private descriptionKey: string; private descriptionKey: string;
@ -2331,17 +2291,16 @@ const modifierTypeInitObj = Object.freeze({
MYSTERY_ENCOUNTER_SHUCKLE_JUICE: () => MYSTERY_ENCOUNTER_SHUCKLE_JUICE: () =>
new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => { new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => {
if (pregenArgs) { if (pregenArgs) {
return new PokemonBaseStatTotalModifierType(pregenArgs[0] as number); return new PokemonBaseStatTotalModifierType(pregenArgs[0] as 10 | -15);
} }
return new PokemonBaseStatTotalModifierType(randSeedInt(20, 1)); return new PokemonBaseStatTotalModifierType(10);
}), }),
MYSTERY_ENCOUNTER_OLD_GATEAU: () => MYSTERY_ENCOUNTER_OLD_GATEAU: () =>
new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => { new PokemonHeldItemModifierType(
if (pregenArgs) { "modifierType:ModifierType.MYSTERY_ENCOUNTER_OLD_GATEAU",
return new PokemonBaseStatFlatModifierType(pregenArgs[0] as number, pregenArgs[1] as Stat[]); "old_gateau",
} (type, args) => new PokemonBaseStatFlatModifier(type, (args[0] as Pokemon).id),
return new PokemonBaseStatFlatModifierType(randSeedInt(20, 1), [Stat.HP, Stat.ATK, Stat.DEF]); ),
}),
MYSTERY_ENCOUNTER_BLACK_SLUDGE: () => MYSTERY_ENCOUNTER_BLACK_SLUDGE: () =>
new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => { new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => {
if (pregenArgs) { if (pregenArgs) {

View File

@ -952,10 +952,9 @@ export class EvoTrackerModifier extends PokemonHeldItemModifier {
export class PokemonBaseStatTotalModifier extends PokemonHeldItemModifier { export class PokemonBaseStatTotalModifier extends PokemonHeldItemModifier {
public override type: PokemonBaseStatTotalModifierType; public override type: PokemonBaseStatTotalModifierType;
public isTransferable = false; public isTransferable = false;
public statModifier: 10 | -15;
private statModifier: number; constructor(type: PokemonBaseStatTotalModifierType, pokemonId: number, statModifier: 10 | -15, stackCount?: number) {
constructor(type: PokemonBaseStatTotalModifierType, pokemonId: number, statModifier: number, stackCount?: number) {
super(type, pokemonId, stackCount); super(type, pokemonId, stackCount);
this.statModifier = statModifier; this.statModifier = statModifier;
} }
@ -1012,31 +1011,14 @@ export class PokemonBaseStatTotalModifier extends PokemonHeldItemModifier {
* Currently used by Old Gateau item * Currently used by Old Gateau item
*/ */
export class PokemonBaseStatFlatModifier extends PokemonHeldItemModifier { export class PokemonBaseStatFlatModifier extends PokemonHeldItemModifier {
private statModifier: number;
private stats: Stat[];
public isTransferable = false; public isTransferable = false;
constructor(type: ModifierType, pokemonId: number, statModifier: number, stats: Stat[], stackCount?: number) {
super(type, pokemonId, stackCount);
this.statModifier = statModifier;
this.stats = stats;
}
override matchType(modifier: Modifier): boolean { override matchType(modifier: Modifier): boolean {
return ( return modifier instanceof PokemonBaseStatFlatModifier;
modifier instanceof PokemonBaseStatFlatModifier &&
modifier.statModifier === this.statModifier &&
this.stats.every(s => modifier.stats.some(stat => s === stat))
);
} }
override clone(): PersistentModifier { override clone(): PersistentModifier {
return new PokemonBaseStatFlatModifier(this.type, this.pokemonId, this.statModifier, this.stats, this.stackCount); return new PokemonBaseStatFlatModifier(this.type, this.pokemonId, this.stackCount);
}
override getArgs(): any[] {
return [...super.getArgs(), this.statModifier, this.stats];
} }
/** /**
@ -1055,11 +1037,13 @@ export class PokemonBaseStatFlatModifier extends PokemonHeldItemModifier {
* @param baseStats The base stats of the {@linkcode Pokemon} * @param baseStats The base stats of the {@linkcode Pokemon}
* @returns always `true` * @returns always `true`
*/ */
override apply(_pokemon: Pokemon, baseStats: number[]): boolean { override apply(pokemon: Pokemon, baseStats: number[]): boolean {
// Modifies the passed in baseStats[] array by a flat value, only if the stat is specified in this.stats // Modifies the passed in baseStats[] array by a flat value, only if the stat is specified in this.stats
const stats = this.getStats(pokemon);
const statModifier = 20;
baseStats.forEach((v, i) => { baseStats.forEach((v, i) => {
if (this.stats.includes(i)) { if (stats.includes(i)) {
const newVal = Math.floor(v + this.statModifier); const newVal = Math.floor(v + statModifier);
baseStats[i] = Math.min(Math.max(newVal, 1), 999999); baseStats[i] = Math.min(Math.max(newVal, 1), 999999);
} }
}); });
@ -1067,6 +1051,22 @@ export class PokemonBaseStatFlatModifier extends PokemonHeldItemModifier {
return true; return true;
} }
/**
* Get the lowest of HP/Spd, lowest of Atk/SpAtk, and lowest of Def/SpDef
* @returns Array of 3 {@linkcode Stat}s to boost
*/
getStats(pokemon: Pokemon): Stat[] {
const stats: Stat[] = [];
const baseStats = pokemon.getSpeciesForm().baseStats.slice(0);
// HP or Speed
stats.push(baseStats[Stat.HP] < baseStats[Stat.SPD] ? Stat.HP : Stat.SPD);
// Attack or SpAtk
stats.push(baseStats[Stat.ATK] < baseStats[Stat.SPATK] ? Stat.ATK : Stat.SPATK);
// Def or SpDef
stats.push(baseStats[Stat.DEF] < baseStats[Stat.SPDEF] ? Stat.DEF : Stat.SPDEF);
return stats;
}
override getScoreMultiplier(): number { override getScoreMultiplier(): number {
return 1.1; return 1.1;
} }