mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-08 09:22:17 +02:00
migrate sleeping snorlax encounter
This commit is contained in:
parent
19d96ed381
commit
2d42697321
@ -1,39 +0,0 @@
|
|||||||
import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
|
|
||||||
|
|
||||||
export const SleepingSnorlaxDialogue: MysteryEncounterDialogue = {
|
|
||||||
intro: [
|
|
||||||
{
|
|
||||||
text: "mysteryEncounter:sleeping_snorlax_intro_message"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
encounterOptionsDialogue: {
|
|
||||||
title: "mysteryEncounter:sleeping_snorlax_title",
|
|
||||||
description: "mysteryEncounter:sleeping_snorlax_description",
|
|
||||||
query: "mysteryEncounter:sleeping_snorlax_query",
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
buttonLabel: "mysteryEncounter:sleeping_snorlax_option_1_label",
|
|
||||||
buttonTooltip: "mysteryEncounter:sleeping_snorlax_option_1_tooltip",
|
|
||||||
selected: [
|
|
||||||
{
|
|
||||||
text: "mysteryEncounter:sleeping_snorlax_option_1_selected_message"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
buttonLabel: "mysteryEncounter:sleeping_snorlax_option_2_label",
|
|
||||||
buttonTooltip: "mysteryEncounter:sleeping_snorlax_option_2_tooltip",
|
|
||||||
selected: [
|
|
||||||
{
|
|
||||||
text: "mysteryEncounter:sleeping_snorlax_option_2_selected_message"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
buttonLabel: "mysteryEncounter:sleeping_snorlax_option_3_label",
|
|
||||||
buttonTooltip: "mysteryEncounter:sleeping_snorlax_option_3_tooltip",
|
|
||||||
disabledTooltip: "mysteryEncounter:sleeping_snorlax_option_3_disabled_tooltip"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
@ -1,6 +1,5 @@
|
|||||||
import {
|
import { STEALING_MOVES } from "#app/data/mystery-encounters/requirements/requirement-groups";
|
||||||
modifierTypes
|
import { modifierTypes } from "#app/modifier/modifier-type";
|
||||||
} from "#app/modifier/modifier-type";
|
|
||||||
import { BerryType } from "#enums/berry-type";
|
import { BerryType } from "#enums/berry-type";
|
||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
import { Species } from "#enums/species";
|
import { Species } from "#enums/species";
|
||||||
@ -8,106 +7,169 @@ import BattleScene from "../../../battle-scene";
|
|||||||
import * as Utils from "../../../utils";
|
import * as Utils from "../../../utils";
|
||||||
import { getPokemonSpecies } from "../../pokemon-species";
|
import { getPokemonSpecies } from "../../pokemon-species";
|
||||||
import { Status, StatusEffect } from "../../status-effect";
|
import { Status, StatusEffect } from "../../status-effect";
|
||||||
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";
|
||||||
import { MoveRequirement } from "../mystery-encounter-requirements";
|
import { MoveRequirement } from "../mystery-encounter-requirements";
|
||||||
import {
|
import {
|
||||||
EnemyPartyConfig,
|
EnemyPartyConfig,
|
||||||
EnemyPokemonConfig, generateModifierTypeOption,
|
EnemyPokemonConfig,
|
||||||
|
generateModifierTypeOption,
|
||||||
initBattleWithEnemyConfig,
|
initBattleWithEnemyConfig,
|
||||||
leaveEncounterWithoutBattle, queueEncounterMessage, setEncounterExp,
|
leaveEncounterWithoutBattle,
|
||||||
setEncounterRewards
|
queueEncounterMessage,
|
||||||
|
setEncounterExp,
|
||||||
|
setEncounterRewards,
|
||||||
} from "../mystery-encounter-utils";
|
} from "../mystery-encounter-utils";
|
||||||
import { STEALING_MOVES } from "#app/data/mystery-encounters/requirements/requirement-groups";
|
|
||||||
|
|
||||||
export const SleepingSnorlaxEncounter: MysteryEncounter = MysteryEncounterBuilder
|
/** i18n namespace for the encounter */
|
||||||
.withEncounterType(MysteryEncounterType.SLEEPING_SNORLAX)
|
const namespace = "mysteryEncounter:sleeping_snorlax";
|
||||||
.withEncounterTier(MysteryEncounterTier.ULTRA)
|
|
||||||
.withIntroSpriteConfigs([
|
|
||||||
{
|
|
||||||
spriteKey: Species.SNORLAX.toString(),
|
|
||||||
fileRoot: "pokemon",
|
|
||||||
hasShadow: true,
|
|
||||||
tint: 0.25,
|
|
||||||
scale: 1.5,
|
|
||||||
repeat: true,
|
|
||||||
y: 5
|
|
||||||
}
|
|
||||||
])
|
|
||||||
.withSceneWaveRangeRequirement(10, 180) // waves 10 to 180
|
|
||||||
.withCatchAllowed(true)
|
|
||||||
.withHideWildIntroMessage(true)
|
|
||||||
.withOnInit((scene: BattleScene) => {
|
|
||||||
const encounter = scene.currentBattle.mysteryEncounter;
|
|
||||||
console.log(encounter);
|
|
||||||
|
|
||||||
// Calculate boss mon
|
export const SleepingSnorlaxEncounter: MysteryEncounter =
|
||||||
const bossSpecies = getPokemonSpecies(Species.SNORLAX);
|
MysteryEncounterBuilder.withEncounterType(
|
||||||
const pokemonConfig: EnemyPokemonConfig = {
|
MysteryEncounterType.SLEEPING_SNORLAX
|
||||||
species: bossSpecies,
|
|
||||||
isBoss: true,
|
|
||||||
status: StatusEffect.SLEEP
|
|
||||||
};
|
|
||||||
const config: EnemyPartyConfig = {
|
|
||||||
levelAdditiveMultiplier: 2,
|
|
||||||
pokemonConfigs: [pokemonConfig]
|
|
||||||
};
|
|
||||||
encounter.enemyPartyConfigs = [config];
|
|
||||||
return true;
|
|
||||||
})
|
|
||||||
.withSimpleOption(async (scene: BattleScene) => {
|
|
||||||
// Pick battle
|
|
||||||
// TODO: do we want special rewards for this?
|
|
||||||
// setCustomEncounterRewards(scene, { guaranteedModifierTypeFuncs: [modifierTypes.LEFTOVERS], fillRemaining: true});
|
|
||||||
await initBattleWithEnemyConfig(scene, scene.currentBattle.mysteryEncounter.enemyPartyConfigs[0]);
|
|
||||||
})
|
|
||||||
.withSimpleOption(async (scene: BattleScene) => {
|
|
||||||
const instance = scene.currentBattle.mysteryEncounter;
|
|
||||||
let roll: integer;
|
|
||||||
scene.executeWithSeedOffset(() => {
|
|
||||||
roll = Utils.randSeedInt(16, 0);
|
|
||||||
}, scene.currentBattle.waveIndex);
|
|
||||||
|
|
||||||
// Half Snorlax exp to entire party
|
|
||||||
setEncounterExp(scene, scene.getParty().map(p => p.id), 98);
|
|
||||||
|
|
||||||
if (roll > 4) {
|
|
||||||
// Fall asleep and get a sitrus berry (75%)
|
|
||||||
const p = instance.primaryPokemon;
|
|
||||||
p.status = new Status(StatusEffect.SLEEP, 0, 3);
|
|
||||||
p.updateInfo(true);
|
|
||||||
// const sitrus = (modifierTypes.BERRY?.() as ModifierTypeGenerator).generateType(scene.getParty(), [BerryType.SITRUS]);
|
|
||||||
const sitrus = generateModifierTypeOption(scene, modifierTypes.BERRY, [BerryType.SITRUS]);
|
|
||||||
|
|
||||||
setEncounterRewards(scene, { guaranteedModifierTypeOptions: [sitrus], fillRemaining: false });
|
|
||||||
queueEncounterMessage(scene, "mysteryEncounter:sleeping_snorlax_option_2_bad_result");
|
|
||||||
leaveEncounterWithoutBattle(scene);
|
|
||||||
} else {
|
|
||||||
// Heal to full (25%)
|
|
||||||
for (const pokemon of scene.getParty()) {
|
|
||||||
pokemon.hp = pokemon.getMaxHp();
|
|
||||||
pokemon.resetStatus();
|
|
||||||
for (const move of pokemon.moveset) {
|
|
||||||
move.ppUsed = 0;
|
|
||||||
}
|
|
||||||
pokemon.updateInfo(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
queueEncounterMessage(scene, "mysteryEncounter:sleeping_snorlax_option_2_good_result");
|
|
||||||
leaveEncounterWithoutBattle(scene);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.withOption(new MysteryEncounterOptionBuilder()
|
|
||||||
.withPrimaryPokemonRequirement(new MoveRequirement(STEALING_MOVES))
|
|
||||||
.withOptionPhase(async (scene: BattleScene) => {
|
|
||||||
// Steal the Snorlax's Leftovers
|
|
||||||
const instance = scene.currentBattle.mysteryEncounter;
|
|
||||||
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: [modifierTypes.LEFTOVERS], fillRemaining: false });
|
|
||||||
queueEncounterMessage(scene, "mysteryEncounter:sleeping_snorlax_option_3_good_result");
|
|
||||||
// Snorlax exp to Pokemon that did the stealing
|
|
||||||
setEncounterExp(scene, [instance.primaryPokemon.id], 189);
|
|
||||||
leaveEncounterWithoutBattle(scene);
|
|
||||||
})
|
|
||||||
.build()
|
|
||||||
)
|
)
|
||||||
.build();
|
.withEncounterTier(MysteryEncounterTier.ULTRA)
|
||||||
|
.withSceneWaveRangeRequirement(10, 180) // waves 10 to 180
|
||||||
|
.withCatchAllowed(true)
|
||||||
|
.withHideWildIntroMessage(true)
|
||||||
|
.withIntroSpriteConfigs([
|
||||||
|
{
|
||||||
|
spriteKey: Species.SNORLAX.toString(),
|
||||||
|
fileRoot: "pokemon",
|
||||||
|
hasShadow: true,
|
||||||
|
tint: 0.25,
|
||||||
|
scale: 1.5,
|
||||||
|
repeat: true,
|
||||||
|
y: 5,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
.withIntroDialogue([
|
||||||
|
{
|
||||||
|
text: `${namespace}_intro_message`,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
.withOnInit((scene: BattleScene) => {
|
||||||
|
const encounter = scene.currentBattle.mysteryEncounter;
|
||||||
|
console.log(encounter);
|
||||||
|
|
||||||
|
// Calculate boss mon
|
||||||
|
const bossSpecies = getPokemonSpecies(Species.SNORLAX);
|
||||||
|
const pokemonConfig: EnemyPokemonConfig = {
|
||||||
|
species: bossSpecies,
|
||||||
|
isBoss: true,
|
||||||
|
status: StatusEffect.SLEEP,
|
||||||
|
};
|
||||||
|
const config: EnemyPartyConfig = {
|
||||||
|
levelAdditiveMultiplier: 2,
|
||||||
|
pokemonConfigs: [pokemonConfig],
|
||||||
|
};
|
||||||
|
encounter.enemyPartyConfigs = [config];
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.withTitle(`${namespace}_title`)
|
||||||
|
.withDescription(`${namespace}_description`)
|
||||||
|
.withQuery(`${namespace}_query`)
|
||||||
|
.withSimpleOption(
|
||||||
|
{
|
||||||
|
buttonLabel: `${namespace}_option_1_label`,
|
||||||
|
buttonTooltip: `${namespace}_option_1_tooltip`,
|
||||||
|
selected: [
|
||||||
|
{
|
||||||
|
text: `${namespace}_option_1_selected_message`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
async (scene: BattleScene) => {
|
||||||
|
// Pick battle
|
||||||
|
// TODO: do we want special rewards for this?
|
||||||
|
// setCustomEncounterRewards(scene, { guaranteedModifierTypeFuncs: [modifierTypes.LEFTOVERS], fillRemaining: true});
|
||||||
|
await initBattleWithEnemyConfig(
|
||||||
|
scene,
|
||||||
|
scene.currentBattle.mysteryEncounter.enemyPartyConfigs[0]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.withSimpleOption(
|
||||||
|
{
|
||||||
|
buttonLabel: `${namespace}_option_2_label`,
|
||||||
|
buttonTooltip: `${namespace}_option_2_tooltip`,
|
||||||
|
selected: [
|
||||||
|
{
|
||||||
|
text: `${namespace}_option_2_selected_message`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
async (scene: BattleScene) => {
|
||||||
|
const instance = scene.currentBattle.mysteryEncounter;
|
||||||
|
let roll: integer;
|
||||||
|
scene.executeWithSeedOffset(() => {
|
||||||
|
roll = Utils.randSeedInt(16, 0);
|
||||||
|
}, scene.currentBattle.waveIndex);
|
||||||
|
|
||||||
|
// Half Snorlax exp to entire party
|
||||||
|
setEncounterExp(
|
||||||
|
scene,
|
||||||
|
scene.getParty().map((p) => p.id),
|
||||||
|
98
|
||||||
|
);
|
||||||
|
|
||||||
|
if (roll > 4) {
|
||||||
|
// Fall asleep and get a sitrus berry (75%)
|
||||||
|
const p = instance.primaryPokemon;
|
||||||
|
p.status = new Status(StatusEffect.SLEEP, 0, 3);
|
||||||
|
p.updateInfo(true);
|
||||||
|
// const sitrus = (modifierTypes.BERRY?.() as ModifierTypeGenerator).generateType(scene.getParty(), [BerryType.SITRUS]);
|
||||||
|
const sitrus = generateModifierTypeOption(
|
||||||
|
scene,
|
||||||
|
modifierTypes.BERRY,
|
||||||
|
[BerryType.SITRUS]
|
||||||
|
);
|
||||||
|
|
||||||
|
setEncounterRewards(scene, {
|
||||||
|
guaranteedModifierTypeOptions: [sitrus],
|
||||||
|
fillRemaining: false,
|
||||||
|
});
|
||||||
|
queueEncounterMessage(scene, `${namespace}_option_2_bad_result`);
|
||||||
|
leaveEncounterWithoutBattle(scene);
|
||||||
|
} else {
|
||||||
|
// Heal to full (25%)
|
||||||
|
for (const pokemon of scene.getParty()) {
|
||||||
|
pokemon.hp = pokemon.getMaxHp();
|
||||||
|
pokemon.resetStatus();
|
||||||
|
for (const move of pokemon.moveset) {
|
||||||
|
move.ppUsed = 0;
|
||||||
|
}
|
||||||
|
pokemon.updateInfo(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
queueEncounterMessage(scene, `${namespace}_option_2_good_result`);
|
||||||
|
leaveEncounterWithoutBattle(scene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.withOption(
|
||||||
|
new MysteryEncounterOptionBuilder()
|
||||||
|
.withPrimaryPokemonRequirement(new MoveRequirement(STEALING_MOVES))
|
||||||
|
.withDialogue({
|
||||||
|
buttonLabel: `${namespace}_option_3_label`,
|
||||||
|
buttonTooltip: `${namespace}_option_3_tooltip`,
|
||||||
|
disabledTooltip: `${namespace}_option_3_disabled_tooltip`,
|
||||||
|
})
|
||||||
|
.withOptionPhase(async (scene: BattleScene) => {
|
||||||
|
// Steal the Snorlax's Leftovers
|
||||||
|
const instance = scene.currentBattle.mysteryEncounter;
|
||||||
|
setEncounterRewards(scene, {
|
||||||
|
guaranteedModifierTypeFuncs: [modifierTypes.LEFTOVERS],
|
||||||
|
fillRemaining: false,
|
||||||
|
});
|
||||||
|
queueEncounterMessage(scene, `${namespace}_option_3_good_result`);
|
||||||
|
// Snorlax exp to Pokemon that did the stealing
|
||||||
|
setEncounterExp(scene, [instance.primaryPokemon.id], 189);
|
||||||
|
leaveEncounterWithoutBattle(scene);
|
||||||
|
})
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
import { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||||
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 { TextStyle } from "#app/ui/text";
|
import { TextStyle } from "#app/ui/text";
|
||||||
|
|
||||||
export class TextDisplay {
|
export class TextDisplay {
|
||||||
@ -79,5 +78,4 @@ export const allMysteryEncounterDialogue: { [encounterType: number]: MysteryEnco
|
|||||||
|
|
||||||
export function initMysteryEncounterDialogue() {
|
export function initMysteryEncounterDialogue() {
|
||||||
allMysteryEncounterDialogue[MysteryEncounterType.TRAINING_SESSION] = TrainingSessionDialogue;
|
allMysteryEncounterDialogue[MysteryEncounterType.TRAINING_SESSION] = TrainingSessionDialogue;
|
||||||
allMysteryEncounterDialogue[MysteryEncounterType.SLEEPING_SNORLAX] = SleepingSnorlaxDialogue;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user