diff --git a/src/data/mystery-encounters/dialogue/mysterious-challengers-dialogue.ts b/src/data/mystery-encounters/dialogue/mysterious-challengers-dialogue.ts deleted file mode 100644 index 065cfceb1b7..00000000000 --- a/src/data/mystery-encounters/dialogue/mysterious-challengers-dialogue.ts +++ /dev/null @@ -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" - } - ] -}; diff --git a/src/data/mystery-encounters/encounters/mysterious-challengers.ts b/src/data/mystery-encounters/encounters/mysterious-challengers.ts index db794c58e9f..e8efc3470ed 100644 --- a/src/data/mystery-encounters/encounters/mysterious-challengers.ts +++ b/src/data/mystery-encounters/encounters/mysterious-challengers.ts @@ -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 { trainerConfigs, TrainerPartyCompoundTemplate, TrainerPartyTemplate, - trainerPartyTemplates + trainerPartyTemplates, } from "#app/data/trainer-config"; import { ModifierTier } from "#app/modifier/modifier-tier"; 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 BattleScene from "../../../battle-scene"; import * as Utils from "../../../utils"; -import MysteryEncounter, { MysteryEncounterBuilder, MysteryEncounterTier } from "../mystery-encounter"; +import MysteryEncounter, { + MysteryEncounterBuilder, + MysteryEncounterTier, +} from "../mystery-encounter"; -export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounterBuilder - .withEncounterType(MysteryEncounterType.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 +/** the i18n namespace for the encounter */ +const namespace = "mysteryEncounter:mysterious_challengers"; - // Normal difficulty trainer is randomly pulled from biome - const normalTrainerType = scene.arena.randomTrainerType(scene.currentBattle.waveIndex); - const normalConfig = trainerConfigs[normalTrainerType].copy(); - let female = false; - if (normalConfig.hasGenders) { - female = !!(Utils.randSeedInt(2)); - } - const normalSpriteKey = normalConfig.getSpriteKey(female, normalConfig.doubleOnly); - 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 = [ +export const MysteriousChallengersEncounter: MysteryEncounter = + MysteryEncounterBuilder.withEncounterType( + MysteryEncounterType.MYSTERIOUS_CHALLENGERS + ) + .withEncounterTier(MysteryEncounterTier.GREAT) + .withSceneWaveRangeRequirement(10, 180) // waves 10 to 180 + .withIntroSpriteConfigs([]) // These are set in onInit() + .withIntroDialogue([ { - spriteKey: normalSpriteKey, - fileRoot: "trainer", - hasShadow: true, - tint: 1 + text: `${namespace}_intro_message`, }, - { - spriteKey: hardSpriteKey, - fileRoot: "trainer", - hasShadow: true, - tint: 1 - }, - { - spriteKey: brutalSpriteKey, - fileRoot: "trainer", - hasShadow: true, - tint: 1 + ]) + .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 + const normalTrainerType = scene.arena.randomTrainerType( + scene.currentBattle.waveIndex + ); + const normalConfig = trainerConfigs[normalTrainerType].copy(); + 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; - }) - .withSimpleOption(async (scene: BattleScene) => { - const encounter = scene.currentBattle.mysteryEncounter; - // Spawn standard trainer battle with memory mushroom reward - const config: EnemyPartyConfig = encounter.enemyPartyConfigs[0]; + // 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, + }); - 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 - let ret; - scene.executeWithSeedOffset(() => { - ret = initBattleWithEnemyConfig(scene, config); - }, scene.currentBattle.waveIndex * 10); - return ret; - }) - .withSimpleOption(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]; + encounter.spriteConfigs = [ + { + spriteKey: normalSpriteKey, + fileRoot: "trainer", + hasShadow: true, + tint: 1, + }, + { + spriteKey: hardSpriteKey, + fileRoot: "trainer", + 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 - let ret; - scene.executeWithSeedOffset(() => { - ret = initBattleWithEnemyConfig(scene, config); - }, scene.currentBattle.waveIndex * 100); - return ret; - }) - .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]; + setEncounterRewards(scene, { + guaranteedModifierTypeFuncs: [ + modifierTypes.TM_COMMON, + modifierTypes.TM_GREAT, + modifierTypes.MEMORY_MUSHROOM, + ], + fillRemaining: true, + }); - // To avoid player level snowballing from picking this option - encounter.expMultiplier = 0.9; + // Seed offsets to remove possibility of different trainers having exact same teams + 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 - let ret; - scene.executeWithSeedOffset(() => { - ret = initBattleWithEnemyConfig(scene, config); - }, scene.currentBattle.waveIndex * 1000); - return ret; - }) - .build(); + // Seed offsets to remove possibility of different trainers having exact same teams + let ret; + scene.executeWithSeedOffset(() => { + ret = initBattleWithEnemyConfig(scene, config); + }, scene.currentBattle.waveIndex * 100); + return ret; + } + ) + .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(); diff --git a/src/data/mystery-encounters/mystery-encounter-dialogue.ts b/src/data/mystery-encounters/mystery-encounter-dialogue.ts index d9532ee4984..f1051c698d5 100644 --- a/src/data/mystery-encounters/mystery-encounter-dialogue.ts +++ b/src/data/mystery-encounters/mystery-encounter-dialogue.ts @@ -1,5 +1,4 @@ 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 { TrainingSessionDialogue } from "#app/data/mystery-encounters/dialogue/training-session-dialogue"; import { SleepingSnorlaxDialogue } from "./dialogue/sleeping-snorlax-dialogue"; @@ -81,7 +80,6 @@ export default class MysteryEncounterDialogue { export const allMysteryEncounterDialogue: { [encounterType: number]: MysteryEncounterDialogue } = {}; export function initMysteryEncounterDialogue() { - allMysteryEncounterDialogue[MysteryEncounterType.MYSTERIOUS_CHALLENGERS] = MysteriousChallengersDialogue; allMysteryEncounterDialogue[MysteryEncounterType.MYSTERIOUS_CHEST] = MysteriousChestDialogue; allMysteryEncounterDialogue[MysteryEncounterType.TRAINING_SESSION] = TrainingSessionDialogue; allMysteryEncounterDialogue[MysteryEncounterType.SLEEPING_SNORLAX] = SleepingSnorlaxDialogue;