Use fixed battle enum in more places

This commit is contained in:
AJ Fontaine 2025-02-12 20:54:21 -05:00
parent 595413edd7
commit 5c7e508444
5 changed files with 26 additions and 20 deletions

View File

@ -44,6 +44,7 @@ export enum ClassicFixedBossWaves {
ELITE_FOUR_4 = 188, ELITE_FOUR_4 = 188,
CHAMPION = 190, CHAMPION = 190,
RIVAL_6 = 195, RIVAL_6 = 195,
ETERNATUS = 200,
} }
export enum BattleType { export enum BattleType {
@ -250,7 +251,7 @@ export default class Battle {
} else { } else {
return this.trainer?.getMixedBattleBgm() ?? null; return this.trainer?.getMixedBattleBgm() ?? null;
} }
} else if (this.gameMode.isClassic && this.waveIndex > 195 && this.battleSpec !== BattleSpec.FINAL_BOSS) { } else if (this.gameMode.isClassic && this.waveIndex > ClassicFixedBossWaves.RIVAL_6 && this.battleSpec !== BattleSpec.FINAL_BOSS) {
return "end_summit"; return "end_summit";
} }
const wildOpponents = globalScene.getEnemyParty(); const wildOpponents = globalScene.getEnemyParty();
@ -419,7 +420,7 @@ export default class Battle {
} }
} }
if (globalScene.gameMode.isClassic && this.waveIndex <= 4) { if (globalScene.gameMode.isClassic && this.waveIndex < ClassicFixedBossWaves.TOWN_YOUNGSTER) {
return "battle_wild"; return "battle_wild";
} }

View File

@ -22,6 +22,7 @@ import { PartyMemberStrength } from "#enums/party-member-strength";
import { Species } from "#enums/species"; import { Species } from "#enums/species";
import { TrainerType } from "#enums/trainer-type"; import { TrainerType } from "#enums/trainer-type";
import { Gender } from "#app/data/gender"; import { Gender } from "#app/data/gender";
import { ClassicFixedBossWaves } from "#app/battle";
/** Minimum BST for Pokemon generated onto the Elite Four's teams */ /** Minimum BST for Pokemon generated onto the Elite Four's teams */
const ELITE_FOUR_MINIMUM_BST = 460; const ELITE_FOUR_MINIMUM_BST = 460;
@ -1129,20 +1130,24 @@ interface TrainerConfigs {
} }
/** /**
* The function to get variable strength grunts * The function to get the appropriate strength template for grunts and admins.
* Each successive evil team battle has higher strength template.
* The exception is Grunt 4 and Admin 2, who share the GYM_LEADER_5 template.
* The Leader's strength template is defined separately.
* @see {@linkcode initForEvilTeamLeader}
* @returns the correct TrainerPartyTemplate * @returns the correct TrainerPartyTemplate
*/ */
function getEvilGruntPartyTemplate(): TrainerPartyTemplate { function getEvilGruntPartyTemplate(): TrainerPartyTemplate {
const waveIndex = globalScene.currentBattle?.waveIndex; switch (globalScene.currentBattle?.waveIndex) {
if (waveIndex < 40) { case ClassicFixedBossWaves.EVIL_GRUNT_1:
return trainerPartyTemplates.TWO_AVG; return trainerPartyTemplates.TWO_AVG;
} else if (waveIndex < 63) { case ClassicFixedBossWaves.EVIL_GRUNT_2:
return trainerPartyTemplates.THREE_AVG; return trainerPartyTemplates.THREE_AVG;
} else if (waveIndex < 65) { case ClassicFixedBossWaves.EVIL_GRUNT_3:
return trainerPartyTemplates.TWO_AVG_ONE_STRONG; return trainerPartyTemplates.TWO_AVG_ONE_STRONG;
} else if (waveIndex < 112) { case ClassicFixedBossWaves.EVIL_ADMIN_1:
return trainerPartyTemplates.GYM_LEADER_4; // 3 avg 1 strong 1 stronger return trainerPartyTemplates.GYM_LEADER_4; // 3 avg 1 strong 1 stronger
} else { default:
return trainerPartyTemplates.GYM_LEADER_5; // 3 avg 2 strong 1 stronger return trainerPartyTemplates.GYM_LEADER_5; // 3 avg 2 strong 1 stronger
} }
} }

View File

@ -1,6 +1,6 @@
import i18next from "i18next"; import i18next from "i18next";
import type { FixedBattleConfigs } from "./battle"; import type { FixedBattleConfigs } from "./battle";
import { classicFixedBattles, FixedBattleConfig } from "./battle"; import { classicFixedBattles, ClassicFixedBossWaves, FixedBattleConfig } from "./battle";
import type { Challenge } from "./data/challenge"; import type { Challenge } from "./data/challenge";
import { allChallenges, applyChallenges, ChallengeType, copyChallenge } from "./data/challenge"; import { allChallenges, applyChallenges, ChallengeType, copyChallenge } from "./data/challenge";
import type PokemonSpecies from "./data/pokemon-species"; import type PokemonSpecies from "./data/pokemon-species";
@ -215,7 +215,7 @@ export class GameMode implements GameModeConfig {
switch (modeId) { switch (modeId) {
case GameModes.CLASSIC: case GameModes.CLASSIC:
case GameModes.CHALLENGE: case GameModes.CHALLENGE:
return waveIndex === 200; return waveIndex === ClassicFixedBossWaves.ETERNATUS;
case GameModes.ENDLESS: case GameModes.ENDLESS:
case GameModes.SPLICED_ENDLESS: case GameModes.SPLICED_ENDLESS:
return !(waveIndex % 250); return !(waveIndex % 250);

View File

@ -1,4 +1,4 @@
import { BattlerIndex, BattleType } from "#app/battle"; import { BattlerIndex, BattleType, ClassicFixedBossWaves } from "#app/battle";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { PLAYER_PARTY_MAX_SIZE } from "#app/constants"; import { PLAYER_PARTY_MAX_SIZE } from "#app/constants";
import { applyAbAttrs, SyncEncounterNatureAbAttr } from "#app/data/ability"; import { applyAbAttrs, SyncEncounterNatureAbAttr } from "#app/data/ability";
@ -58,7 +58,7 @@ export class EncounterPhase extends BattlePhase {
globalScene.eventTarget.dispatchEvent(new EncounterPhaseEvent()); globalScene.eventTarget.dispatchEvent(new EncounterPhaseEvent());
// Failsafe if players somehow skip floor 200 in classic mode // Failsafe if players somehow skip floor 200 in classic mode
if (globalScene.gameMode.isClassic && globalScene.currentBattle.waveIndex > 200) { if (globalScene.gameMode.isClassic && globalScene.currentBattle.waveIndex > ClassicFixedBossWaves.ETERNATUS) {
globalScene.unshiftPhase(new GameOverPhase()); globalScene.unshiftPhase(new GameOverPhase());
} }

View File

@ -1,5 +1,5 @@
import { clientSessionId } from "#app/account"; import { clientSessionId } from "#app/account";
import { BattleType } from "#app/battle"; import { BattleType, ClassicFixedBossWaves } from "#app/battle";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions"; import { pokemonEvolutions } from "#app/data/balance/pokemon-evolutions";
import { getCharVariantFromDialogue } from "#app/data/dialogue"; import { getCharVariantFromDialogue } from "#app/data/dialogue";
@ -46,7 +46,7 @@ export class GameOverPhase extends BattlePhase {
super.start(); super.start();
// Failsafe if players somehow skip floor 200 in classic mode // Failsafe if players somehow skip floor 200 in classic mode
if (globalScene.gameMode.isClassic && globalScene.currentBattle.waveIndex > 200) { if (globalScene.gameMode.isClassic && globalScene.currentBattle.waveIndex > ClassicFixedBossWaves.ETERNATUS) {
this.isVictory = true; this.isVictory = true;
} }