Event stuff

This commit is contained in:
AJ Fontaine 2024-12-18 23:30:56 -05:00
parent 449525255b
commit 8b34370639
3 changed files with 70 additions and 4 deletions

View File

@ -13,6 +13,7 @@ import { modifierTypes, PokemonHeldItemModifierType } from "#app/modifier/modifi
import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase"; import { ModifierRewardPhase } from "#app/phases/modifier-reward-phase";
import i18next from "#app/plugins/i18n"; import i18next from "#app/plugins/i18n";
import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler"; import { OptionSelectItem } from "#app/ui/abstact-option-select-ui-handler";
import { randSeedItem } from "#app/utils";
import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode"; import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode";
import { MysteryEncounterTier } from "#enums/mystery-encounter-tier"; import { MysteryEncounterTier } from "#enums/mystery-encounter-tier";
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
@ -35,6 +36,27 @@ const OPTION_3_DISALLOWED_MODIFIERS = [
const DELIBIRDY_MONEY_PRICE_MULTIPLIER = 2; 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. * Delibird-y encounter.
* @see {@link https://github.com/pagefaultgames/pokerogue/issues/3804 | GitHub Issue #3804} * @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 = export const DelibirdyEncounter: MysteryEncounter =
MysteryEncounterBuilder.withEncounterType(MysteryEncounterType.DELIBIRDY) MysteryEncounterBuilder.withEncounterType(MysteryEncounterType.DELIBIRDY)
.withEncounterTier(MysteryEncounterTier.GREAT) .withEncounterTier(MysteryEncounterTier.COMMON) //Change back after event!
.withSceneWaveRangeRequirement(...CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES) .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 .withSceneRequirement(new MoneyRequirement(0, DELIBIRDY_MONEY_PRICE_MULTIPLIER)) // Must have enough money for it to spawn at the very least
.withPrimaryPokemonRequirement( .withPrimaryPokemonRequirement(
@ -136,8 +158,10 @@ export const DelibirdyEncounter: MysteryEncounter =
await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell); await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell);
scene.playSound("item_fanfare"); scene.playSound("item_fanfare");
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true); await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
doEventReward(scene);
} else { } else {
scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.AMULET_COIN)); scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.AMULET_COIN));
doEventReward(scene);
} }
leaveEncounterWithoutBattle(scene, true); leaveEncounterWithoutBattle(scene, true);
@ -211,8 +235,10 @@ export const DelibirdyEncounter: MysteryEncounter =
await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell); await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell);
scene.playSound("item_fanfare"); scene.playSound("item_fanfare");
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true); await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
doEventReward(scene);
} else { } else {
scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.CANDY_JAR)); scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.CANDY_JAR));
doEventReward(scene);
} }
} else { } else {
// Check if the player has max stacks of that Berry Pouch already // 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); await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerPokemon()!, shellBell);
scene.playSound("item_fanfare"); scene.playSound("item_fanfare");
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true); await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
doEventReward(scene);
} else { } else {
scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.BERRY_POUCH)); 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); await applyModifierTypeToPlayerPokemon(scene, scene.getPlayerParty()[0], shellBell);
scene.playSound("item_fanfare"); scene.playSound("item_fanfare");
await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true); await showEncounterText(scene, i18next.t("battle:rewardGain", { modifierName: shellBell.name }), null, undefined, true);
doEventReward(scene);
} else { } else {
scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.HEALING_CHARM)); scene.unshiftPhase(new ModifierRewardPhase(scene, modifierTypes.HEALING_CHARM));
doEventReward(scene);
} }
chosenPokemon.loseHeldItem(modifier, false); chosenPokemon.loseHeldItem(modifier, false);

View File

@ -12,7 +12,7 @@ import { MysteryEncounterOptionMode } from "#enums/mystery-encounter-option-mode
import { TrainerSlot } from "#app/data/trainer-config"; import { TrainerSlot } from "#app/data/trainer-config";
import { catchPokemon, getHighestLevelPlayerPokemon, getSpriteKeysFromPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils"; import { catchPokemon, getHighestLevelPlayerPokemon, getSpriteKeysFromPokemon } from "#app/data/mystery-encounters/utils/encounter-pokemon-utils";
import PokemonData from "#app/system/pokemon-data"; 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 { Moves } from "#enums/moves";
import { BattlerIndex } from "#app/battle"; import { BattlerIndex } from "#app/battle";
import { SelfStatusMove } from "#app/data/move"; 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 { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import { Stat } from "#enums/stat"; import { Stat } from "#enums/stat";
import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode"; import { CLASSIC_MODE_MYSTERY_ENCOUNTER_WAVES } from "#app/game-mode";
import PokemonSpecies from "#app/data/pokemon-species";
/** the i18n namespace for the encounter */ /** the i18n namespace for the encounter */
const namespace = "mysteryEncounters/uncommonBreed"; const namespace = "mysteryEncounters/uncommonBreed";
@ -51,7 +52,14 @@ export const UncommonBreedEncounter: MysteryEncounter =
// Calculate boss mon // Calculate boss mon
// Level equal to 2 below highest party member // Level equal to 2 below highest party member
const level = getHighestLevelPlayerPokemon(scene, false, true).level - 2; 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); const pokemon = new EnemyPokemon(scene, species, level, TrainerSlot.NONE, true);
// Pokemon will always have one of its egg moves in its moveset // Pokemon will always have one of its egg moves in its moveset

View File

@ -2,6 +2,7 @@ import BattleScene from "#app/battle-scene";
import { TextStyle, addTextObject } from "#app/ui/text"; import { TextStyle, addTextObject } from "#app/ui/text";
import { nil } from "#app/utils"; import { nil } from "#app/utils";
import i18next from "i18next"; import i18next from "i18next";
import { Species } from "./enums/species";
export enum EventType { export enum EventType {
SHINY, SHINY,
@ -16,6 +17,11 @@ interface EventBanner {
availableLangs?: string[]; availableLangs?: string[];
} }
interface EventEncounter {
species: Species;
allowEvolution?: boolean;
}
interface TimedEvent extends EventBanner { interface TimedEvent extends EventBanner {
name: string; name: string;
eventType: EventType; eventType: EventType;
@ -23,6 +29,8 @@ interface TimedEvent extends EventBanner {
friendshipMultiplier?: number; friendshipMultiplier?: number;
startDate: Date; startDate: Date;
endDate: Date; endDate: Date;
uncommonBreedEncounters?: EventEncounter[];
delibirdyBuff?: string[];
} }
const timedEvents: TimedEvent[] = [ const timedEvents: TimedEvent[] = [
@ -35,7 +43,27 @@ const timedEvents: TimedEvent[] = [
endDate: new Date(Date.UTC(2025, 0, 4, 0)), endDate: new Date(Date.UTC(2025, 0, 4, 0)),
bannerKey: "halloween2024-event-", bannerKey: "halloween2024-event-",
scale: 0.21, 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" ]
} }
]; ];