mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-19 22:09:27 +02:00
Event stuff
This commit is contained in:
parent
449525255b
commit
8b34370639
@ -13,6 +13,7 @@ import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifi
|
||||
import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase";
|
||||
import i18next from "#app/plugins/i18n";
|
||||
import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
|
||||
import { randSeedItem } from "#app/utils";
|
||||
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
|
||||
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
|
||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
@ -35,6 +36,27 @@ const OPTION_3_DISALLOWED_MODIFIERS = [
|
||||
|
||||
const DELIBIRDY_MONEY_PRICE_MULTIPLIER = 2;
|
||||
|
||||
const doEventReward = (scene: BattleScene) => {
|
||||
const event_buff = scene.eventManager.activeEvent()?.delibirdyBuff ?? [];
|
||||
if (event_buff.length > 0) {
|
||||
const candidates = event_buff.filter((c => {
|
||||
const mtype = generateModifierType(scene, modifierTypes[c]);
|
||||
const existingCharm = scene.findModifier(m => m.type.id === mtype?.id);
|
||||
return !(existingCharm && existingCharm.getStackCount() >= existingCharm.getMaxStackCount(scene));
|
||||
}));
|
||||
if (candidates.length > 0) {
|
||||
scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes[randSeedItem(candidates)]));
|
||||
}
|
||||
// else {
|
||||
// // At max stacks, give the first party pokemon a Soothe Bell instead
|
||||
// const sootheBell = generateModifierType(scene, modifierTypes.SOOTHE_BELL) as PokemonHeldItemModifierType;
|
||||
// await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, sootheBell);
|
||||
// scene.playSound("item_fanfare");
|
||||
// await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: sootheBell.name }), null, undefined, true);
|
||||
// }
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Delibird-y encounter.
|
||||
* @see {@link https://github.com/pagefaultgames/pokerogue/issues/3804 | GitHub Issue #3804}
|
||||
@ -42,7 +64,7 @@ const DELIBIRDY_MONEY_PRICE_MULTIPLIER = 2;
|
||||
*/
|
||||
export const DelibirdyEncounter: MysteryEncounter =
|
||||
MysteryEncounterBuilder.withEncounterType(MysteryEncounterType.DELIBIRDY)
|
||||
.withEncounterTier(MysteryEncounterTier.GREAT)
|
||||
.withEncounterTier(MysteryEncounterTier.COMMON) //Change back after event!
|
||||
.withSceneWaveRangeRequirement(...CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES)
|
||||
.withSceneRequirement(new MoneyRequirement(0, DELIBIRDY_MONEY_PRICE_MULTIPLIER)) // Must have enough money for it to spawn at the very least
|
||||
.withPrimaryPokemonRequirement(
|
||||
@ -136,8 +158,10 @@ export const DelibirdyEncounter: MysteryEncounter =
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell);
|
||||
scene.playSound("item_fanfare");
|
||||
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
|
||||
doEventReward(scene);
|
||||
} else {
|
||||
scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.AMULET_COIN));
|
||||
doEventReward(scene);
|
||||
}
|
||||
|
||||
leaveEncounterWithoutBattle(scene, true);
|
||||
@ -211,8 +235,10 @@ export const DelibirdyEncounter: MysteryEncounter =
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell);
|
||||
scene.playSound("item_fanfare");
|
||||
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
|
||||
doEventReward(scene);
|
||||
} else {
|
||||
scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.CANDY_JAR));
|
||||
doEventReward(scene);
|
||||
}
|
||||
} else {
|
||||
// Check if the player has max stacks of that Berry Pouch already
|
||||
@ -224,8 +250,10 @@ export const DelibirdyEncounter: MysteryEncounter =
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell);
|
||||
scene.playSound("item_fanfare");
|
||||
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
|
||||
doEventReward(scene);
|
||||
} else {
|
||||
scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.BERRY_POUCH));
|
||||
doEventReward(scene);
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,8 +328,10 @@ export const DelibirdyEncounter: MysteryEncounter =
|
||||
await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerParty()[0], shellBell);
|
||||
scene.playSound("item_fanfare");
|
||||
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
|
||||
doEventReward(scene);
|
||||
} else {
|
||||
scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.HEALING_CHARM));
|
||||
doEventReward(scene);
|
||||
}
|
||||
|
||||
chosenPokemon.loseHeldItem(modifier, false);
|
||||
|
@ -12,7 +12,7 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
|
||||
import { TrainerSlot } from "#app/data/trainer-config";
|
||||
import { catchPokemon, getHighestLevelPlayerPokemon, getSpriteKeysFromPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
|
||||
import PokemonData from "#app/system/pokemon-data";
|
||||
import { isNullOrUndefined, randSeedInt } from "#app/utils";
|
||||
import { isNullOrUndefined, randSeedInt, randSeedItem } from "#app/utils";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { SelfStatusMove } from "#app/data/move";
|
||||
@ -23,6 +23,7 @@ import { BerryModifier } from "#app/modifier/modifier";
|
||||
import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
|
||||
import { Stat } from "#enums/stat";
|
||||
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
|
||||
import PokemonSpecies from "#app/data/pokemon-species";
|
||||
|
||||
/** the i18n namespace for the encounter */
|
||||
const namespace = "mysteryEncounters/uncommonBreed";
|
||||
@ -51,7 +52,14 @@ export const UncommonBreedEncounter: MysteryEncounter =
|
||||
// Calculate boss mon
|
||||
// Level equal to 2 below highest party member
|
||||
const level = getHighestLevelPlayerPokemon(scene, false, true).level - 2;
|
||||
const species = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getPlayerParty()), true);
|
||||
let species: PokemonSpecies;
|
||||
if (scene.eventManager.isEventActive() && scene.eventManager.activeEvent()?.uncommonBreedEncounters && randSeedInt(2) === 1) {
|
||||
const eventEncounter = randSeedItem(scene.eventManager.activeEvent()!.uncommonBreedEncounters!);
|
||||
species = eventEncounter.species;
|
||||
species.speciesId = species.getSpeciesForLevel(level, eventEncounter.allowEvolution);
|
||||
} else {
|
||||
species = scene.arena.randomSpecies(scene.currentBattle.waveIndex, level, 0, getPartyLuckValue(scene.getPlayerParty()), true);
|
||||
}
|
||||
const pokemon = new EnemyPokemon(scene, species, level, TrainerSlot.NONE, true);
|
||||
|
||||
// Pokemon will always have one of its egg moves in its moveset
|
||||
|
@ -2,6 +2,7 @@ import BattleScene from "#app/battle-scene";
|
||||
import { TextStyle, addTextObject } from "#app/ui/text";
|
||||
import { nil } from "#app/utils";
|
||||
import i18next from "i18next";
|
||||
import { Species } from "./enums/species";
|
||||
|
||||
export enum EventType {
|
||||
SHINY,
|
||||
@ -16,6 +17,11 @@ interface EventBanner {
|
||||
availableLangs?: string[];
|
||||
}
|
||||
|
||||
interface EventEncounter {
|
||||
species: Species;
|
||||
allowEvolution?: boolean;
|
||||
}
|
||||
|
||||
interface TimedEvent extends EventBanner {
|
||||
name: string;
|
||||
eventType: EventType;
|
||||
@ -23,6 +29,8 @@ interface TimedEvent extends EventBanner {
|
||||
friendshipMultiplier?: number;
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
uncommonBreedEncounters?: EventEncounter[];
|
||||
delibirdyBuff?: string[];
|
||||
}
|
||||
|
||||
const timedEvents: TimedEvent[] = [
|
||||
@ -35,7 +43,27 @@ const timedEvents: TimedEvent[] = [
|
||||
endDate: new Date(Date.UTC(2025, 0, 4, 0)),
|
||||
bannerKey: "halloween2024-event-",
|
||||
scale: 0.21,
|
||||
availableLangs: [ "en", "de", "it", "fr", "ja", "ko", "es-ES", "pt-BR", "zh-CN" ]
|
||||
availableLangs: [ "en", "de", "it", "fr", "ja", "ko", "es-ES", "pt-BR", "zh-CN" ],
|
||||
uncommonBreedEncounters: [
|
||||
{ species: Species.GIMMIGHOUL },
|
||||
{ species: Species.DELIBIRD },
|
||||
{ species: Species.STANTLER },
|
||||
{ species: Species.LITWICK, allowEvolution: true },
|
||||
{ species: Species.SNOVER, allowEvolution: true },
|
||||
{ species: Species.ROLYCOLY, allowEvolution: true },
|
||||
{ species: Species.BALTOY, allowEvolution: true },
|
||||
{ species: Species.SMOLIV, allowEvolution: true },
|
||||
{ species: Species.CHESPIN, allowEvolution: true },
|
||||
{ species: Species.PIPLUP, allowEvolution: true },
|
||||
{ species: Species.CYNDAQUIL, allowEvolution: true },
|
||||
{ species: Species.GALAR_DARUMAKA, allowEvolution: true },
|
||||
{ species: Species.MILCERY, allowEvolution: true },
|
||||
{ species: Species.ALOLA_VULPIX, allowEvolution: true },
|
||||
{ species: Species.CHINGLING, allowEvolution: true },
|
||||
{ species: Species.SWIRLIX, allowEvolution: true },
|
||||
{ species: Species.MUDBRAY, allowEvolution: true }
|
||||
],
|
||||
delibirdyBuff: [ "CATCHING_CHARM", "SHINY_CHARM", "ABILITY_CHARM", "EXP_CHARM", "SUPER_EXP_CHARM", "HEALING_CHARM" ]
|
||||
}
|
||||
];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user