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,133 +15,230 @@ 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";
.withEncounterTier(MysteryEncounterTier.GREAT)
.withIntroSpriteConfigs([]) // These are set in onInit()
.withSceneWaveRangeRequirement(10, 180) // waves 10 to 180
.withOnInit((scene: BattleScene) => {
const encounter = scene.currentBattle.mysteryEncounter;
// Calculates what trainers are available for battle in the encounter
// Normal difficulty trainer is randomly pulled from biome export const MysteriousChallengersEncounter: MysteryEncounter =
const normalTrainerType = scene.arena.randomTrainerType(scene.currentBattle.waveIndex); MysteryEncounterBuilder.withEncounterType(
const normalConfig = trainerConfigs[normalTrainerType].copy(); MysteryEncounterType.MYSTERIOUS_CHALLENGERS
let female = false; )
if (normalConfig.hasGenders) { .withEncounterTier(MysteryEncounterTier.GREAT)
female = !!(Utils.randSeedInt(2)); .withSceneWaveRangeRequirement(10, 180) // waves 10 to 180
} .withIntroSpriteConfigs([]) // These are set in onInit()
const normalSpriteKey = normalConfig.getSpriteKey(female, normalConfig.doubleOnly); .withIntroDialogue([
encounter.enemyPartyConfigs.push({
trainerConfig: normalConfig,
female: female
});
// 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
const hardTrainerType = scene.arena.randomTrainerType(scene.currentBattle.waveIndex);
const hardTemplate = new TrainerPartyCompoundTemplate(
new TrainerPartyTemplate(1, PartyMemberStrength.STRONGER, false, true),
new TrainerPartyTemplate(Math.min(Math.ceil(scene.currentBattle.waveIndex / 20), 5), PartyMemberStrength.AVERAGE, false, true));
const hardConfig = trainerConfigs[hardTrainerType].copy();
hardConfig.setPartyTemplates(hardTemplate);
female = false;
if (hardConfig.hasGenders) {
female = !!(Utils.randSeedInt(2));
}
const hardSpriteKey = hardConfig.getSpriteKey(female, hardConfig.doubleOnly);
encounter.enemyPartyConfigs.push({
trainerConfig: hardConfig,
levelAdditiveMultiplier: 0.5,
female: female,
});
// 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
const brutalTrainerType = scene.arena.randomTrainerType(scene.currentBattle.waveIndex, true);
const e4Template = trainerPartyTemplates.ELITE_FOUR;
const brutalConfig = trainerConfigs[brutalTrainerType].copy();
brutalConfig.setPartyTemplates(e4Template);
brutalConfig.partyTemplateFunc = null; // Overrides gym leader party template func
female = false;
if (brutalConfig.hasGenders) {
female = !!(Utils.randSeedInt(2));
}
const brutalSpriteKey = brutalConfig.getSpriteKey(female, brutalConfig.doubleOnly);
encounter.enemyPartyConfigs.push({
trainerConfig: brutalConfig,
levelAdditiveMultiplier: 1.1,
female: female
});
encounter.spriteConfigs = [
{ {
spriteKey: normalSpriteKey, text: `${namespace}_intro_message`,
fileRoot: "trainer",
hasShadow: true,
tint: 1
}, },
{ ])
spriteKey: hardSpriteKey, .withOnInit((scene: BattleScene) => {
fileRoot: "trainer", const encounter = scene.currentBattle.mysteryEncounter;
hasShadow: true, // Calculates what trainers are available for battle in the encounter
tint: 1
}, // Normal difficulty trainer is randomly pulled from biome
{ const normalTrainerType = scene.arena.randomTrainerType(
spriteKey: brutalSpriteKey, scene.currentBattle.waveIndex
fileRoot: "trainer", );
hasShadow: true, const normalConfig = trainerConfigs[normalTrainerType].copy();
tint: 1 let female = false;
if (normalConfig.hasGenders) {
female = !!Utils.randSeedInt(2);
} }
]; const normalSpriteKey = normalConfig.getSpriteKey(
female,
normalConfig.doubleOnly
);
encounter.enemyPartyConfigs.push({
trainerConfig: normalConfig,
female: female,
});
return true; // 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
.withSimpleOption(async (scene: BattleScene) => { const hardTrainerType = scene.arena.randomTrainerType(
const encounter = scene.currentBattle.mysteryEncounter; scene.currentBattle.waveIndex
// Spawn standard trainer battle with memory mushroom reward );
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[0]; const hardTemplate = new TrainerPartyCompoundTemplate(
new TrainerPartyTemplate(1, PartyMemberStrength.STRONGER, false, true),
new TrainerPartyTemplate(
Math.min(Math.ceil(scene.currentBattle.waveIndex / 20), 5),
PartyMemberStrength.AVERAGE,
false,
true
)
);
const hardConfig = trainerConfigs[hardTrainerType].copy();
hardConfig.setPartyTemplates(hardTemplate);
female = false;
if (hardConfig.hasGenders) {
female = !!Utils.randSeedInt(2);
}
const hardSpriteKey = hardConfig.getSpriteKey(
female,
hardConfig.doubleOnly
);
encounter.enemyPartyConfigs.push({
trainerConfig: hardConfig,
levelAdditiveMultiplier: 0.5,
female: female,
});
setEncounterRewards(scene, { guaranteedModifierTypeFuncs: [modifierTypes.TM_COMMON, modifierTypes.TM_GREAT, modifierTypes.MEMORY_MUSHROOM], fillRemaining: true }); // 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
const brutalTrainerType = scene.arena.randomTrainerType(
scene.currentBattle.waveIndex,
true
);
const e4Template = trainerPartyTemplates.ELITE_FOUR;
const brutalConfig = trainerConfigs[brutalTrainerType].copy();
brutalConfig.setPartyTemplates(e4Template);
brutalConfig.partyTemplateFunc = null; // Overrides gym leader party template func
female = false;
if (brutalConfig.hasGenders) {
female = !!Utils.randSeedInt(2);
}
const brutalSpriteKey = brutalConfig.getSpriteKey(
female,
brutalConfig.doubleOnly
);
encounter.enemyPartyConfigs.push({
trainerConfig: brutalConfig,
levelAdditiveMultiplier: 1.1,
female: female,
});
// Seed offsets to remove possibility of different trainers having exact same teams encounter.spriteConfigs = [
let ret; {
scene.executeWithSeedOffset(() => { spriteKey: normalSpriteKey,
ret = initBattleWithEnemyConfig(scene, config); fileRoot: "trainer",
}, scene.currentBattle.waveIndex * 10); hasShadow: true,
return ret; tint: 1,
}) },
.withSimpleOption(async (scene: BattleScene) => { {
const encounter = scene.currentBattle.mysteryEncounter; spriteKey: hardSpriteKey,
// Spawn hard fight with ULTRA/GREAT reward (can improve with luck) fileRoot: "trainer",
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[1]; hasShadow: true,
tint: 1,
},
{
spriteKey: brutalSpriteKey,
fileRoot: "trainer",
hasShadow: true,
tint: 1,
},
];
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ULTRA, ModifierTier.GREAT, ModifierTier.GREAT], fillRemaining: true }); 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_selected_message`,
},
],
},
async (scene: BattleScene) => {
const encounter = scene.currentBattle.mysteryEncounter;
// Spawn standard trainer battle with memory mushroom reward
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[0];
// Seed offsets to remove possibility of different trainers having exact same teams setEncounterRewards(scene, {
let ret; guaranteedModifierTypeFuncs: [
scene.executeWithSeedOffset(() => { modifierTypes.TM_COMMON,
ret = initBattleWithEnemyConfig(scene, config); modifierTypes.TM_GREAT,
}, scene.currentBattle.waveIndex * 100); modifierTypes.MEMORY_MUSHROOM,
return ret; ],
}) fillRemaining: true,
.withSimpleOption(async (scene: BattleScene) => { });
const encounter = scene.currentBattle.mysteryEncounter;
// Spawn brutal fight with ROGUE/ULTRA/GREAT reward (can improve with luck)
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[2];
// To avoid player level snowballing from picking this option // Seed offsets to remove possibility of different trainers having exact same teams
encounter.expMultiplier = 0.9; let ret;
scene.executeWithSeedOffset(() => {
ret = initBattleWithEnemyConfig(scene, config);
}, scene.currentBattle.waveIndex * 10);
return ret;
}
)
.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;
// Spawn hard fight with ULTRA/GREAT reward (can improve with luck)
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[1];
setEncounterRewards(scene, { guaranteedModifierTiers: [ModifierTier.ROGUE, ModifierTier.ULTRA, 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;
scene.executeWithSeedOffset(() => { scene.executeWithSeedOffset(() => {
ret = initBattleWithEnemyConfig(scene, config); ret = initBattleWithEnemyConfig(scene, config);
}, scene.currentBattle.waveIndex * 1000); }, scene.currentBattle.waveIndex * 100);
return ret; return ret;
}) }
.build(); )
.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;
// Spawn brutal fight with ROGUE/ULTRA/GREAT reward (can improve with luck)
const config: EnemyPartyConfig = encounter.enemyPartyConfigs[2];
// To avoid player level snowballing from picking this option
encounter.expMultiplier = 0.9;
setEncounterRewards(scene, {
guaranteedModifierTiers: [
ModifierTier.ROGUE,
ModifierTier.ULTRA,
ModifierTier.GREAT,
],
fillRemaining: true,
});
// Seed offsets to remove possibility of different trainers having exact same teams
let ret;
scene.executeWithSeedOffset(() => {
ret = initBattleWithEnemyConfig(scene, config);
}, scene.currentBattle.waveIndex * 1000);
return ret;
}
)
.withOutroDialogue([
{
text: `${namespace}_outro_win`,
},
])
.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;