mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 15:32:18 +02:00
Refactored items and respective MEs
This commit is contained in:
parent
9f67e06279
commit
23932b1bd9
@ -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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -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,7 +103,7 @@ 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;
|
//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 +274,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 +456,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 +607,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],
|
||||||
|
@ -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])
|
||||||
?.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,67 +967,27 @@ export class PokemonBaseStatTotalModifierType
|
|||||||
extends PokemonHeldItemModifierType
|
extends PokemonHeldItemModifierType
|
||||||
implements GeneratedPersistentModifierType
|
implements GeneratedPersistentModifierType
|
||||||
{
|
{
|
||||||
private readonly statModifier: number;
|
private readonly good: boolean;
|
||||||
|
|
||||||
constructor(statModifier: number) {
|
constructor(good: boolean) {
|
||||||
super(
|
super(
|
||||||
"modifierType:ModifierType.MYSTERY_ENCOUNTER_SHUCKLE_JUICE",
|
good
|
||||||
"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",
|
||||||
|
good ? "good_berry_juice" : "bad_berry_juice",
|
||||||
|
(_type, args) => new PokemonBaseStatTotalModifier(this, (args[0] as Pokemon).id, this.good),
|
||||||
);
|
);
|
||||||
this.statModifier = statModifier;
|
this.good = good;
|
||||||
}
|
}
|
||||||
|
|
||||||
override getDescription(): string {
|
override getDescription(): string {
|
||||||
return i18next.t("modifierType:ModifierType.PokemonBaseStatTotalModifierType.description", {
|
return this.good
|
||||||
increaseDecrease: i18next.t(
|
? i18next.t("modifierType:ModifierType.PokemonBaseStatTotalModifierType.description.good")
|
||||||
this.statModifier >= 0
|
: i18next.t("modifierType:ModifierType.PokemonBaseStatTotalModifierType.description.bad");
|
||||||
? "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[] {
|
||||||
return [this.statModifier];
|
return [this.good];
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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 boolean);
|
||||||
}
|
}
|
||||||
return new PokemonBaseStatTotalModifierType(randSeedInt(20, 1));
|
return new PokemonBaseStatTotalModifierType(true);
|
||||||
}),
|
}),
|
||||||
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) {
|
||||||
|
@ -952,24 +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;
|
||||||
|
|
||||||
private statModifier: number;
|
constructor(type: PokemonBaseStatTotalModifierType, pokemonId: number, good: boolean, stackCount?: number) {
|
||||||
|
|
||||||
constructor(type: PokemonBaseStatTotalModifierType, pokemonId: number, statModifier: number, stackCount?: number) {
|
|
||||||
super(type, pokemonId, stackCount);
|
super(type, pokemonId, stackCount);
|
||||||
this.statModifier = statModifier;
|
this.good = good;
|
||||||
}
|
}
|
||||||
|
|
||||||
override matchType(modifier: Modifier): boolean {
|
override matchType(modifier: Modifier): boolean {
|
||||||
return modifier instanceof PokemonBaseStatTotalModifier && this.statModifier === modifier.statModifier;
|
return modifier instanceof PokemonBaseStatTotalModifier && this.good === modifier.good;
|
||||||
}
|
}
|
||||||
|
|
||||||
override clone(): PersistentModifier {
|
override clone(): PersistentModifier {
|
||||||
return new PokemonBaseStatTotalModifier(this.type, this.pokemonId, this.statModifier, this.stackCount);
|
return new PokemonBaseStatTotalModifier(this.type, this.pokemonId, this.good, this.stackCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
override getArgs(): any[] {
|
override getArgs(): any[] {
|
||||||
return super.getArgs().concat(this.statModifier);
|
return super.getArgs().concat(this.good);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -989,10 +988,11 @@ 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 + this.statModifier / 2) : Math.floor(v + this.statModifier);
|
const newVal = i === 0 ? Math.floor(v + statModifier / 2) : Math.floor(v + statModifier);
|
||||||
baseStats[i] = Math.min(Math.max(newVal, 1), 999999);
|
baseStats[i] = Math.min(Math.max(newVal, 1), 999999);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1012,31 +1012,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 +1038,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 +1052,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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user