mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-14 11:29:28 +02:00
Fixed some MEs
This commit is contained in:
parent
0e5499bf25
commit
694e82f280
@ -7,10 +7,7 @@ import {
|
|||||||
setEncounterExp,
|
setEncounterExp,
|
||||||
setEncounterRewards,
|
setEncounterRewards,
|
||||||
transitionMysteryEncounterIntroVisuals,
|
transitionMysteryEncounterIntroVisuals,
|
||||||
generateModifierType,
|
|
||||||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import type { AttackTypeBoosterModifierType } from "#app/modifier/modifier-type";
|
|
||||||
import { modifierTypes } from "#app/data/data-lists";
|
|
||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
import type MysteryEncounter from "#app/data/mystery-encounters/mystery-encounter";
|
||||||
@ -36,7 +33,6 @@ import { queueEncounterMessage } from "#app/data/mystery-encounters/utils/encoun
|
|||||||
import {
|
import {
|
||||||
applyAbilityOverrideToPokemon,
|
applyAbilityOverrideToPokemon,
|
||||||
applyDamageToPokemon,
|
applyDamageToPokemon,
|
||||||
applyModifierTypeToPlayerPokemon,
|
|
||||||
} from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
} from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||||
@ -46,6 +42,9 @@ import { AbilityId } from "#enums/ability-id";
|
|||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { Stat } from "#enums/stat";
|
import { Stat } from "#enums/stat";
|
||||||
import { FIRE_RESISTANT_ABILITIES } from "#app/data/mystery-encounters/requirements/requirement-groups";
|
import { FIRE_RESISTANT_ABILITIES } from "#app/data/mystery-encounters/requirements/requirement-groups";
|
||||||
|
import { HeldItemCategoryId, HeldItemId } from "#enums/held-item-id";
|
||||||
|
import { getNewHeldItemFromCategory } from "#app/items/held-item-pool";
|
||||||
|
import { allHeldItems } from "#app/items/all-held-items";
|
||||||
import { allAbilities } from "#app/data/data-lists";
|
import { allAbilities } from "#app/data/data-lists";
|
||||||
|
|
||||||
/** the i18n namespace for the encounter */
|
/** the i18n namespace for the encounter */
|
||||||
@ -302,16 +301,14 @@ function giveLeadPokemonAttackTypeBoostItem() {
|
|||||||
const leadPokemon = globalScene.getPlayerParty()?.[0];
|
const leadPokemon = globalScene.getPlayerParty()?.[0];
|
||||||
if (leadPokemon) {
|
if (leadPokemon) {
|
||||||
// Generate type booster held item, default to Charcoal if item fails to generate
|
// Generate type booster held item, default to Charcoal if item fails to generate
|
||||||
let boosterModifierType = generateModifierType(modifierTypes.ATTACK_TYPE_BOOSTER) as AttackTypeBoosterModifierType;
|
let item = getNewHeldItemFromCategory(HeldItemCategoryId.TYPE_ATTACK_BOOSTER, leadPokemon);
|
||||||
if (!boosterModifierType) {
|
if (!item) {
|
||||||
boosterModifierType = generateModifierType(modifierTypes.ATTACK_TYPE_BOOSTER, [
|
item = HeldItemId.CHARCOAL;
|
||||||
PokemonType.FIRE,
|
|
||||||
]) as AttackTypeBoosterModifierType;
|
|
||||||
}
|
}
|
||||||
applyModifierTypeToPlayerPokemon(leadPokemon, boosterModifierType);
|
leadPokemon.heldItemManager.add(item);
|
||||||
|
|
||||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||||
encounter.setDialogueToken("itemName", boosterModifierType.name);
|
encounter.setDialogueToken("itemName", allHeldItems[item].name);
|
||||||
encounter.setDialogueToken("leadPokemon", leadPokemon.getNameToRender());
|
encounter.setDialogueToken("leadPokemon", leadPokemon.getNameToRender());
|
||||||
queueEncounterMessage(`${namespace}:found_item`);
|
queueEncounterMessage(`${namespace}:found_item`);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ import { PokemonType } from "#enums/pokemon-type";
|
|||||||
import { getNatureName } from "#app/data/nature";
|
import { getNatureName } from "#app/data/nature";
|
||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { timedEventManager } from "#app/global-event-manager";
|
import { timedEventManager } from "#app/global-event-manager";
|
||||||
import type { HeldItemPropertyMap } from "#app/field/pokemon-held-item-manager";
|
import type { HeldItemConfiguration } from "#app/items/held-item-data-types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Animates exclamation sprite over trainer's head at start of encounter
|
* Animates exclamation sprite over trainer's head at start of encounter
|
||||||
@ -103,7 +103,7 @@ export interface EnemyPokemonConfig {
|
|||||||
/** Can set just the status, or pass a timer on the status turns */
|
/** Can set just the status, or pass a timer on the status turns */
|
||||||
status?: StatusEffect | [StatusEffect, number];
|
status?: StatusEffect | [StatusEffect, number];
|
||||||
mysteryEncounterBattleEffects?: (pokemon: Pokemon) => void;
|
mysteryEncounterBattleEffects?: (pokemon: Pokemon) => void;
|
||||||
heldItemConfig?: HeldItemPropertyMap;
|
heldItemConfig?: HeldItemConfiguration;
|
||||||
tags?: BattlerTagType[];
|
tags?: BattlerTagType[];
|
||||||
dataSource?: PokemonData;
|
dataSource?: PokemonData;
|
||||||
tera?: PokemonType;
|
tera?: PokemonType;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
|
import { isNullOrUndefined, randSeedInt } from "#app/utils/common";
|
||||||
import { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
|
||||||
import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
|
import type { EnemyPokemon, PlayerPokemon } from "#app/field/pokemon";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import {
|
import {
|
||||||
@ -387,42 +386,6 @@ export async function modifyPlayerPokemonBST(pokemon: PlayerPokemon, value: numb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Will attempt to add a new modifier to a Pokemon.
|
|
||||||
* If the Pokemon already has max stacks of that item, it will instead apply 'fallbackModifierType', if specified.
|
|
||||||
* @param scene
|
|
||||||
* @param pokemon
|
|
||||||
* @param modType
|
|
||||||
* @param fallbackModifierType
|
|
||||||
*/
|
|
||||||
export async function applyModifierTypeToPlayerPokemon(
|
|
||||||
pokemon: PlayerPokemon,
|
|
||||||
modType: PokemonHeldItemModifierType,
|
|
||||||
fallbackModifierType?: PokemonHeldItemModifierType,
|
|
||||||
) {
|
|
||||||
// Check if the Pokemon has max stacks of that item already
|
|
||||||
const modifier = modType.newModifier(pokemon);
|
|
||||||
const existing = globalScene.findModifier(
|
|
||||||
m =>
|
|
||||||
m instanceof PokemonHeldItemModifier &&
|
|
||||||
m.type.id === modType.id &&
|
|
||||||
m.pokemonId === pokemon.id &&
|
|
||||||
m.matchType(modifier),
|
|
||||||
) as PokemonHeldItemModifier;
|
|
||||||
|
|
||||||
// At max stacks
|
|
||||||
if (existing && existing.getStackCount() >= existing.getMaxStackCount()) {
|
|
||||||
if (!fallbackModifierType) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply fallback
|
|
||||||
return applyModifierTypeToPlayerPokemon(pokemon, fallbackModifierType);
|
|
||||||
}
|
|
||||||
|
|
||||||
globalScene.addModifier(modifier, false, false, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function applyHeldItemWithFallback(pokemon: Pokemon, item: HeldItemId, fallbackItem?: HeldItemId) {
|
export function applyHeldItemWithFallback(pokemon: Pokemon, item: HeldItemId, fallbackItem?: HeldItemId) {
|
||||||
const added = pokemon.heldItemManager.add(item);
|
const added = pokemon.heldItemManager.add(item);
|
||||||
if (!added && fallbackItem) {
|
if (!added && fallbackItem) {
|
||||||
@ -694,20 +657,10 @@ export async function catchPokemon(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const addToParty = (slotIndex?: number) => {
|
const addToParty = (slotIndex?: number) => {
|
||||||
const newPokemon = pokemon.addToParty(pokeballType, slotIndex);
|
pokemon.addToParty(pokeballType, slotIndex);
|
||||||
const modifiers = globalScene.findModifiers(m => m instanceof PokemonHeldItemModifier, false);
|
|
||||||
if (globalScene.getPlayerParty().filter(p => p.isShiny()).length === 6) {
|
if (globalScene.getPlayerParty().filter(p => p.isShiny()).length === 6) {
|
||||||
globalScene.validateAchv(achvs.SHINY_PARTY);
|
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();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
|
Promise.all([pokemon.hideInfo(), globalScene.gameData.setPokemonCaught(pokemon)]).then(() => {
|
||||||
if (globalScene.getPlayerParty().length === 6) {
|
if (globalScene.getPlayerParty().length === 6) {
|
||||||
|
Loading…
Reference in New Issue
Block a user