mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-29 11:42:21 +02:00
ME bug fix cleanup
This commit is contained in:
parent
ed1a34fa84
commit
6561074d60
@ -14,7 +14,7 @@ import { PlayerGender } from "#enums/player-gender";
|
|||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
import { TrainerType } from "#enums/trainer-type";
|
import { TrainerType } from "#enums/trainer-type";
|
||||||
import i18next from "#app/plugins/i18n";
|
import i18next from "#app/plugins/i18n";
|
||||||
import MysteryEncounter from "./data/mystery-encounters/mystery-encounter";
|
import MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||||
|
|
||||||
export enum BattleType {
|
export enum BattleType {
|
||||||
|
@ -158,8 +158,8 @@ export async function initBattleWithEnemyConfig(scene: BattleScene, partyConfig:
|
|||||||
|
|
||||||
// ME levels are modified by an additive value that scales with wave index
|
// ME levels are modified by an additive value that scales with wave index
|
||||||
// Base scaling: Every 10 waves, modifier gets +1 level
|
// Base scaling: Every 10 waves, modifier gets +1 level
|
||||||
// This can be amplified or counteracted by setting levelAdditiveMultiplier in config
|
// This can be amplified or counteracted by setting levelAdditiveModifier in config
|
||||||
// levelAdditiveMultiplier value of 0.5 will halve the modifier scaling, 2 will double it, etc.
|
// levelAdditiveModifier value of 0.5 will halve the modifier scaling, 2 will double it, etc.
|
||||||
// Leaving null/undefined will disable level scaling
|
// Leaving null/undefined will disable level scaling
|
||||||
const mult: number = !isNullOrUndefined(partyConfig.levelAdditiveModifier) ? partyConfig.levelAdditiveModifier! : 0;
|
const mult: number = !isNullOrUndefined(partyConfig.levelAdditiveModifier) ? partyConfig.levelAdditiveModifier! : 0;
|
||||||
const additive = Math.max(Math.round((scene.currentBattle.waveIndex / 10) * mult), 0);
|
const additive = Math.max(Math.round((scene.currentBattle.waveIndex / 10) * mult), 0);
|
||||||
|
@ -737,10 +737,10 @@ export function getGoldenBugNetSpecies(): PokemonSpecies {
|
|||||||
/**
|
/**
|
||||||
* Generates a Pokemon level for a given wave, with an option to increase/decrease by a scaling modifier
|
* Generates a Pokemon level for a given wave, with an option to increase/decrease by a scaling modifier
|
||||||
*/
|
*/
|
||||||
export function getEncounterPokemonLevelForWave(scene: BattleScene, levelAdditiveModifier: number = 0) {
|
export function getEncounterPokemonLevelForWave({currentBattle}: BattleScene, levelAdditiveModifier: number = 0) {
|
||||||
// Default to use the first generated level from enemyLevels, or generate a new one if it DNE
|
// Default to use the first generated level from enemyLevels, or generate a new one if it DNE
|
||||||
const baseLevel = scene.currentBattle.enemyLevels && scene.currentBattle.enemyLevels?.length > 0 ? scene.currentBattle.enemyLevels[0] : scene.currentBattle.getLevelForWave();
|
const baseLevel = currentBattle.enemyLevels && currentBattle.enemyLevels?.length > 0 ? currentBattle.enemyLevels[0] : currentBattle.getLevelForWave();
|
||||||
|
|
||||||
// Add a level scaling modifier that is (+1 level per 10 waves) * levelAdditiveModifier
|
// Add a level scaling modifier that is (+1 level per 10 waves) * levelAdditiveModifier
|
||||||
return baseLevel + Math.max(Math.round((scene.currentBattle.waveIndex / 10) * levelAdditiveModifier), 0);
|
return baseLevel + Math.max(Math.round((currentBattle.waveIndex / 10) * levelAdditiveModifier), 0);
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ class DefaultOverrides {
|
|||||||
/** 1 to 256, set to null to ignore */
|
/** 1 to 256, set to null to ignore */
|
||||||
readonly MYSTERY_ENCOUNTER_RATE_OVERRIDE: number | null = null;
|
readonly MYSTERY_ENCOUNTER_RATE_OVERRIDE: number | null = null;
|
||||||
readonly MYSTERY_ENCOUNTER_TIER_OVERRIDE: MysteryEncounterTier | null = null;
|
readonly MYSTERY_ENCOUNTER_TIER_OVERRIDE: MysteryEncounterTier | null = null;
|
||||||
readonly MYSTERY_ENCOUNTER_OVERRIDE: MysteryEncounterType | null = MysteryEncounterType.DELIBIRDY;
|
readonly MYSTERY_ENCOUNTER_OVERRIDE: MysteryEncounterType | null = null;
|
||||||
|
|
||||||
// -------------------------
|
// -------------------------
|
||||||
// MODIFIER / ITEM OVERRIDES
|
// MODIFIER / ITEM OVERRIDES
|
||||||
|
@ -180,15 +180,16 @@ export class CommandPhase extends FieldPhase {
|
|||||||
case Command.POKEMON:
|
case Command.POKEMON:
|
||||||
case Command.RUN:
|
case Command.RUN:
|
||||||
const isSwitch = command === Command.POKEMON;
|
const isSwitch = command === Command.POKEMON;
|
||||||
const mysteryEncounterFleeAllowed = this.scene.currentBattle.mysteryEncounter?.fleeAllowed;
|
const { currentBattle, arena } = this.scene;
|
||||||
if (!isSwitch && (this.scene.arena.biomeType === Biome.END || (!isNullOrUndefined(mysteryEncounterFleeAllowed) && !mysteryEncounterFleeAllowed))) {
|
const mysteryEncounterFleeAllowed = currentBattle.mysteryEncounter?.fleeAllowed;
|
||||||
|
if (!isSwitch && (arena.biomeType === Biome.END || (!isNullOrUndefined(mysteryEncounterFleeAllowed) && !mysteryEncounterFleeAllowed))) {
|
||||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
this.scene.ui.showText(i18next.t("battle:noEscapeForce"), null, () => {
|
this.scene.ui.showText(i18next.t("battle:noEscapeForce"), null, () => {
|
||||||
this.scene.ui.showText("", 0);
|
this.scene.ui.showText("", 0);
|
||||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||||
}, null, true);
|
}, null, true);
|
||||||
} else if (!isSwitch && (this.scene.currentBattle.battleType === BattleType.TRAINER || this.scene.currentBattle.mysteryEncounter?.encounterMode === MysteryEncounterMode.TRAINER_BATTLE)) {
|
} else if (!isSwitch && (currentBattle.battleType === BattleType.TRAINER || currentBattle.mysteryEncounter?.encounterMode === MysteryEncounterMode.TRAINER_BATTLE)) {
|
||||||
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
this.scene.ui.setMode(Mode.COMMAND, this.fieldIndex);
|
||||||
this.scene.ui.setMode(Mode.MESSAGE);
|
this.scene.ui.setMode(Mode.MESSAGE);
|
||||||
this.scene.ui.showText(i18next.t("battle:noEscapeTrainer"), null, () => {
|
this.scene.ui.showText(i18next.t("battle:noEscapeTrainer"), null, () => {
|
||||||
@ -199,12 +200,12 @@ export class CommandPhase extends FieldPhase {
|
|||||||
const batonPass = isSwitch && args[0] as boolean;
|
const batonPass = isSwitch && args[0] as boolean;
|
||||||
const trappedAbMessages: string[] = [];
|
const trappedAbMessages: string[] = [];
|
||||||
if (batonPass || !playerPokemon.isTrapped(trappedAbMessages)) {
|
if (batonPass || !playerPokemon.isTrapped(trappedAbMessages)) {
|
||||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
||||||
? { command: Command.POKEMON, cursor: cursor, args: args }
|
? { command: Command.POKEMON, cursor: cursor, args: args }
|
||||||
: { command: Command.RUN };
|
: { command: Command.RUN };
|
||||||
success = true;
|
success = true;
|
||||||
if (!isSwitch && this.fieldIndex) {
|
if (!isSwitch && this.fieldIndex) {
|
||||||
this.scene.currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true;
|
currentBattle.turnCommands[this.fieldIndex - 1]!.skip = true;
|
||||||
}
|
}
|
||||||
} else if (trappedAbMessages.length > 0) {
|
} else if (trappedAbMessages.length > 0) {
|
||||||
if (!isSwitch) {
|
if (!isSwitch) {
|
||||||
@ -221,7 +222,7 @@ export class CommandPhase extends FieldPhase {
|
|||||||
|
|
||||||
// trapTag should be defined at this point, but just in case...
|
// trapTag should be defined at this point, but just in case...
|
||||||
if (!trapTag) {
|
if (!trapTag) {
|
||||||
this.scene.currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
currentBattle.turnCommands[this.fieldIndex] = isSwitch
|
||||||
? { command: Command.POKEMON, cursor: cursor, args: args }
|
? { command: Command.POKEMON, cursor: cursor, args: args }
|
||||||
: { command: Command.RUN };
|
: { command: Command.RUN };
|
||||||
break;
|
break;
|
||||||
|
@ -62,7 +62,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
this.scene.clearPhaseQueue();
|
this.scene.clearPhaseQueue();
|
||||||
// If this is a ME, clear any residual visual sprites before reloading
|
// If this is a ME, clear any residual visual sprites before reloading
|
||||||
const encounter = this.scene.currentBattle.mysteryEncounter;
|
const encounter = this.scene.currentBattle.mysteryEncounter;
|
||||||
if (encounter && encounter.introVisuals) {
|
if (encounter?.introVisuals) {
|
||||||
this.scene.field.remove(encounter.introVisuals, true);
|
this.scene.field.remove(encounter.introVisuals, true);
|
||||||
}
|
}
|
||||||
this.scene.gameData.loadSession(this.scene, this.scene.sessionSlotId).then(() => {
|
this.scene.gameData.loadSession(this.scene, this.scene.sessionSlotId).then(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user