Moved isBattleClassicFinalBoss to game-mode.ts and reverted battle.ts

This commit is contained in:
frutescens 2024-11-12 16:37:19 -08:00
parent 8bd36a73fd
commit 639f958a63
3 changed files with 10 additions and 36 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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;