mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
Berry juice uses a number parameter again, allowing to convert from old saves without a migrator
This commit is contained in:
parent
f955a55493
commit
421f9588d5
@ -378,7 +378,7 @@ export function applyHealToPokemon(pokemon: PlayerPokemon, heal: number) {
|
|||||||
export async function modifyPlayerPokemonBST(pokemon: PlayerPokemon, good: boolean) {
|
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(), [good])
|
.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) {
|
||||||
|
@ -967,27 +967,27 @@ export class PokemonBaseStatTotalModifierType
|
|||||||
extends PokemonHeldItemModifierType
|
extends PokemonHeldItemModifierType
|
||||||
implements GeneratedPersistentModifierType
|
implements GeneratedPersistentModifierType
|
||||||
{
|
{
|
||||||
private readonly good: boolean;
|
private readonly statModifier: 10 | -15;
|
||||||
|
|
||||||
constructor(good: boolean) {
|
constructor(statModifier: 10 | -15) {
|
||||||
super(
|
super(
|
||||||
good
|
statModifier > 0
|
||||||
? "modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_GOOD.name"
|
? "modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_GOOD"
|
||||||
: "modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_BAD.name",
|
: "modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_BAD",
|
||||||
good ? "berry_juice_good" : "berry_juice_bad",
|
statModifier > 0 ? "berry_juice_good" : "berry_juice_bad",
|
||||||
(_type, args) => new PokemonBaseStatTotalModifier(this, (args[0] as Pokemon).id, this.good),
|
(_type, args) => new PokemonBaseStatTotalModifier(this, (args[0] as Pokemon).id, statModifier),
|
||||||
);
|
);
|
||||||
this.good = good;
|
this.statModifier = statModifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
override getDescription(): string {
|
override getDescription(): string {
|
||||||
return this.good
|
return this.statModifier > 0
|
||||||
? i18next.t("modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_GOOD.description")
|
? i18next.t("modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_GOOD.description")
|
||||||
: i18next.t("modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_BAD.description");
|
: i18next.t("modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE_BAD.description");
|
||||||
}
|
}
|
||||||
|
|
||||||
public getPregenArgs(): any[] {
|
public getPregenArgs(): any[] {
|
||||||
return [this.good];
|
return [this.statModifier];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2291,9 +2291,9 @@ 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 boolean);
|
return new PokemonBaseStatTotalModifierType(pregenArgs[0] as 10 | -15);
|
||||||
}
|
}
|
||||||
return new PokemonBaseStatTotalModifierType(true);
|
return new PokemonBaseStatTotalModifierType(10);
|
||||||
}),
|
}),
|
||||||
MYSTERY_ENCOUNTER_OLD_GATEAU: () =>
|
MYSTERY_ENCOUNTER_OLD_GATEAU: () =>
|
||||||
new PokemonHeldItemModifierType(
|
new PokemonHeldItemModifierType(
|
||||||
|
@ -952,23 +952,23 @@ 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 good: boolean;
|
public statModifier: 10 | -15;
|
||||||
|
|
||||||
constructor(type: PokemonBaseStatTotalModifierType, pokemonId: number, good: boolean, stackCount?: number) {
|
constructor(type: PokemonBaseStatTotalModifierType, pokemonId: number, statModifier: 10 | -15, stackCount?: number) {
|
||||||
super(type, pokemonId, stackCount);
|
super(type, pokemonId, stackCount);
|
||||||
this.good = good;
|
this.statModifier = statModifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
override matchType(modifier: Modifier): boolean {
|
override matchType(modifier: Modifier): boolean {
|
||||||
return modifier instanceof PokemonBaseStatTotalModifier && this.good === modifier.good;
|
return modifier instanceof PokemonBaseStatTotalModifier && this.statModifier === modifier.statModifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
override clone(): PersistentModifier {
|
override clone(): PersistentModifier {
|
||||||
return new PokemonBaseStatTotalModifier(this.type, this.pokemonId, this.good, this.stackCount);
|
return new PokemonBaseStatTotalModifier(this.type, this.pokemonId, this.statModifier, this.stackCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
override getArgs(): any[] {
|
override getArgs(): any[] {
|
||||||
return super.getArgs().concat(this.good);
|
return super.getArgs().concat(this.statModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -988,11 +988,10 @@ export class PokemonBaseStatTotalModifier extends PokemonHeldItemModifier {
|
|||||||
* @returns always `true`
|
* @returns always `true`
|
||||||
*/
|
*/
|
||||||
override apply(_pokemon: Pokemon, baseStats: number[]): boolean {
|
override apply(_pokemon: Pokemon, baseStats: number[]): boolean {
|
||||||
const statModifier = this.good ? 10 : -15;
|
|
||||||
// Modifies the passed in baseStats[] array
|
// Modifies the passed in baseStats[] array
|
||||||
baseStats.forEach((v, i) => {
|
baseStats.forEach((v, i) => {
|
||||||
// HP is affected by half as much as other stats
|
// HP is affected by half as much as other stats
|
||||||
const newVal = i === 0 ? Math.floor(v + statModifier / 2) : Math.floor(v + statModifier);
|
const newVal = i === 0 ? Math.floor(v + this.statModifier / 2) : Math.floor(v + this.statModifier);
|
||||||
baseStats[i] = Math.min(Math.max(newVal, 1), 999999);
|
baseStats[i] = Math.min(Math.max(newVal, 1), 999999);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user