migrate mysterious-challengers

This commit is contained in:
Felix Staud 2024-07-11 14:02:26 -07:00
parent 1713395091
commit e6bf12ab8c
3 changed files with 220 additions and 178 deletions

View File

@ -1,57 +0,0 @@
import MysteryEncounterDialogue from "#app/data/mystery-encounters/mystery-encounter-dialogue";
export const MysteriousChallengersDialogue: MysteryEncounterDialogue = {
intro: [
{
text: "mysteryEncounter:mysterious_challengers_intro_message"
}
],
encounterOptionsDialogue: {
title: "mysteryEncounter:mysterious_challengers_title",
description: "mysteryEncounter:mysterious_challengers_description",
query: "mysteryEncounter:mysterious_challengers_query",
options: [
{
buttonLabel: "mysteryEncounter:mysterious_challengers_option_1_label",
buttonTooltip: "mysteryEncounter:mysterious_challengers_option_1_tooltip",
selected: [
{
text: "mysteryEncounter:mysterious_challengers_option_selected_message"
}
]
},
{
buttonLabel: "mysteryEncounter:mysterious_challengers_option_2_label",
buttonTooltip: "mysteryEncounter:mysterious_challengers_option_2_tooltip",
selected: [
{
text: "mysteryEncounter:mysterious_challengers_option_selected_message"
}
]
},
{
buttonLabel: "mysteryEncounter:mysterious_challengers_option_3_label",
buttonTooltip: "mysteryEncounter:mysterious_challengers_option_3_tooltip",
selected: [
{
text: "mysteryEncounter:mysterious_challengers_option_selected_message"
}
]
},
{
buttonLabel: "mysteryEncounter:mysterious_challengers_option_4_label",
buttonTooltip: "mysteryEncounter:mysterious_challengers_option_4_tooltip",
selected: [
{
text: "mysteryEncounter:mysterious_challengers_option_4_selected_message"
}
]
}
]
},
outro: [
{
text: "mysteryEncounter:mysterious_challengers_outro_win"
}
]
};

View File

@ -1,9 +1,13 @@
import { EnemyPartyConfig, initBattleWithEnemyConfig, setEncounterRewards } from "#app/data/mystery-encounters/mystery-encounter-utils"; import {
EnemyPartyConfig,
initBattleWithEnemyConfig,
setEncounterRewards,
} from "#app/data/mystery-encounters/mystery-encounter-utils";
import { import {
trainerConfigs, trainerConfigs,
TrainerPartyCompoundTemplate, TrainerPartyCompoundTemplate,
TrainerPartyTemplate, TrainerPartyTemplate,
trainerPartyTemplates trainerPartyTemplates,
} from "#app/data/trainer-config"; } from "#app/data/trainer-config";
import { ModifierTier } from "#app/modifier/modifier-tier"; import { ModifierTier } from "#app/modifier/modifier-tier";
import { modifierTypes } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";
@ -11,43 +15,72 @@ import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { PartyMemberStrength } from "#enums/party-member-strength"; import { PartyMemberStrength } from "#enums/party-member-strength";
import BattleScene from "../../../battle-scene"; import BattleScene from "../../../battle-scene";
import * as Utils from "../../../utils"; import * as Utils from "../../../utils";
import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; import MysteryEncounter, {
MysteryEncounterBuilder,
MysteryEncounterTier,
} from "../mystery-encounter";
export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounterBuilder /** the i18n namespace for the encounter */
.withEncounterType(MysteryEncounterType.MYSTERIOUS_CHALLENGERS) const namespace = "mysteryEncounter:mysterious_challengers";
export const MysteriousChallengersEncounter: MysteryEncounter =
MysteryEncounterBuilder.withEncounterType(
MysteryEncounterType.MYSTERIOUS_CHALLENGERS
)
.withEncounterTier(MysteryEncounterTier.GREAT) .withEncounterTier(MysteryEncounterTier.GREAT)
.withIntroSpriteConfigs([]) // These are set in onInit()
.withSceneWaveRangeRequirement(10, 180) // waves 10 to 180 .withSceneWaveRangeRequirement(10, 180) // waves 10 to 180
.withIntroSpriteConfigs([]) // These are set in onInit()
.withIntroDialogue([
{
text: `${namespace}_intro_message`,
},
])
.withOnInit((scene: BattleScene) => { .withOnInit((scene: BattleScene) => {
const encounter = scene.currentBattle.mysteryEncounter; const encounter = scene.currentBattle.mysteryEncounter;
// Calculates what trainers are available for battle in the encounter // Calculates what trainers are available for battle in the encounter
// Normal difficulty trainer is randomly pulled from biome // Normal difficulty trainer is randomly pulled from biome
const normalTrainerType = scene.arena.randomTrainerType(scene.currentBattle.waveIndex); const normalTrainerType = scene.arena.randomTrainerType(
scene.currentBattle.waveIndex
);
const normalConfig = trainerConfigs[normalTrainerType].copy(); const normalConfig = trainerConfigs[normalTrainerType].copy();
let female = false; let female = false;
if (normalConfig.hasGenders) { if (normalConfig.hasGenders) {
female = !!(Utils.randSeedInt(2)); female = !!Utils.randSeedInt(2);
} }
const normalSpriteKey = normalConfig.getSpriteKey(female, normalConfig.doubleOnly); const normalSpriteKey = normalConfig.getSpriteKey(
female,
normalConfig.doubleOnly
);
encounter.enemyPartyConfigs.push({ encounter.enemyPartyConfigs.push({
trainerConfig: normalConfig, trainerConfig: normalConfig,
female: female female: female,
}); });
// Hard difficulty trainer is another random trainer, but with AVERAGE_BALANCED config // Hard difficulty trainer is another random trainer, but with AVERAGE_BALANCED config
// Number of mons is based off wave: 1-20 is 2, 20-40 is 3, etc. capping at 6 after wave 100 // Number of mons is based off wave: 1-20 is 2, 20-40 is 3, etc. capping at 6 after wave 100
const hardTrainerType = scene.arena.randomTrainerType(scene.currentBattle.waveIndex); const hardTrainerType = scene.arena.randomTrainerType(
scene.currentBattle.waveIndex
);
const hardTemplate = new TrainerPartyCompoundTemplate( const hardTemplate = new TrainerPartyCompoundTemplate(
new TrainerPartyTemplate(1, PartyMemberStrength.STRONGER, false, true), new TrainerPartyTemplate(1, PartyMemberStrength.STRONGER, false, true),
new TrainerPartyTemplate(Math.min(Math.ceil(scene.currentBattle.waveIndex / 20), 5), PartyMemberStrength.AVERAGE, false, true)); new TrainerPartyTemplate(
Math.min(Math.ceil(scene.currentBattle.waveIndex / 20), 5),
PartyMemberStrength.AVERAGE,
false,
true
)
);
const hardConfig = trainerConfigs[hardTrainerType].copy(); const hardConfig = trainerConfigs[hardTrainerType].copy();
hardConfig.setPartyTemplates(hardTemplate); hardConfig.setPartyTemplates(hardTemplate);
female = false; female = false;
if (hardConfig.hasGenders) { if (hardConfig.hasGenders) {
female = !!(Utils.randSeedInt(2)); female = !!Utils.randSeedInt(2);
} }
const hardSpriteKey = hardConfig.getSpriteKey(female, hardConfig.doubleOnly); const hardSpriteKey = hardConfig.getSpriteKey(
female,
hardConfig.doubleOnly
);
encounter.enemyPartyConfigs.push({ encounter.enemyPartyConfigs.push({
trainerConfig: hardConfig, trainerConfig: hardConfig,
levelAdditiveMultiplier: 0.5, levelAdditiveMultiplier: 0.5,
@ -56,20 +89,26 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
// Brutal trainer is pulled from pool of boss trainers (gym leaders) for the biome // Brutal trainer is pulled from pool of boss trainers (gym leaders) for the biome
// They are given an E4 template team, so will be stronger than usual boss encounter and always have 6 mons // They are given an E4 template team, so will be stronger than usual boss encounter and always have 6 mons
const brutalTrainerType = scene.arena.randomTrainerType(scene.currentBattle.waveIndex, true); const brutalTrainerType = scene.arena.randomTrainerType(
scene.currentBattle.waveIndex,
true
);
const e4Template = trainerPartyTemplates.ELITE_FOUR; const e4Template = trainerPartyTemplates.ELITE_FOUR;
const brutalConfig = trainerConfigs[brutalTrainerType].copy(); const brutalConfig = trainerConfigs[brutalTrainerType].copy();
brutalConfig.setPartyTemplates(e4Template); brutalConfig.setPartyTemplates(e4Template);
brutalConfig.partyTemplateFunc = null; // Overrides gym leader party template func brutalConfig.partyTemplateFunc = null; // Overrides gym leader party template func
female = false; female = false;
if (brutalConfig.hasGenders) { if (brutalConfig.hasGenders) {
female = !!(Utils.randSeedInt(2)); female = !!Utils.randSeedInt(2);
} }
const brutalSpriteKey = brutalConfig.getSpriteKey(female, brutalConfig.doubleOnly); const brutalSpriteKey = brutalConfig.getSpriteKey(
female,
brutalConfig.doubleOnly
);
encounter.enemyPartyConfigs.push({ encounter.enemyPartyConfigs.push({
trainerConfig: brutalConfig, trainerConfig: brutalConfig,
levelAdditiveMultiplier: 1.1, levelAdditiveMultiplier: 1.1,
female: female female: female,
}); });
encounter.spriteConfigs = [ encounter.spriteConfigs = [
@ -77,30 +116,50 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
spriteKey: normalSpriteKey, spriteKey: normalSpriteKey,
fileRoot: "trainer", fileRoot: "trainer",
hasShadow: true, hasShadow: true,
tint: 1 tint: 1,
}, },
{ {
spriteKey: hardSpriteKey, spriteKey: hardSpriteKey,
fileRoot: "trainer", fileRoot: "trainer",
hasShadow: true, hasShadow: true,
tint: 1 tint: 1,
}, },
{ {
spriteKey: brutalSpriteKey, spriteKey: brutalSpriteKey,
fileRoot: "trainer", fileRoot: "trainer",
hasShadow: true, hasShadow: true,
tint: 1 tint: 1,
} },
]; ];
return true; return true;
}) })
.withSimpleOption(async (scene: BattleScene) => { .withTitle(`${namespace}_title`)
.withDescription(`${namespace}_description`)
.withQuery(`${namespace}_query`)
.withSimpleOption(
{
buttonLabel: `${namespace}_option_1_label`,
buttonTooltip: `${namespace}_option_1_tooltip`,
selected: [
{
text: `${namespace}_option_selected_message`,
},
],
},
async (scene: BattleScene) => {
const encounter = scene.currentBattle.mysteryEncounter; const encounter = scene.currentBattle.mysteryEncounter;
// Spawn standard trainer battle with memory mushroom reward // Spawn standard trainer battle with memory mushroom reward
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[0]; const config: EnemyPartyConfig = encounter.enemyPartyConfigs[0];
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: [modifierTypes.TM_COMMON, modifierTypes.TM_GREAT, modifierTypes.MEMORY_MUSHROOM], fillRemaining: true }); setEncounterRewards(scene, {
guaranteedModifierTypeFuncs: [
modifierTypes.TM_COMMON,
modifierTypes.TM_GREAT,
modifierTypes.MEMORY_MUSHROOM,
],
fillRemaining: true,
});
// Seed offsets to remove possibility of different trainers having exact same teams // Seed offsets to remove possibility of different trainers having exact same teams
let ret; let ret;
@ -108,13 +167,31 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
ret = initBattleWithEnemyConfig(scene, config); ret = initBattleWithEnemyConfig(scene, config);
}, scene.currentBattle.waveIndex * 10); }, scene.currentBattle.waveIndex * 10);
return ret; return ret;
}) }
.withSimpleOption(async (scene: BattleScene) => { )
.withSimpleOption(
{
buttonLabel: `${namespace}_option_2_label`,
buttonTooltip: `${namespace}_option_2_tooltip`,
selected: [
{
text: `${namespace}_option_selected_message`,
},
],
},
async (scene: BattleScene) => {
const encounter = scene.currentBattle.mysteryEncounter; const encounter = scene.currentBattle.mysteryEncounter;
// Spawn hard fight with ULTRA/GREAT reward (can improve with luck) // Spawn hard fight with ULTRA/GREAT reward (can improve with luck)
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[1]; const config: EnemyPartyConfig = encounter.enemyPartyConfigs[1];
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ULTRA, ModifierTier.GREAT, ModifierTier.GREAT], fillRemaining: true }); setEncounterRewards(scene, {
guaranteedModifierTiers: [
ModifierTier.ULTRA,
ModifierTier.GREAT,
ModifierTier.GREAT,
],
fillRemaining: true,
});
// Seed offsets to remove possibility of different trainers having exact same teams // Seed offsets to remove possibility of different trainers having exact same teams
let ret; let ret;
@ -122,8 +199,19 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
ret = initBattleWithEnemyConfig(scene, config); ret = initBattleWithEnemyConfig(scene, config);
}, scene.currentBattle.waveIndex * 100); }, scene.currentBattle.waveIndex * 100);
return ret; return ret;
}) }
.withSimpleOption(async (scene: BattleScene) => { )
.withSimpleOption(
{
buttonLabel: `${namespace}_option_3_label`,
buttonTooltip: `${namespace}_option_3_tooltip`,
selected: [
{
text: `${namespace}_option_selected_message`,
},
],
},
async (scene: BattleScene) => {
const encounter = scene.currentBattle.mysteryEncounter; const encounter = scene.currentBattle.mysteryEncounter;
// Spawn brutal fight with ROGUE/ULTRA/GREAT reward (can improve with luck) // Spawn brutal fight with ROGUE/ULTRA/GREAT reward (can improve with luck)
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[2]; const config: EnemyPartyConfig = encounter.enemyPartyConfigs[2];
@ -131,7 +219,14 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
// To avoid player level snowballing from picking this option // To avoid player level snowballing from picking this option
encounter.expMultiplier = 0.9; encounter.expMultiplier = 0.9;
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ULTRA, ModifierTier.GREAT], fillRemaining: true }); setEncounterRewards(scene, {
guaranteedModifierTiers: [
ModifierTier.ROGUE,
ModifierTier.ULTRA,
ModifierTier.GREAT,
],
fillRemaining: true,
});
// Seed offsets to remove possibility of different trainers having exact same teams // Seed offsets to remove possibility of different trainers having exact same teams
let ret; let ret;
@ -139,5 +234,11 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
ret = initBattleWithEnemyConfig(scene, config); ret = initBattleWithEnemyConfig(scene, config);
}, scene.currentBattle.waveIndex * 1000); }, scene.currentBattle.waveIndex * 1000);
return ret; return ret;
}) }
)
.withOutroDialogue([
{
text: `${namespace}_outro_win`,
},
])
.build(); .build();

View File

@ -1,5 +1,4 @@
import { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { MysteryEncounterType } from "#enums/mystery-encounter-type";
import { MysteriousChallengersDialogue } from "#app/data/mystery-encounters/dialogue/mysterious-challengers-dialogue";
import { MysteriousChestDialogue } from "#app/data/mystery-encounters/dialogue/mysterious-chest-dialogue"; 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";
@ -81,7 +80,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_CHALLENGERS] = MysteriousChallengersDialogue;
allMysteryEncounterDialogue[MysteryEncounterType.MYSTERIOUS_CHEST] = MysteriousChestDialogue; 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;