Fixing some phases

This commit is contained in:
Wlowscha 2025-06-19 20:15:50 +02:00
parent f1c6cf4419
commit 1e9239720d
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04
5 changed files with 14 additions and 26 deletions

View File

@ -23,10 +23,9 @@ export class AddEnemyBuffModifierPhase extends Phase {
globalScene.findModifiers(m => m instanceof EnemyPersistentModifier, false),
),
true,
true,
);
}
globalScene.updateModifiers(false, true);
globalScene.updateModifiers(false);
this.end();
}
}

View File

@ -12,7 +12,6 @@ import { getStatusEffectCatchRateMultiplier } from "#app/data/status-effect";
import { addPokeballCaptureStars, addPokeballOpenParticles } from "#app/field/anims";
import type { EnemyPokemon } from "#app/field/pokemon";
import { getPokemonNameWithAffix } from "#app/messages";
import { PokemonHeldItemModifier } from "#app/modifier/modifier";
import { PokemonPhase } from "#app/phases/pokemon-phase";
import { achvs } from "#app/system/achv";
import type { PartyOption } from "#app/ui/party-ui-handler";
@ -255,6 +254,7 @@ export class AttemptCapturePhase extends PokemonPhase {
}),
null,
() => {
const heldItemConfig = pokemon.heldItemManager.generateHeldItemConfiguration();
const end = () => {
globalScene.phaseManager.unshiftNew("VictoryPhase", this.battlerIndex);
globalScene.pokemonInfoContainer.hide();
@ -269,19 +269,16 @@ export class AttemptCapturePhase extends PokemonPhase {
};
const addToParty = (slotIndex?: number) => {
const newPokemon = pokemon.addToParty(this.pokeballType, slotIndex);
const modifiers = globalScene.findModifiers(m => m instanceof PokemonHeldItemModifier, false);
if (globalScene.getPlayerParty().filter(p => p.isShiny()).length === PLAYER_PARTY_MAX_SIZE) {
globalScene.validateAchv(achvs.SHINY_PARTY);
}
Promise.all(modifiers.map(m => globalScene.addModifier(m, true))).then(() => {
globalScene.updateModifiers(true);
removePokemon();
if (newPokemon) {
newPokemon.loadAssets().then(end);
} else {
end();
}
});
globalScene.updateModifiers(true);
removePokemon();
if (newPokemon) {
newPokemon.loadAssets().then(end);
} else {
end();
}
};
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
if (globalScene.getPlayerParty().length === PLAYER_PARTY_MAX_SIZE) {
@ -306,6 +303,7 @@ export class AttemptCapturePhase extends PokemonPhase {
pokemon.variant,
pokemon.ivs,
pokemon.nature,
heldItemConfig,
pokemon,
);
globalScene.ui.setMode(

View File

@ -1,6 +1,6 @@
import { globalScene } from "#app/global-scene";
import { applyPostBattleAbAttrs } from "#app/data/abilities/apply-ab-attrs";
import { LapsingPersistentModifier, LapsingPokemonHeldItemModifier } from "#app/modifier/modifier";
import { LapsingPersistentModifier } from "#app/modifier/modifier";
import { BattlePhase } from "./battle-phase";
export class BattleEndPhase extends BattlePhase {
@ -81,13 +81,10 @@ export class BattleEndPhase extends BattlePhase {
}
const lapsingModifiers = globalScene.findModifiers(
m => m instanceof LapsingPersistentModifier || m instanceof LapsingPokemonHeldItemModifier,
) as (LapsingPersistentModifier | LapsingPokemonHeldItemModifier)[];
m => m instanceof LapsingPersistentModifier,
) as LapsingPersistentModifier[];
for (const m of lapsingModifiers) {
const args: any[] = [];
if (m instanceof LapsingPokemonHeldItemModifier) {
args.push(globalScene.getPokemonById(m.pokemonId));
}
if (!m.lapse(...args)) {
globalScene.removeModifier(m);
}

View File

@ -15,8 +15,6 @@ import type Pokemon from "#app/field/pokemon";
import { FieldPosition } from "#enums/field-position";
import { getPokemonNameWithAffix } from "#app/messages";
import { BoostBugSpawnModifier, IvScannerModifier } from "#app/modifier/modifier";
import { regenerateModifierPoolThresholds } from "#app/modifier/modifier-type";
import { ModifierPoolType } from "#enums/modifier-pool-type";
import Overrides from "#app/overrides";
import { BattlePhase } from "#app/phases/battle-phase";
import { achvs } from "#app/system/achv";
@ -271,10 +269,6 @@ export class EncounterPhase extends BattlePhase {
if (!this.loaded && battle.battleType !== BattleType.MYSTERY_ENCOUNTER) {
// generate modifiers for MEs, overriding prior ones as applicable
regenerateModifierPoolThresholds(
globalScene.getEnemyField(),
battle.battleType === BattleType.TRAINER ? ModifierPoolType.TRAINER : ModifierPoolType.WILD,
);
globalScene.generateEnemyModifiers();
overrideModifiers(false);

View File

@ -418,7 +418,7 @@ export class MoveEffectPhase extends PokemonPhase {
globalScene.phaseManager.queueMessage(i18next.t("battle:attackHitsCount", { count: hitsTotal }));
}
globalScene.applyModifiers(HitHealModifier, this.player, user);
applyHeldItems(ITEM_EFFECT.HIT_HEAL, { pokemon: user });
this.getTargets().forEach(target => {
target.turnData.moveEffectiveness = null;
});