mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-06-21 17:12:44 +02:00
Fixed shady vitamin ME and some HeldItem files
This commit is contained in:
parent
0e0c5e9fe3
commit
d161aad372
@ -1,5 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
generateModifierType,
|
|
||||||
leaveEncounterWithoutBattle,
|
leaveEncounterWithoutBattle,
|
||||||
selectPokemonForOption,
|
selectPokemonForOption,
|
||||||
setEncounterExp,
|
setEncounterExp,
|
||||||
@ -7,7 +6,6 @@ import {
|
|||||||
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
} from "#app/data/mystery-encounters/utils/encounter-phase-utils";
|
||||||
import type { PlayerPokemon } from "#app/field/pokemon";
|
import type { PlayerPokemon } from "#app/field/pokemon";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { modifierTypes } from "#app/data/data-lists";
|
|
||||||
import { randSeedInt } from "#app/utils/common";
|
import { randSeedInt } from "#app/utils/common";
|
||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
@ -19,7 +17,6 @@ import { MoneyRequirement } from "#app/data/mystery-encounters/mystery-encounter
|
|||||||
import { getEncounterText, queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
import { getEncounterText, queueEncounterMessage } from "#app/data/mystery-encounters/utils/encounter-dialogue-utils";
|
||||||
import {
|
import {
|
||||||
applyDamageToPokemon,
|
applyDamageToPokemon,
|
||||||
applyModifierTypeToPlayerPokemon,
|
|
||||||
isPokemonValidForEncounterOptionSelection,
|
isPokemonValidForEncounterOptionSelection,
|
||||||
} 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";
|
||||||
@ -28,6 +25,8 @@ import type { Nature } from "#enums/nature";
|
|||||||
import { getNatureName } from "#app/data/nature";
|
import { getNatureName } from "#app/data/nature";
|
||||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/constants";
|
||||||
import i18next from "i18next";
|
import i18next from "i18next";
|
||||||
|
import { getNewVitaminHeldItem } from "#app/items/held-item-pool";
|
||||||
|
import { allHeldItems } from "#app/items/all-held-items";
|
||||||
|
|
||||||
/** the i18n namespace for this encounter */
|
/** the i18n namespace for this encounter */
|
||||||
const namespace = "mysteryEncounters/shadyVitaminDealer";
|
const namespace = "mysteryEncounters/shadyVitaminDealer";
|
||||||
@ -97,15 +96,12 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
|
|||||||
// Update money
|
// Update money
|
||||||
updatePlayerMoney(-(encounter.options[0].requirements[0] as MoneyRequirement).requiredMoney);
|
updatePlayerMoney(-(encounter.options[0].requirements[0] as MoneyRequirement).requiredMoney);
|
||||||
// Calculate modifiers and dialogue tokens
|
// Calculate modifiers and dialogue tokens
|
||||||
const modifiers = [
|
const items = [getNewVitaminHeldItem(), getNewVitaminHeldItem()];
|
||||||
generateModifierType(modifierTypes.BASE_STAT_BOOSTER)!,
|
encounter.setDialogueToken("boost1", allHeldItems[items[0]].name);
|
||||||
generateModifierType(modifierTypes.BASE_STAT_BOOSTER)!,
|
encounter.setDialogueToken("boost2", allHeldItems[items[1]].name);
|
||||||
];
|
|
||||||
encounter.setDialogueToken("boost1", modifiers[0].name);
|
|
||||||
encounter.setDialogueToken("boost2", modifiers[1].name);
|
|
||||||
encounter.misc = {
|
encounter.misc = {
|
||||||
chosenPokemon: pokemon,
|
chosenPokemon: pokemon,
|
||||||
modifiers: modifiers,
|
items: items,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -132,10 +128,10 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
|
|||||||
// Choose Cheap Option
|
// Choose Cheap Option
|
||||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||||
const chosenPokemon = encounter.misc.chosenPokemon;
|
const chosenPokemon = encounter.misc.chosenPokemon;
|
||||||
const modifiers = encounter.misc.modifiers;
|
const items = encounter.misc.items;
|
||||||
|
|
||||||
for (const modType of modifiers) {
|
for (const item of items) {
|
||||||
await applyModifierTypeToPlayerPokemon(chosenPokemon, modType);
|
chosenPokemon.heldItemManager.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
leaveEncounterWithoutBattle(true);
|
leaveEncounterWithoutBattle(true);
|
||||||
@ -180,15 +176,12 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
|
|||||||
// Update money
|
// Update money
|
||||||
updatePlayerMoney(-(encounter.options[1].requirements[0] as MoneyRequirement).requiredMoney);
|
updatePlayerMoney(-(encounter.options[1].requirements[0] as MoneyRequirement).requiredMoney);
|
||||||
// Calculate modifiers and dialogue tokens
|
// Calculate modifiers and dialogue tokens
|
||||||
const modifiers = [
|
const items = [getNewVitaminHeldItem(), getNewVitaminHeldItem()];
|
||||||
generateModifierType(modifierTypes.BASE_STAT_BOOSTER)!,
|
encounter.setDialogueToken("boost1", allHeldItems[items[0]].name);
|
||||||
generateModifierType(modifierTypes.BASE_STAT_BOOSTER)!,
|
encounter.setDialogueToken("boost2", allHeldItems[items[1]].name);
|
||||||
];
|
|
||||||
encounter.setDialogueToken("boost1", modifiers[0].name);
|
|
||||||
encounter.setDialogueToken("boost2", modifiers[1].name);
|
|
||||||
encounter.misc = {
|
encounter.misc = {
|
||||||
chosenPokemon: pokemon,
|
chosenPokemon: pokemon,
|
||||||
modifiers: modifiers,
|
items: items,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -203,10 +196,10 @@ export const ShadyVitaminDealerEncounter: MysteryEncounter = MysteryEncounterBui
|
|||||||
// Choose Expensive Option
|
// Choose Expensive Option
|
||||||
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
const encounter = globalScene.currentBattle.mysteryEncounter!;
|
||||||
const chosenPokemon = encounter.misc.chosenPokemon;
|
const chosenPokemon = encounter.misc.chosenPokemon;
|
||||||
const modifiers = encounter.misc.modifiers;
|
const items = encounter.misc.items;
|
||||||
|
|
||||||
for (const modType of modifiers) {
|
for (const item of items) {
|
||||||
await applyModifierTypeToPlayerPokemon(chosenPokemon, modType);
|
chosenPokemon.heldItemManager.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
leaveEncounterWithoutBattle(true);
|
leaveEncounterWithoutBattle(true);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { applyPostItemLostAbAttrs, PostItemLostAbAttr } from "#app/data/abilities/ability";
|
import { applyPostItemLostAbAttrs } from "#app/data/abilities/apply-ab-attrs";
|
||||||
import type Pokemon from "#app/field/pokemon";
|
import type Pokemon from "#app/field/pokemon";
|
||||||
import { globalScene } from "#app/global-scene";
|
import { globalScene } from "#app/global-scene";
|
||||||
import { HeldItemNames, type HeldItemId } from "#enums/held-item-id";
|
import { HeldItemNames, type HeldItemId } from "#enums/held-item-id";
|
||||||
@ -157,7 +157,7 @@ export class ConsumableHeldItem extends HeldItem {
|
|||||||
globalScene.updateModifiers(isPlayer);
|
globalScene.updateModifiers(isPlayer);
|
||||||
}
|
}
|
||||||
if (unburden) {
|
if (unburden) {
|
||||||
applyPostItemLostAbAttrs(PostItemLostAbAttr, pokemon, false);
|
applyPostItemLostAbAttrs("PostItemLostAbAttr", pokemon, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { ConsumableHeldItem, ITEM_EFFECT } from "../held-item";
|
|||||||
import { getPokemonNameWithAffix } from "#app/messages";
|
import { getPokemonNameWithAffix } from "#app/messages";
|
||||||
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
import { PokemonHealPhase } from "#app/phases/pokemon-heal-phase";
|
||||||
import { toDmgValue } from "#app/utils/common";
|
import { toDmgValue } from "#app/utils/common";
|
||||||
import { applyAbAttrs, CommanderAbAttr } from "#app/data/abilities/ability";
|
import { applyAbAttrs } from "#app/data/abilities/apply-ab-attrs";
|
||||||
|
|
||||||
export interface INSTANT_REVIVE_PARAMS {
|
export interface INSTANT_REVIVE_PARAMS {
|
||||||
/** The pokemon with the item */
|
/** The pokemon with the item */
|
||||||
@ -61,7 +61,7 @@ export class InstantReviveHeldItem extends ConsumableHeldItem {
|
|||||||
// Reapply Commander on the Pokemon's side of the field, if applicable
|
// Reapply Commander on the Pokemon's side of the field, if applicable
|
||||||
const field = pokemon.isPlayer() ? globalScene.getPlayerField() : globalScene.getEnemyField();
|
const field = pokemon.isPlayer() ? globalScene.getPlayerField() : globalScene.getEnemyField();
|
||||||
for (const p of field) {
|
for (const p of field) {
|
||||||
applyAbAttrs(CommanderAbAttr, p, null, false);
|
applyAbAttrs("CommanderAbAttr", p, null, false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user