mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-01 05:52:17 +02:00
Reworked EnemyPokemonConfig to include a HeldItemProperty object (to feed to the heldItemManager). Updated Dark Deal ME
This commit is contained in:
parent
d7882d4ca7
commit
c198297abd
@ -30,7 +30,6 @@ import {
|
||||
HealingBoosterModifier,
|
||||
MultipleParticipantExpBonusModifier,
|
||||
PersistentModifier,
|
||||
PokemonHeldItemModifier,
|
||||
PokemonHpRestoreModifier,
|
||||
RememberMoveModifier,
|
||||
} from "./modifier/modifier";
|
||||
@ -150,7 +149,6 @@ import {
|
||||
import { MysteryEncounterSaveData } from "#app/data/mystery-encounters/mystery-encounter-save-data";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import type HeldModifierConfig from "#app/@types/held-modifier-config";
|
||||
import { MysteryEncounterMode } from "#enums/mystery-encounter-mode";
|
||||
import { ExpGainsSpeed } from "#enums/exp-gains-speed";
|
||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||
@ -167,6 +165,7 @@ import { allHeldItems, applyHeldItems } from "./items/all-held-items";
|
||||
import { ITEM_EFFECT } from "./items/held-item";
|
||||
import { PhaseManager } from "./phase-manager";
|
||||
import { HeldItemId } from "#enums/held-item-id";
|
||||
import type { HeldItemPropertyMap } from "./field/pokemon-held-item-manager";
|
||||
|
||||
const DEBUG_RNG = false;
|
||||
|
||||
@ -2088,9 +2087,7 @@ export default class BattleScene extends SceneBase {
|
||||
enemy.getSpeciesForm().getBaseExp() *
|
||||
(enemy.level / this.getMaxExpLevel()) *
|
||||
((enemy.ivs.reduce((iv: number, total: number) => (total += iv), 0) / 93) * 0.2 + 0.8);
|
||||
this.findModifiers(m => m instanceof PokemonHeldItemModifier && m.pokemonId === enemy.id, false).map(
|
||||
m => (scoreIncrease *= (m as PokemonHeldItemModifier).getScoreMultiplier()),
|
||||
);
|
||||
enemy.getHeldItems().map(m => (scoreIncrease *= allHeldItems[m].getScoreMultiplier()));
|
||||
if (enemy.isBoss()) {
|
||||
scoreIncrease *= Math.sqrt(enemy.bossSegments);
|
||||
}
|
||||
@ -2806,7 +2803,7 @@ export default class BattleScene extends SceneBase {
|
||||
return countTaken > 0;
|
||||
}
|
||||
|
||||
generateEnemyModifiers(heldModifiersConfigs?: HeldModifierConfig[][]): Promise<void> {
|
||||
generateEnemyModifiers(heldItemConfigs?: HeldItemPropertyMap[]): Promise<void> {
|
||||
return new Promise(resolve => {
|
||||
if (this.currentBattle.battleSpec === BattleSpec.FINAL_BOSS) {
|
||||
return resolve();
|
||||
@ -2828,19 +2825,8 @@ export default class BattleScene extends SceneBase {
|
||||
}
|
||||
|
||||
party.forEach((enemyPokemon: EnemyPokemon, i: number) => {
|
||||
if (heldModifiersConfigs && i < heldModifiersConfigs.length && heldModifiersConfigs[i]) {
|
||||
for (const mt of heldModifiersConfigs[i]) {
|
||||
let modifier: PokemonHeldItemModifier;
|
||||
if (mt.modifier instanceof PokemonHeldItemModifierType) {
|
||||
modifier = mt.modifier.newModifier(enemyPokemon);
|
||||
} else {
|
||||
modifier = mt.modifier as PokemonHeldItemModifier;
|
||||
modifier.pokemonId = enemyPokemon.id;
|
||||
}
|
||||
modifier.stackCount = mt.stackCount ?? 1;
|
||||
modifier.isTransferable = mt.isTransferable ?? modifier.isTransferable;
|
||||
this.addEnemyModifier(modifier, true);
|
||||
}
|
||||
if (heldItemConfigs && i < heldItemConfigs.length && heldItemConfigs[i]) {
|
||||
enemyPokemon.heldItemManager.overrideItems(heldItemConfigs[i]);
|
||||
} else {
|
||||
const isBoss =
|
||||
enemyPokemon.isBoss() ||
|
||||
|
@ -16,10 +16,9 @@ import {
|
||||
} from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import type { PokemonHeldItemModifier } from "#app/modifier/modifier";
|
||||
import { PokemonFormChangeItemModifier } from "#app/modifier/modifier";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||
import { Challenges } from "#enums/challenges";
|
||||
import type { HeldItemPropertyMap } from "#app/field/pokemon-held-item-manager";
|
||||
|
||||
/** i18n namespace for encounter */
|
||||
const namespace = "mysteryEncounters/darkDeal";
|
||||
@ -149,7 +148,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder.withE
|
||||
const removedPokemon = getRandomPlayerPokemon(true, false, true);
|
||||
|
||||
// Get all the pokemon's held items
|
||||
const modifiers = removedPokemon.getHeldItems().filter(m => !(m instanceof PokemonFormChangeItemModifier));
|
||||
const itemConfig = removedPokemon.heldItemManager.heldItems;
|
||||
globalScene.removePokemonFromPlayerParty(removedPokemon);
|
||||
|
||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||
@ -158,7 +157,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder.withE
|
||||
// Store removed pokemon types
|
||||
encounter.misc = {
|
||||
removedTypes: removedPokemon.getTypes(),
|
||||
modifiers,
|
||||
itemConfig: itemConfig,
|
||||
};
|
||||
})
|
||||
.withOptionPhase(async () => {
|
||||
@ -176,7 +175,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder.withE
|
||||
bossTypes = singleTypeChallenges.map(c => (c.value - 1) as PokemonType);
|
||||
}
|
||||
|
||||
const bossModifiers: PokemonHeldItemModifier[] = encounter.misc.modifiers;
|
||||
const bossItemConfig: HeldItemPropertyMap = encounter.misc.itemConfig;
|
||||
// Starter egg tier, 35/50/10/5 %odds for tiers 6/7/8/9+
|
||||
const roll = randSeedInt(100);
|
||||
const starterTier: number | [number, number] = roll >= 65 ? 6 : roll >= 15 ? 7 : roll >= 5 ? 8 : [9, 10];
|
||||
@ -184,12 +183,7 @@ export const DarkDealEncounter: MysteryEncounter = MysteryEncounterBuilder.withE
|
||||
const pokemonConfig: EnemyPokemonConfig = {
|
||||
species: bossSpecies,
|
||||
isBoss: true,
|
||||
modifierConfigs: bossModifiers.map(m => {
|
||||
return {
|
||||
modifier: m,
|
||||
stackCount: m.getStackCount(),
|
||||
};
|
||||
}),
|
||||
heldItemConfig: bossItemConfig,
|
||||
};
|
||||
if (!isNullOrUndefined(bossSpecies.forms) && bossSpecies.forms.length > 0) {
|
||||
pokemonConfig.formIndex = 0;
|
||||
|
@ -48,7 +48,6 @@ import type PokemonSpecies from "#app/data/pokemon-species";
|
||||
import type { IEggOptions } from "#app/data/egg";
|
||||
import { Egg } from "#app/data/egg";
|
||||
import type { CustomPokemonData } from "#app/data/custom-pokemon-data";
|
||||
import type HeldModifierConfig from "#app/@types/held-modifier-config";
|
||||
import type { Variant } from "#app/sprites/variant";
|
||||
import { StatusEffect } from "#enums/status-effect";
|
||||
import { globalScene } from "#app/global-scene";
|
||||
@ -57,6 +56,7 @@ import { PokemonType } from "#enums/pokemon-type";
|
||||
import { getNatureName } from "#app/data/nature";
|
||||
import { getPokemonNameWithAffix } from "#app/messages";
|
||||
import { timedEventManager } from "#app/global-event-manager";
|
||||
import type { HeldItemPropertyMap } from "#app/field/pokemon-held-item-manager";
|
||||
|
||||
/**
|
||||
* Animates exclamation sprite over trainer's head at start of encounter
|
||||
@ -106,7 +106,7 @@ export interface EnemyPokemonConfig {
|
||||
/** Can set just the status, or pass a timer on the status turns */
|
||||
status?: StatusEffect | [StatusEffect, number];
|
||||
mysteryEncounterBattleEffects?: (pokemon: Pokemon) => void;
|
||||
modifierConfigs?: HeldModifierConfig[];
|
||||
heldItemConfig?: HeldItemPropertyMap;
|
||||
tags?: BattlerTagType[];
|
||||
dataSource?: PokemonData;
|
||||
tera?: PokemonType;
|
||||
@ -438,8 +438,8 @@ export async function initBattleWithEnemyConfig(partyConfig: EnemyPartyConfig):
|
||||
battle.battleType === BattleType.TRAINER ? ModifierPoolType.TRAINER : ModifierPoolType.WILD,
|
||||
);
|
||||
const customModifierTypes = partyConfig?.pokemonConfigs
|
||||
?.filter(config => config?.modifierConfigs)
|
||||
.map(config => config.modifierConfigs!);
|
||||
?.filter(config => config?.heldItemConfig)
|
||||
.map(config => config.heldItemConfig!);
|
||||
globalScene.generateEnemyModifiers(customModifierTypes);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user