mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-30 10:46:05 +00:00
migrate mysterious-chest encounter
This commit is contained in:
parent
e6bf12ab8c
commit
71a047a1f6
@ -1,34 +0,0 @@
|
|||||||
import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
|
|
||||||
|
|
||||||
export const MysteriousChestDialogue: MysteryEncounterDialogue = {
|
|
||||||
intro: [
|
|
||||||
{
|
|
||||||
text: "mysteryEncounter:mysterious_chest_intro_message"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
encounterOptionsDialogue: {
|
|
||||||
title: "mysteryEncounter:mysterious_chest_title",
|
|
||||||
description: "mysteryEncounter:mysterious_chest_description",
|
|
||||||
query: "mysteryEncounter:mysterious_chest_query",
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
buttonLabel: "mysteryEncounter:mysterious_chest_option_1_label",
|
|
||||||
buttonTooltip: "mysteryEncounter:mysterious_chest_option_1_tooltip",
|
|
||||||
selected: [
|
|
||||||
{
|
|
||||||
text: "mysteryEncounter:mysterious_chest_option_1_selected_message"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
buttonLabel: "mysteryEncounter:mysterious_chest_option_2_label",
|
|
||||||
buttonTooltip: "mysteryEncounter:mysterious_chest_option_2_tooltip",
|
|
||||||
selected: [
|
|
||||||
{
|
|
||||||
text: "mysteryEncounter:mysterious_chest_option_2_selected_message"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
@ -4,19 +4,26 @@ import {
|
|||||||
leaveEncounterWithoutBattle,
|
leaveEncounterWithoutBattle,
|
||||||
queueEncounterMessage,
|
queueEncounterMessage,
|
||||||
setEncounterRewards,
|
setEncounterRewards,
|
||||||
showEncounterText
|
showEncounterText,
|
||||||
} from "#app/data/mystery-encounters/mystery-encounter-utils";
|
} from "#app/data/mystery-encounters/mystery-encounter-utils";
|
||||||
import { ModifierTier } from "#app/modifier/modifier-tier";
|
import { ModifierTier } from "#app/modifier/modifier-tier";
|
||||||
import { GameOverPhase } from "#app/phases";
|
import { GameOverPhase } from "#app/phases";
|
||||||
import { randSeedInt } from "#app/utils";
|
import { randSeedInt } from "#app/utils";
|
||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
import BattleScene from "../../../battle-scene";
|
import BattleScene from "../../../battle-scene";
|
||||||
import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter";
|
import MysteryEncounter, {
|
||||||
|
MysteryEncounterBuilder,
|
||||||
|
MysteryEncounterTier,
|
||||||
|
} from "../mystery-encounter";
|
||||||
import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
|
import { MysteryEncounterOptionBuilder } from "../mystery-encounter-option";
|
||||||
|
|
||||||
export const MysteriousChestEncounter: MysteryEncounter = MysteryEncounterBuilder
|
export const MysteriousChestEncounter: MysteryEncounter =
|
||||||
.withEncounterType(MysteryEncounterType.MYSTERIOUS_CHEST)
|
MysteryEncounterBuilder.withEncounterType(
|
||||||
|
MysteryEncounterType.MYSTERIOUS_CHEST
|
||||||
|
)
|
||||||
.withEncounterTier(MysteryEncounterTier.COMMON)
|
.withEncounterTier(MysteryEncounterTier.COMMON)
|
||||||
|
.withSceneWaveRangeRequirement(10, 180) // waves 2 to 180
|
||||||
|
.withHideIntroVisuals(false)
|
||||||
.withIntroSpriteConfigs([
|
.withIntroSpriteConfigs([
|
||||||
{
|
{
|
||||||
spriteKey: "chest_blue",
|
spriteKey: "chest_blue",
|
||||||
@ -24,15 +31,32 @@ export const MysteriousChestEncounter: MysteryEncounter = MysteryEncounterBuilde
|
|||||||
hasShadow: true,
|
hasShadow: true,
|
||||||
x: 4,
|
x: 4,
|
||||||
y: 8,
|
y: 8,
|
||||||
disableAnimation: true // Re-enabled after option select
|
disableAnimation: true, // Re-enabled after option select
|
||||||
}
|
},
|
||||||
])
|
])
|
||||||
.withHideIntroVisuals(false)
|
.withIntroDialogue([
|
||||||
.withSceneWaveRangeRequirement(10, 180) // waves 2 to 180
|
{
|
||||||
.withOption(new MysteryEncounterOptionBuilder()
|
text: "mysteryEncounter:mysterious_chest_intro_message",
|
||||||
|
},
|
||||||
|
])
|
||||||
|
.withTitle("mysteryEncounter:mysterious_chest_title")
|
||||||
|
.withDescription("mysteryEncounter:mysterious_chest_description")
|
||||||
|
.withQuery("mysteryEncounter:mysterious_chest_query")
|
||||||
|
.withOption(
|
||||||
|
new MysteryEncounterOptionBuilder()
|
||||||
|
.withDialogue({
|
||||||
|
buttonLabel: "mysteryEncounter:mysterious_chest_option_1_label",
|
||||||
|
buttonTooltip: "mysteryEncounter:mysterious_chest_option_1_tooltip",
|
||||||
|
selected: [
|
||||||
|
{
|
||||||
|
text: "mysteryEncounter:mysterious_chest_option_1_selected_message",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
.withPreOptionPhase(async (scene: BattleScene) => {
|
.withPreOptionPhase(async (scene: BattleScene) => {
|
||||||
// Play animation
|
// Play animation
|
||||||
const introVisuals = scene.currentBattle.mysteryEncounter.introVisuals;
|
const introVisuals =
|
||||||
|
scene.currentBattle.mysteryEncounter.introVisuals;
|
||||||
introVisuals.spriteConfigs[0].disableAnimation = false;
|
introVisuals.spriteConfigs[0].disableAnimation = false;
|
||||||
introVisuals.playAnim();
|
introVisuals.playAnim();
|
||||||
})
|
})
|
||||||
@ -41,39 +65,79 @@ export const MysteriousChestEncounter: MysteryEncounter = MysteryEncounterBuilde
|
|||||||
const roll = randSeedInt(100);
|
const roll = randSeedInt(100);
|
||||||
if (roll > 60) {
|
if (roll > 60) {
|
||||||
// Choose between 2 COMMON / 2 GREAT tier items (40%)
|
// Choose between 2 COMMON / 2 GREAT tier items (40%)
|
||||||
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.COMMON, ModifierTier.COMMON, ModifierTier.GREAT, ModifierTier.GREAT] });
|
setEncounterRewards(scene, {
|
||||||
|
guaranteedModifierTiers: [
|
||||||
|
ModifierTier.COMMON,
|
||||||
|
ModifierTier.COMMON,
|
||||||
|
ModifierTier.GREAT,
|
||||||
|
ModifierTier.GREAT,
|
||||||
|
],
|
||||||
|
});
|
||||||
// Display result message then proceed to rewards
|
// Display result message then proceed to rewards
|
||||||
queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_normal_result");
|
queueEncounterMessage(
|
||||||
|
scene,
|
||||||
|
"mysteryEncounter:mysterious_chest_option_1_normal_result"
|
||||||
|
);
|
||||||
leaveEncounterWithoutBattle(scene);
|
leaveEncounterWithoutBattle(scene);
|
||||||
} else if (roll > 40) {
|
} else if (roll > 40) {
|
||||||
// Choose between 3 ULTRA tier items (20%)
|
// Choose between 3 ULTRA tier items (20%)
|
||||||
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ULTRA, ModifierTier.ULTRA, ModifierTier.ULTRA] });
|
setEncounterRewards(scene, {
|
||||||
|
guaranteedModifierTiers: [
|
||||||
|
ModifierTier.ULTRA,
|
||||||
|
ModifierTier.ULTRA,
|
||||||
|
ModifierTier.ULTRA,
|
||||||
|
],
|
||||||
|
});
|
||||||
// Display result message then proceed to rewards
|
// Display result message then proceed to rewards
|
||||||
queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_good_result");
|
queueEncounterMessage(
|
||||||
|
scene,
|
||||||
|
"mysteryEncounter:mysterious_chest_option_1_good_result"
|
||||||
|
);
|
||||||
leaveEncounterWithoutBattle(scene);
|
leaveEncounterWithoutBattle(scene);
|
||||||
} else if (roll > 36) {
|
} else if (roll > 36) {
|
||||||
// Choose between 2 ROGUE tier items (4%)
|
// Choose between 2 ROGUE tier items (4%)
|
||||||
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ROGUE] });
|
setEncounterRewards(scene, {
|
||||||
|
guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ROGUE],
|
||||||
|
});
|
||||||
// Display result message then proceed to rewards
|
// Display result message then proceed to rewards
|
||||||
queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_great_result");
|
queueEncounterMessage(
|
||||||
|
scene,
|
||||||
|
"mysteryEncounter:mysterious_chest_option_1_great_result"
|
||||||
|
);
|
||||||
leaveEncounterWithoutBattle(scene);
|
leaveEncounterWithoutBattle(scene);
|
||||||
} else if (roll > 35) {
|
} else if (roll > 35) {
|
||||||
// Choose 1 MASTER tier item (1%)
|
// Choose 1 MASTER tier item (1%)
|
||||||
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.MASTER] });
|
setEncounterRewards(scene, {
|
||||||
|
guaranteedModifierTiers: [ModifierTier.MASTER],
|
||||||
|
});
|
||||||
// Display result message then proceed to rewards
|
// Display result message then proceed to rewards
|
||||||
queueEncounterMessage(scene, "mysteryEncounter:mysterious_chest_option_1_amazing_result");
|
queueEncounterMessage(
|
||||||
|
scene,
|
||||||
|
"mysteryEncounter:mysterious_chest_option_1_amazing_result"
|
||||||
|
);
|
||||||
leaveEncounterWithoutBattle(scene);
|
leaveEncounterWithoutBattle(scene);
|
||||||
} else {
|
} else {
|
||||||
// Your highest level unfainted Pok<6F>mon gets OHKO. Progress with no rewards (35%)
|
// Your highest level unfainted Pok<6F>mon gets OHKO. Progress with no rewards (35%)
|
||||||
const highestLevelPokemon = getHighestLevelPlayerPokemon(scene, true);
|
const highestLevelPokemon = getHighestLevelPlayerPokemon(
|
||||||
|
scene,
|
||||||
|
true
|
||||||
|
);
|
||||||
koPlayerPokemon(highestLevelPokemon);
|
koPlayerPokemon(highestLevelPokemon);
|
||||||
|
|
||||||
scene.currentBattle.mysteryEncounter.setDialogueToken("pokeName", highestLevelPokemon.name);
|
scene.currentBattle.mysteryEncounter.setDialogueToken(
|
||||||
|
"pokeName",
|
||||||
|
highestLevelPokemon.name
|
||||||
|
);
|
||||||
// Show which Pokemon was KOed, then leave encounter with no rewards
|
// Show which Pokemon was KOed, then leave encounter with no rewards
|
||||||
// Does this synchronously so that game over doesn't happen over result message
|
// Does this synchronously so that game over doesn't happen over result message
|
||||||
await showEncounterText(scene, "mysteryEncounter:mysterious_chest_option_1_bad_result")
|
await showEncounterText(
|
||||||
.then(() => {
|
scene,
|
||||||
if (scene.getParty().filter(p => p.isAllowedInBattle()).length === 0) {
|
"mysteryEncounter:mysterious_chest_option_1_bad_result"
|
||||||
|
).then(() => {
|
||||||
|
if (
|
||||||
|
scene.getParty().filter((p) => p.isAllowedInBattle()).length ===
|
||||||
|
0
|
||||||
|
) {
|
||||||
// All pokemon fainted, game over
|
// All pokemon fainted, game over
|
||||||
scene.clearPhaseQueue();
|
scene.clearPhaseQueue();
|
||||||
scene.unshiftPhase(new GameOverPhase(scene));
|
scene.unshiftPhase(new GameOverPhase(scene));
|
||||||
@ -85,9 +149,20 @@ export const MysteriousChestEncounter: MysteryEncounter = MysteryEncounterBuilde
|
|||||||
})
|
})
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
.withSimpleOption(async (scene: BattleScene) => {
|
.withSimpleOption(
|
||||||
|
{
|
||||||
|
buttonLabel: "mysteryEncounter:mysterious_chest_option_2_label",
|
||||||
|
buttonTooltip: "mysteryEncounter:mysterious_chest_option_2_tooltip",
|
||||||
|
selected: [
|
||||||
|
{
|
||||||
|
text: "mysteryEncounter:mysterious_chest_option_2_selected_message",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
async (scene: BattleScene) => {
|
||||||
// Leave encounter with no rewards or exp
|
// Leave encounter with no rewards or exp
|
||||||
leaveEncounterWithoutBattle(scene, true);
|
leaveEncounterWithoutBattle(scene, true);
|
||||||
return true;
|
return true;
|
||||||
})
|
}
|
||||||
|
)
|
||||||
.build();
|
.build();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
import { MysteriousChestDialogue } from "#app/data/mystery-encounters/dialogue/mysterious-chest-dialogue";
|
|
||||||
import { TrainingSessionDialogue } from "#app/data/mystery-encounters/dialogue/training-session-dialogue";
|
import { TrainingSessionDialogue } from "#app/data/mystery-encounters/dialogue/training-session-dialogue";
|
||||||
import { SleepingSnorlaxDialogue } from "./dialogue/sleeping-snorlax-dialogue";
|
import { SleepingSnorlaxDialogue } from "./dialogue/sleeping-snorlax-dialogue";
|
||||||
import { ShadyVitaminDealerDialogue } from "#app/data/mystery-encounters/dialogue/shady-vitamin-dealer";
|
import { ShadyVitaminDealerDialogue } from "#app/data/mystery-encounters/dialogue/shady-vitamin-dealer";
|
||||||
@ -80,7 +79,6 @@ export default class MysteryEncounterDialogue {
|
|||||||
export const allMysteryEncounterDialogue: { [encounterType: number]: MysteryEncounterDialogue } = {};
|
export const allMysteryEncounterDialogue: { [encounterType: number]: MysteryEncounterDialogue } = {};
|
||||||
|
|
||||||
export function initMysteryEncounterDialogue() {
|
export function initMysteryEncounterDialogue() {
|
||||||
allMysteryEncounterDialogue[MysteryEncounterType.MYSTERIOUS_CHEST] = MysteriousChestDialogue;
|
|
||||||
allMysteryEncounterDialogue[MysteryEncounterType.TRAINING_SESSION] = TrainingSessionDialogue;
|
allMysteryEncounterDialogue[MysteryEncounterType.TRAINING_SESSION] = TrainingSessionDialogue;
|
||||||
allMysteryEncounterDialogue[MysteryEncounterType.SLEEPING_SNORLAX] = SleepingSnorlaxDialogue;
|
allMysteryEncounterDialogue[MysteryEncounterType.SLEEPING_SNORLAX] = SleepingSnorlaxDialogue;
|
||||||
allMysteryEncounterDialogue[MysteryEncounterType.SHADY_VITAMIN_DEALER] = ShadyVitaminDealerDialogue;
|
allMysteryEncounterDialogue[MysteryEncounterType.SHADY_VITAMIN_DEALER] = ShadyVitaminDealerDialogue;
|
||||||
|
Loading…
Reference in New Issue
Block a user