diff --git a/src/battle.ts b/src/battle.ts index 77aeaca0cac..a5f1b830cc7 100644 --- a/src/battle.ts +++ b/src/battle.ts @@ -2,7 +2,7 @@ import BattleScene from "./battle-scene"; import { Command } from "./ui/command-ui-handler"; import * as Utils from "./utils"; import Trainer, { TrainerVariant } from "./field/trainer"; -import { GameMode, GameModes } from "./game-mode"; +import { GameMode } from "./game-mode"; import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier"; import { PokeballType } from "#enums/pokeball"; import { trainerConfigs } from "#app/data/trainer-config"; @@ -28,13 +28,6 @@ export enum ClassicFixedBossWaves { EVIL_BOSS_2 = 165, } -export enum EndlessBossType { - STANDARD = 50, - ETERNATUS = 250, - ETERNAMAX = 1000, - NONE -} - export enum BattleType { WILD, TRAINER, @@ -445,32 +438,6 @@ export default class Battle { isBattleMysteryEncounter(): boolean { return this.battleType === BattleType.MYSTERY_ENCOUNTER; } - - /** - * @returns `true` if the current battle is against classic mode's final boss - */ - isBattleClassicFinalBoss(): boolean { - return (this.gameMode.modeId === GameModes.CLASSIC || this.gameMode.modeId === GameModes.CHALLENGE) && this.waveIndex === 200; - } - - /** - * Uses modulos to determine what type of boss is faced by the player in Endless mode. - * @returns the type of Endless boss faced by the player {@linkcode EndlessBossType} - */ - getEndlessBossType(): EndlessBossType { - if (this.gameMode.modeId !== GameModes.ENDLESS && this.gameMode.modeId !== GameModes.SPLICED_ENDLESS) { - return EndlessBossType.NONE; - } else { - if (!(this.waveIndex % EndlessBossType.ETERNAMAX)) { - return EndlessBossType.ETERNAMAX; - } else if (!(this.waveIndex % EndlessBossType.ETERNATUS)) { - return EndlessBossType.ETERNATUS; - } else if (!(this.waveIndex % EndlessBossType.STANDARD)) { - return EndlessBossType.STANDARD; - } - return EndlessBossType.NONE; - } - } } export class FixedBattle extends Battle { diff --git a/src/game-mode.ts b/src/game-mode.ts index 8f1bb9356e6..fc9bde0da58 100644 --- a/src/game-mode.ts +++ b/src/game-mode.ts @@ -230,6 +230,13 @@ export class GameMode implements GameModeConfig { return waveIndex % 10 === 0; } + /** + * @returns `true` if the current battle is against classic mode's final boss + */ + isBattleClassicFinalBoss(waveIndex: number): boolean { + return (this.modeId === GameModes.CLASSIC || this.modeId === GameModes.CHALLENGE) && this.isWaveFinal(waveIndex); + } + /** * Every 50 waves of an Endless mode is a boss * At this time it is paradox pokemon diff --git a/src/phases/encounter-phase.ts b/src/phases/encounter-phase.ts index 40aa61bc457..2e6b7e03c11 100644 --- a/src/phases/encounter-phase.ts +++ b/src/phases/encounter-phase.ts @@ -1,4 +1,4 @@ -import { BattlerIndex, BattleType, EndlessBossType } from "#app/battle"; +import { BattlerIndex, BattleType } from "#app/battle"; import BattleScene from "#app/battle-scene"; import { PLAYER_PARTY_MAX_SIZE } from "#app/constants"; import { applyAbAttrs, SyncEncounterNatureAbAttr } from "#app/data/ability"; @@ -217,7 +217,7 @@ export class EncounterPhase extends BattlePhase { regenerateModifierPoolThresholds(this.scene.getEnemyField(), battle.battleType === BattleType.TRAINER ? ModifierPoolType.TRAINER : ModifierPoolType.WILD); this.scene.generateEnemyModifiers(); // This checks if the current battle is an Endless E-Max battle/Classic final boss and sets the MBH held by the boss to untransferrable - if (this.scene.currentBattle.getEndlessBossType() === EndlessBossType.ETERNAMAX || battle.isBattleClassicFinalBoss()) { + if (this.scene.gameMode.isEndlessMajorBoss(this.scene.currentBattle.waveIndex) || this.scene.gameMode.isBattleClassicFinalBoss(this.scene.currentBattle.waveIndex)) { const enemyPokemon = this.scene.getEnemyPokemon(); if (enemyPokemon) { const bossMBH = this.scene.findModifier(m => m instanceof TurnHeldItemTransferModifier && m.pokemonId === enemyPokemon.id, false) as TurnHeldItemTransferModifier;