mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 00:12:16 +02:00
[Balance] Berry Juice and Old Gateau do not depend on the instance
https://github.com/pagefaultgames/pokerogue/pull/6016 * Refactored items and respective MEs * Changed icon names, added bad berry juice, fixed locales * Berry juice uses a number parameter again, allowing to convert from old saves without a migrator * Updated encounter with correct sprite * Update src/data/mystery-encounters/encounters/weird-dream-encounter.ts Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> * Replaced bad berry juice icon * Repacked atlas * Re-export item atlas --------- Co-authored-by: NightKev <34855794+DayKev@users.noreply.github.com> Co-authored-by: Madmadness65 <blaze.the.fireman@gmail.com>
This commit is contained in:
parent
e20313e22c
commit
f6a434689c
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 |
BIN
public/images/items/berry_juice_bad.png
Normal file
BIN
public/images/items/berry_juice_bad.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 327 B After Width: | Height: | Size: 327 B |
@ -54,7 +54,7 @@ export const TheStrongStuffEncounter: MysteryEncounter = MysteryEncounterBuilder
|
||||
.withFleeAllowed(false)
|
||||
.withIntroSpriteConfigs([
|
||||
{
|
||||
spriteKey: "berry_juice",
|
||||
spriteKey: "berry_juice_good",
|
||||
fileRoot: "items",
|
||||
hasShadow: true,
|
||||
isItem: true,
|
||||
@ -171,11 +171,11 @@ export const TheStrongStuffEncounter: MysteryEncounter = MysteryEncounterBuilder
|
||||
sortedParty.forEach((pokemon, index) => {
|
||||
if (index < 2) {
|
||||
// -15 to the two highest BST mons
|
||||
modifyPlayerPokemonBST(pokemon, -HIGH_BST_REDUCTION_VALUE);
|
||||
modifyPlayerPokemonBST(pokemon, false);
|
||||
encounter.setDialogueToken("highBstPokemon" + (index + 1), pokemon.getNameToRender());
|
||||
} else {
|
||||
// +10 for the rest
|
||||
modifyPlayerPokemonBST(pokemon, BST_INCREASE_VALUE);
|
||||
modifyPlayerPokemonBST(pokemon, true);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -33,7 +33,6 @@ import {
|
||||
TransformationScreenPosition,
|
||||
} from "#app/data/mystery-encounters/utils/encounter-transformation-sequence";
|
||||
import { getLevelTotalExp } from "#app/data/exp";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { Challenges } from "#enums/challenges";
|
||||
import { ModifierTier } from "#enums/modifier-tier";
|
||||
import { PlayerGender } from "#enums/player-gender";
|
||||
@ -104,8 +103,6 @@ const EXCLUDED_TRANSFORMATION_SPECIES = [
|
||||
const SUPER_LEGENDARY_BST_THRESHOLD = 600;
|
||||
const NON_LEGENDARY_BST_THRESHOLD = 570;
|
||||
|
||||
const OLD_GATEAU_STATS_UP = 20;
|
||||
|
||||
/** 0-100 */
|
||||
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
|
||||
if (shouldGetOldGateau(newPokemon)) {
|
||||
const stats = getOldGateauBoostedStats(newPokemon);
|
||||
newPokemonHeldItemConfigs.push({
|
||||
modifier: generateModifierType(modifierTypes.MYSTERY_ENCOUNTER_OLD_GATEAU, [
|
||||
OLD_GATEAU_STATS_UP,
|
||||
stats,
|
||||
]) as PokemonHeldItemModifierType,
|
||||
modifier: generateModifierType(modifierTypes.MYSTERY_ENCOUNTER_OLD_GATEAU) as PokemonHeldItemModifierType,
|
||||
stackCount: 1,
|
||||
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
|
||||
if (shouldGetOldGateau(newPokemon)) {
|
||||
const stats = getOldGateauBoostedStats(newPokemon);
|
||||
const modType = modifierTypes
|
||||
.MYSTERY_ENCOUNTER_OLD_GATEAU()
|
||||
.generateType(globalScene.getPlayerParty(), [OLD_GATEAU_STATS_UP, stats])
|
||||
?.withIdFromFunc(modifierTypes.MYSTERY_ENCOUNTER_OLD_GATEAU);
|
||||
const modType = modifierTypes.MYSTERY_ENCOUNTER_OLD_GATEAU();
|
||||
const modifier = modType?.newModifier(newPokemon);
|
||||
if (modifier) {
|
||||
globalScene.addModifier(modifier, false, false, false, true);
|
||||
@ -616,22 +605,6 @@ function shouldGetOldGateau(pokemon: Pokemon): boolean {
|
||||
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(
|
||||
originalBst: number,
|
||||
bstSearchRange: [number, number],
|
||||
|
@ -375,10 +375,10 @@ export function applyHealToPokemon(pokemon: PlayerPokemon, heal: number) {
|
||||
* @param pokemon
|
||||
* @param value
|
||||
*/
|
||||
export async function modifyPlayerPokemonBST(pokemon: PlayerPokemon, value: number) {
|
||||
export async function modifyPlayerPokemonBST(pokemon: PlayerPokemon, good: boolean) {
|
||||
const modType = modifierTypes
|
||||
.MYSTERY_ENCOUNTER_SHUCKLE_JUICE()
|
||||
.generateType(globalScene.getPlayerParty(), [value])
|
||||
.generateType(globalScene.getPlayerParty(), [good ? 10 : -15])
|
||||
?.withIdFromFunc(modifierTypes.MYSTERY_ENCOUNTER_SHUCKLE_JUICE);
|
||||
const modifier = modType?.newModifier(pokemon);
|
||||
if (modifier) {
|
||||
|
@ -967,31 +967,23 @@ export class PokemonBaseStatTotalModifierType
|
||||
extends PokemonHeldItemModifierType
|
||||
implements GeneratedPersistentModifierType
|
||||
{
|
||||
private readonly statModifier: number;
|
||||
private readonly statModifier: 10 | -15;
|
||||
|
||||
constructor(statModifier: number) {
|
||||
constructor(statModifier: 10 | -15) {
|
||||
super(
|
||||
"modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE",
|
||||
"berry_juice",
|
||||
(_type, args) => new PokemonBaseStatTotalModifier(this, (args[0] as Pokemon).id, this.statModifier),
|
||||
statModifier > 0
|
||||
? "modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_GOOD"
|
||||
: "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;
|
||||
}
|
||||
|
||||
override getDescription(): string {
|
||||
return i18next.t("modifierType:ModifierType.PokemonBaseStatTotalModifierType.description", {
|
||||
increaseDecrease: i18next.t(
|
||||
this.statModifier >= 0
|
||||
? "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,
|
||||
});
|
||||
return this.statModifier > 0
|
||||
? i18next.t("modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_GOOD.description")
|
||||
: i18next.t("modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_BAD.description");
|
||||
}
|
||||
|
||||
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 {
|
||||
private descriptionKey: string;
|
||||
|
||||
@ -2331,17 +2291,16 @@ const modifierTypeInitObj = Object.freeze({
|
||||
MYSTERY_ENCOUNTER_SHUCKLE_JUICE: () =>
|
||||
new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => {
|
||||
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: () =>
|
||||
new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => {
|
||||
if (pregenArgs) {
|
||||
return new PokemonBaseStatFlatModifierType(pregenArgs[0] as number, pregenArgs[1] as Stat[]);
|
||||
}
|
||||
return new PokemonBaseStatFlatModifierType(randSeedInt(20, 1), [Stat.HP, Stat.ATK, Stat.DEF]);
|
||||
}),
|
||||
new PokemonHeldItemModifierType(
|
||||
"modifierType:ModifierType.MYSTERY_ENCOUNTER_OLD_GATEAU",
|
||||
"old_gateau",
|
||||
(type, args) => new PokemonBaseStatFlatModifier(type, (args[0] as Pokemon).id),
|
||||
),
|
||||
MYSTERY_ENCOUNTER_BLACK_SLUDGE: () =>
|
||||
new ModifierTypeGenerator((_party: Pokemon[], pregenArgs?: any[]) => {
|
||||
if (pregenArgs) {
|
||||
|
@ -952,10 +952,9 @@ export class EvoTrackerModifier extends PokemonHeldItemModifier {
|
||||
export class PokemonBaseStatTotalModifier extends PokemonHeldItemModifier {
|
||||
public override type: PokemonBaseStatTotalModifierType;
|
||||
public isTransferable = false;
|
||||
public statModifier: 10 | -15;
|
||||
|
||||
private statModifier: number;
|
||||
|
||||
constructor(type: PokemonBaseStatTotalModifierType, pokemonId: number, statModifier: number, stackCount?: number) {
|
||||
constructor(type: PokemonBaseStatTotalModifierType, pokemonId: number, statModifier: 10 | -15, stackCount?: number) {
|
||||
super(type, pokemonId, stackCount);
|
||||
this.statModifier = statModifier;
|
||||
}
|
||||
@ -1012,31 +1011,14 @@ export class PokemonBaseStatTotalModifier extends PokemonHeldItemModifier {
|
||||
* Currently used by Old Gateau item
|
||||
*/
|
||||
export class PokemonBaseStatFlatModifier extends PokemonHeldItemModifier {
|
||||
private statModifier: number;
|
||||
private stats: Stat[];
|
||||
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 {
|
||||
return (
|
||||
modifier instanceof PokemonBaseStatFlatModifier &&
|
||||
modifier.statModifier === this.statModifier &&
|
||||
this.stats.every(s => modifier.stats.some(stat => s === stat))
|
||||
);
|
||||
return modifier instanceof PokemonBaseStatFlatModifier;
|
||||
}
|
||||
|
||||
override clone(): PersistentModifier {
|
||||
return new PokemonBaseStatFlatModifier(this.type, this.pokemonId, this.statModifier, this.stats, this.stackCount);
|
||||
}
|
||||
|
||||
override getArgs(): any[] {
|
||||
return [...super.getArgs(), this.statModifier, this.stats];
|
||||
return new PokemonBaseStatFlatModifier(this.type, this.pokemonId, this.stackCount);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1055,11 +1037,13 @@ export class PokemonBaseStatFlatModifier extends PokemonHeldItemModifier {
|
||||
* @param baseStats The base stats of the {@linkcode Pokemon}
|
||||
* @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
|
||||
const stats = this.getStats(pokemon);
|
||||
const statModifier = 20;
|
||||
baseStats.forEach((v, i) => {
|
||||
if (this.stats.includes(i)) {
|
||||
const newVal = Math.floor(v + this.statModifier);
|
||||
if (stats.includes(i)) {
|
||||
const newVal = Math.floor(v + statModifier);
|
||||
baseStats[i] = Math.min(Math.max(newVal, 1), 999999);
|
||||
}
|
||||
});
|
||||
@ -1067,6 +1051,22 @@ export class PokemonBaseStatFlatModifier extends PokemonHeldItemModifier {
|
||||
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 {
|
||||
return 1.1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user