mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 06:53:27 +02:00
Fixed module comment + underzealous double battle test override
This commit is contained in:
parent
ad018db015
commit
3117dfe94e
@ -1,3 +1,11 @@
|
||||
/**
|
||||
* A collection of types/interfaces used for {@linkcode BattleScene.newBattle} and associated
|
||||
* sub-methods.
|
||||
*
|
||||
* Types are listed in order of appearance in the function.
|
||||
* @module
|
||||
*/
|
||||
|
||||
// biome-ignore lint/correctness/noUnusedImports: TSDoc
|
||||
import type { BattleScene } from "#app/battle-scene";
|
||||
import type { BattleType } from "#enums/battle-type";
|
||||
@ -5,14 +13,6 @@ import type { MysteryEncounterType } from "#enums/mystery-encounter-type";
|
||||
import type { Trainer } from "#field/trainer";
|
||||
import type { TrainerData } from "#system/trainer-data";
|
||||
|
||||
/**
|
||||
* @module
|
||||
* A collection of types/interfaces used for {@linkcode BattleScene.newBattle} and associated
|
||||
* sub-methods.
|
||||
*
|
||||
* Types are listed in order of appearance in the function.
|
||||
*/
|
||||
|
||||
/** Interface representing the base type of a new battle config, used for DRY. */
|
||||
interface NewBattleBaseProps {
|
||||
/** The type of battle to create. */
|
||||
|
@ -1534,6 +1534,12 @@ export class BattleScene extends SceneBase {
|
||||
* @returns Whether the battle should be a duouble battle.
|
||||
*/
|
||||
private checkIsDouble({ double, battleType, waveIndex, trainer }: NewBattleConstructedProps): boolean {
|
||||
const overriddenDouble = this.doCheckDoubleOverride(waveIndex);
|
||||
// If running unit tests, overrides take precedence over normal code
|
||||
if (import.meta.env.NODE_ENV === "test" && overriddenDouble != null) {
|
||||
return overriddenDouble;
|
||||
}
|
||||
|
||||
// Edge cases
|
||||
if (
|
||||
// Wave 1 doubles cause crashes
|
||||
@ -1544,13 +1550,21 @@ export class BattleScene extends SceneBase {
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Previously defined double battle status (from save data)
|
||||
if (double != null) {
|
||||
return double;
|
||||
}
|
||||
if (overriddenDouble != null) {
|
||||
return overriddenDouble;
|
||||
}
|
||||
|
||||
// Overrides
|
||||
// Standard wild battle chance
|
||||
if (battleType === BattleType.WILD) {
|
||||
return !randSeedInt(this.getDoubleBattleChance(waveIndex));
|
||||
}
|
||||
return trainer?.variant === TrainerVariant.DOUBLE;
|
||||
}
|
||||
|
||||
private doCheckDoubleOverride(waveIndex: number): boolean | undefined {
|
||||
switch (Overrides.BATTLE_STYLE_OVERRIDE) {
|
||||
case "double":
|
||||
return true;
|
||||
@ -1561,12 +1575,6 @@ export class BattleScene extends SceneBase {
|
||||
case "odd-doubles":
|
||||
return waveIndex % 2 === 1;
|
||||
}
|
||||
|
||||
// Standard wild battle chance
|
||||
if (battleType === BattleType.WILD) {
|
||||
return !randSeedInt(this.getDoubleBattleChance(waveIndex));
|
||||
}
|
||||
return trainer?.variant === TrainerVariant.DOUBLE;
|
||||
}
|
||||
|
||||
newArena(biome: BiomeId, playerFaints = 0): Arena {
|
||||
|
Loading…
Reference in New Issue
Block a user