mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-23 23:13:42 +02:00
[Dev] Allow forcing all trainer variants in trainer override (#6391)
This commit is contained in:
parent
e25db16326
commit
37e6371eef
@ -1332,13 +1332,12 @@ export class BattleScene extends SceneBase {
|
|||||||
if (newBattleType === BattleType.TRAINER) {
|
if (newBattleType === BattleType.TRAINER) {
|
||||||
const trainerType =
|
const trainerType =
|
||||||
Overrides.RANDOM_TRAINER_OVERRIDE?.trainerType ?? this.arena.randomTrainerType(newWaveIndex);
|
Overrides.RANDOM_TRAINER_OVERRIDE?.trainerType ?? this.arena.randomTrainerType(newWaveIndex);
|
||||||
|
const hasDouble = trainerConfigs[trainerType].hasDouble;
|
||||||
let doubleTrainer = false;
|
let doubleTrainer = false;
|
||||||
if (trainerConfigs[trainerType].doubleOnly) {
|
if (trainerConfigs[trainerType].doubleOnly) {
|
||||||
doubleTrainer = true;
|
doubleTrainer = true;
|
||||||
} else if (trainerConfigs[trainerType].hasDouble) {
|
} else if (hasDouble) {
|
||||||
doubleTrainer =
|
doubleTrainer = !randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
|
||||||
Overrides.RANDOM_TRAINER_OVERRIDE?.alwaysDouble
|
|
||||||
|| !randSeedInt(this.getDoubleBattleChance(newWaveIndex, playerField));
|
|
||||||
// Add a check that special trainers can't be double except for tate and liza - they should use the normal double chance
|
// Add a check that special trainers can't be double except for tate and liza - they should use the normal double chance
|
||||||
if (
|
if (
|
||||||
trainerConfigs[trainerType].trainerTypeDouble
|
trainerConfigs[trainerType].trainerTypeDouble
|
||||||
@ -1347,11 +1346,19 @@ export class BattleScene extends SceneBase {
|
|||||||
doubleTrainer = false;
|
doubleTrainer = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const variant = doubleTrainer
|
|
||||||
? TrainerVariant.DOUBLE
|
// Forcing a double battle on wave 1 causes a bug where only one enemy is sent out,
|
||||||
: randSeedInt(2)
|
// making it impossible to complete the fight without a reload
|
||||||
? TrainerVariant.FEMALE
|
const overrideVariant =
|
||||||
: TrainerVariant.DEFAULT;
|
Overrides.RANDOM_TRAINER_OVERRIDE?.trainerVariant === TrainerVariant.DOUBLE
|
||||||
|
&& (!hasDouble || newWaveIndex <= 1)
|
||||||
|
? TrainerVariant.DEFAULT
|
||||||
|
: Overrides.RANDOM_TRAINER_OVERRIDE?.trainerVariant;
|
||||||
|
|
||||||
|
const variant =
|
||||||
|
overrideVariant
|
||||||
|
?? (doubleTrainer ? TrainerVariant.DOUBLE : randSeedInt(2) ? TrainerVariant.FEMALE : TrainerVariant.DEFAULT);
|
||||||
|
|
||||||
newTrainer = trainerData !== undefined ? trainerData.toTrainer() : new Trainer(trainerType, variant);
|
newTrainer = trainerData !== undefined ? trainerData.toTrainer() : new Trainer(trainerType, variant);
|
||||||
this.field.add(newTrainer);
|
this.field.add(newTrainer);
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import { Stat } from "#enums/stat";
|
|||||||
import { StatusEffect } from "#enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import { TimeOfDay } from "#enums/time-of-day";
|
import { TimeOfDay } from "#enums/time-of-day";
|
||||||
import { TrainerType } from "#enums/trainer-type";
|
import { TrainerType } from "#enums/trainer-type";
|
||||||
|
import { TrainerVariant } from "#enums/trainer-variant";
|
||||||
import { Unlockables } from "#enums/unlockables";
|
import { Unlockables } from "#enums/unlockables";
|
||||||
import { VariantTier } from "#enums/variant-tier";
|
import { VariantTier } from "#enums/variant-tier";
|
||||||
import { WeatherType } from "#enums/weather-type";
|
import { WeatherType } from "#enums/weather-type";
|
||||||
@ -311,8 +312,12 @@ export type BattleStyle = "double" | "single" | "even-doubles" | "odd-doubles";
|
|||||||
export type RandomTrainerOverride = {
|
export type RandomTrainerOverride = {
|
||||||
/** The Type of trainer to force */
|
/** The Type of trainer to force */
|
||||||
trainerType: Exclude<TrainerType, TrainerType.UNKNOWN>;
|
trainerType: Exclude<TrainerType, TrainerType.UNKNOWN>;
|
||||||
/* If the selected trainer type has a double version, it will always use its double version. */
|
/**
|
||||||
alwaysDouble?: boolean;
|
* The {@linkcode TrainerVariant} to force.
|
||||||
|
* @remarks
|
||||||
|
* `TrainerVariant.DOUBLE` cannot be forced on the first wave of a game due to issues with trainer party generation.
|
||||||
|
*/
|
||||||
|
trainerVariant?: TrainerVariant;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The type of the {@linkcode DefaultOverrides} class */
|
/** The type of the {@linkcode DefaultOverrides} class */
|
||||||
|
@ -10,6 +10,7 @@ import { PokemonType } from "#enums/pokemon-type";
|
|||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { StatusEffect } from "#enums/status-effect";
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
import { TrainerType } from "#enums/trainer-type";
|
import { TrainerType } from "#enums/trainer-type";
|
||||||
|
import { TrainerVariant } from "#enums/trainer-variant";
|
||||||
import { GameManager } from "#test/test-utils/game-manager";
|
import { GameManager } from "#test/test-utils/game-manager";
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
@ -193,7 +194,7 @@ describe("Moves - Whirlwind", () => {
|
|||||||
.battleType(BattleType.TRAINER)
|
.battleType(BattleType.TRAINER)
|
||||||
.randomTrainer({
|
.randomTrainer({
|
||||||
trainerType: TrainerType.BREEDER,
|
trainerType: TrainerType.BREEDER,
|
||||||
alwaysDouble: true,
|
trainerVariant: TrainerVariant.DOUBLE,
|
||||||
})
|
})
|
||||||
.enemyMoveset([MoveId.SPLASH, MoveId.LUNAR_DANCE])
|
.enemyMoveset([MoveId.SPLASH, MoveId.LUNAR_DANCE])
|
||||||
.moveset([MoveId.WHIRLWIND, MoveId.SPLASH]);
|
.moveset([MoveId.WHIRLWIND, MoveId.SPLASH]);
|
||||||
|
Loading…
Reference in New Issue
Block a user