mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 06:19:29 +02:00
Created a new enum and functions for retrieving final bosses.
This commit is contained in:
parent
c983027adb
commit
8bd36a73fd
@ -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 } from "./game-mode";
|
||||
import { GameMode, GameModes } from "./game-mode";
|
||||
import { MoneyMultiplierModifier, PokemonHeldItemModifier } from "./modifier/modifier";
|
||||
import { PokeballType } from "#enums/pokeball";
|
||||
import { trainerConfigs } from "#app/data/trainer-config";
|
||||
@ -28,6 +28,13 @@ export enum ClassicFixedBossWaves {
|
||||
EVIL_BOSS_2 = 165,
|
||||
}
|
||||
|
||||
export enum EndlessBossType {
|
||||
STANDARD = 50,
|
||||
ETERNATUS = 250,
|
||||
ETERNAMAX = 1000,
|
||||
NONE
|
||||
}
|
||||
|
||||
export enum BattleType {
|
||||
WILD,
|
||||
TRAINER,
|
||||
@ -438,6 +445,32 @@ 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 {
|
||||
@ -499,7 +532,7 @@ export class FixedBattleConfig {
|
||||
* @param seedOffset the seed offset to use for the random generation of the trainer
|
||||
* @returns the generated trainer
|
||||
*/
|
||||
function getRandomTrainerFunc(trainerPool: (TrainerType | TrainerType[])[], randomGender: boolean = false, seedOffset: number = 0): GetTrainerFunc {
|
||||
function getRandomTrainerFunc(trainerPool: (TrainerType | TrainerType[])[], randomGender: boolean = false, seedOffset: number = 0): GetTrainerFunc {
|
||||
return (scene: BattleScene) => {
|
||||
const rand = Utils.randSeedInt(trainerPool.length);
|
||||
const trainerTypes: TrainerType[] = [];
|
||||
@ -531,7 +564,7 @@ function getRandomTrainerFunc(trainerPool: (TrainerType | TrainerType[])[], rand
|
||||
}
|
||||
|
||||
export interface FixedBattleConfigs {
|
||||
[key: number]: FixedBattleConfig
|
||||
[key: number]: FixedBattleConfig
|
||||
}
|
||||
/**
|
||||
* Youngster/Lass on 5
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { BattlerIndex, BattleType } from "#app/battle";
|
||||
import { BattlerIndex, BattleType, EndlessBossType } 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.waveIndex % 1000 || battle.battleSpec === BattleSpec.FINAL_BOSS) {
|
||||
if (this.scene.currentBattle.getEndlessBossType() === EndlessBossType.ETERNAMAX || battle.isBattleClassicFinalBoss()) {
|
||||
const enemyPokemon = this.scene.getEnemyPokemon();
|
||||
if (enemyPokemon) {
|
||||
const bossMBH = this.scene.findModifier(m => m instanceof TurnHeldItemTransferModifier && m.pokemonId === enemyPokemon.id, false) as TurnHeldItemTransferModifier;
|
||||
|
Loading…
Reference in New Issue
Block a user