From b49c994d2d6eb09cbce708b29462c6e46848e695 Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Wed, 23 Apr 2025 15:48:04 -0400 Subject: [PATCH] [Balance][Refactor] Move fixed boss waves enum to file, adjust GL templates (#5689) * Move fixed boss waves enum to file, adjust GL templates * Move post return to default case * Address comment --------- Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com> --- src/battle.ts | 24 +------- src/data/challenge.ts | 3 +- src/data/trainers/TrainerPartyTemplate.ts | 73 +++++++++++++++++------ src/enums/fixed-boss-waves.ts | 22 +++++++ src/phases/victory-phase.ts | 2 +- 5 files changed, 80 insertions(+), 44 deletions(-) create mode 100644 src/enums/fixed-boss-waves.ts diff --git a/src/battle.ts b/src/battle.ts index 6630d53bd67..07e520d6bc0 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -31,29 +31,7 @@ import type { CustomModifierSettings } from "#app/modifier/modifier-type"; import { ModifierTier } from "#app/modifier/modifier-tier"; import type { MysteryEncounterType } from "#enums/mystery-encounter-type"; import { BattleType } from "#enums/battle-type"; - -export enum ClassicFixedBossWaves { - TOWN_YOUNGSTER = 5, - RIVAL_1 = 8, - RIVAL_2 = 25, - EVIL_GRUNT_1 = 35, - RIVAL_3 = 55, - EVIL_GRUNT_2 = 62, - EVIL_GRUNT_3 = 64, - EVIL_ADMIN_1 = 66, - RIVAL_4 = 95, - EVIL_GRUNT_4 = 112, - EVIL_ADMIN_2 = 114, - EVIL_BOSS_1 = 115, - RIVAL_5 = 145, - EVIL_BOSS_2 = 165, - ELITE_FOUR_1 = 182, - ELITE_FOUR_2 = 184, - ELITE_FOUR_3 = 186, - ELITE_FOUR_4 = 188, - CHAMPION = 190, - RIVAL_6 = 195, -} +import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves"; export enum BattlerIndex { ATTACKER = -1, diff --git a/src/data/challenge.ts b/src/data/challenge.ts index f786152ca3d..7388f397c7e 100644 --- a/src/data/challenge.ts +++ b/src/data/challenge.ts @@ -8,7 +8,8 @@ import { speciesStarterCosts } from "#app/data/balance/starters"; import type Pokemon from "#app/field/pokemon"; import { PokemonMove } from "#app/field/pokemon"; import type { FixedBattleConfig } from "#app/battle"; -import { ClassicFixedBossWaves, getRandomTrainerFunc } from "#app/battle"; +import { getRandomTrainerFunc } from "#app/battle"; +import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves"; import { BattleType } from "#enums/battle-type"; import Trainer, { TrainerVariant } from "#app/field/trainer"; import { PokemonType } from "#enums/pokemon-type"; diff --git a/src/data/trainers/TrainerPartyTemplate.ts b/src/data/trainers/TrainerPartyTemplate.ts index 5d02ffdc6af..e4c8ddf4c58 100644 --- a/src/data/trainers/TrainerPartyTemplate.ts +++ b/src/data/trainers/TrainerPartyTemplate.ts @@ -1,6 +1,8 @@ import { startingWave } from "#app/starting-wave"; import { globalScene } from "#app/global-scene"; import { PartyMemberStrength } from "#enums/party-member-strength"; +import { GameModes } from "#app/game-mode"; +import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves"; export class TrainerPartyTemplate { public size: number; @@ -165,6 +167,11 @@ export const trainerPartyTemplates = { new TrainerPartyTemplate(1, PartyMemberStrength.STRONGER), ), GYM_LEADER_5: new TrainerPartyCompoundTemplate( + new TrainerPartyTemplate(4, PartyMemberStrength.AVERAGE), + new TrainerPartyTemplate(1, PartyMemberStrength.STRONG), + new TrainerPartyTemplate(1, PartyMemberStrength.STRONGER), + ), + GYM_LEADER_6: new TrainerPartyCompoundTemplate( new TrainerPartyTemplate(3, PartyMemberStrength.AVERAGE), new TrainerPartyTemplate(2, PartyMemberStrength.STRONG), new TrainerPartyTemplate(1, PartyMemberStrength.STRONGER), @@ -222,19 +229,18 @@ export const trainerPartyTemplates = { */ export function getEvilGruntPartyTemplate(): TrainerPartyTemplate { const waveIndex = globalScene.currentBattle?.waveIndex; - if (waveIndex < 40) { - return trainerPartyTemplates.TWO_AVG; + switch (waveIndex) { + case ClassicFixedBossWaves.EVIL_GRUNT_1: + return trainerPartyTemplates.TWO_AVG; + case ClassicFixedBossWaves.EVIL_GRUNT_2: + return trainerPartyTemplates.THREE_AVG; + case ClassicFixedBossWaves.EVIL_GRUNT_3: + return trainerPartyTemplates.TWO_AVG_ONE_STRONG; + case ClassicFixedBossWaves.EVIL_ADMIN_1: + return trainerPartyTemplates.GYM_LEADER_4; // 3avg 1 strong 1 stronger + default: + return trainerPartyTemplates.GYM_LEADER_6; // 3 avg 2 strong 1 stronger } - if (waveIndex < 63) { - return trainerPartyTemplates.THREE_AVG; - } - if (waveIndex < 65) { - return trainerPartyTemplates.TWO_AVG_ONE_STRONG; - } - if (waveIndex < 112) { - return trainerPartyTemplates.GYM_LEADER_4; // 3avg 1 strong 1 stronger - } - return trainerPartyTemplates.GYM_LEADER_5; // 3 avg 2 strong 1 stronger } export function getWavePartyTemplate(...templates: TrainerPartyTemplate[]) { @@ -245,11 +251,40 @@ export function getWavePartyTemplate(...templates: TrainerPartyTemplate[]) { } export function getGymLeaderPartyTemplate() { - return getWavePartyTemplate( - trainerPartyTemplates.GYM_LEADER_1, - trainerPartyTemplates.GYM_LEADER_2, - trainerPartyTemplates.GYM_LEADER_3, - trainerPartyTemplates.GYM_LEADER_4, - trainerPartyTemplates.GYM_LEADER_5, - ); + const { currentBattle, gameMode } = globalScene; + switch (gameMode.modeId) { + case GameModes.DAILY: + if (currentBattle?.waveIndex <= 20) { + return trainerPartyTemplates.GYM_LEADER_2 + } + return trainerPartyTemplates.GYM_LEADER_3; + case GameModes.CHALLENGE: // In the future, there may be a ChallengeType to call here. For now, use classic's. + case GameModes.CLASSIC: + if (currentBattle?.waveIndex <= 20) { + return trainerPartyTemplates.GYM_LEADER_1; // 1 avg 1 strong + } + else if (currentBattle?.waveIndex <= 30) { + return trainerPartyTemplates.GYM_LEADER_2; // 1 avg 1 strong 1 stronger + } + else if (currentBattle?.waveIndex <= 60) { // 50 and 60 + return trainerPartyTemplates.GYM_LEADER_3; // 2 avg 1 strong 1 stronger + } + else if (currentBattle?.waveIndex <= 80) { + return trainerPartyTemplates.GYM_LEADER_4; // 3 avg 1 strong 1 stronger + } + else if (currentBattle?.waveIndex <= 90) { + return trainerPartyTemplates.GYM_LEADER_5; // 4 avg 1 strong 1 stronger + } + // 110+ + return trainerPartyTemplates.GYM_LEADER_6; // 3 avg 2 strong 1 stronger + default: + return getWavePartyTemplate( + trainerPartyTemplates.GYM_LEADER_1, + trainerPartyTemplates.GYM_LEADER_2, + trainerPartyTemplates.GYM_LEADER_3, + trainerPartyTemplates.GYM_LEADER_4, + trainerPartyTemplates.GYM_LEADER_5, + trainerPartyTemplates.GYM_LEADER_6, + ); + } } diff --git a/src/enums/fixed-boss-waves.ts b/src/enums/fixed-boss-waves.ts new file mode 100644 index 00000000000..623d9035472 --- /dev/null +++ b/src/enums/fixed-boss-waves.ts @@ -0,0 +1,22 @@ +export enum ClassicFixedBossWaves { + TOWN_YOUNGSTER = 5, + RIVAL_1 = 8, + RIVAL_2 = 25, + EVIL_GRUNT_1 = 35, + RIVAL_3 = 55, + EVIL_GRUNT_2 = 62, + EVIL_GRUNT_3 = 64, + EVIL_ADMIN_1 = 66, + RIVAL_4 = 95, + EVIL_GRUNT_4 = 112, + EVIL_ADMIN_2 = 114, + EVIL_BOSS_1 = 115, + RIVAL_5 = 145, + EVIL_BOSS_2 = 165, + ELITE_FOUR_1 = 182, + ELITE_FOUR_2 = 184, + ELITE_FOUR_3 = 186, + ELITE_FOUR_4 = 188, + CHAMPION = 190, + RIVAL_6 = 195 +} diff --git a/src/phases/victory-phase.ts b/src/phases/victory-phase.ts index 6e1837a4749..1204877fec2 100644 --- a/src/phases/victory-phase.ts +++ b/src/phases/victory-phase.ts @@ -1,5 +1,5 @@ import type { BattlerIndex } from "#app/battle"; -import { ClassicFixedBossWaves } from "#app/battle"; +import { ClassicFixedBossWaves } from "#enums/fixed-boss-waves"; import { BattleType } from "#enums/battle-type"; import type { CustomModifierSettings } from "#app/modifier/modifier-type"; import { modifierTypes } from "#app/modifier/modifier-type";