mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-27 10:42:25 +02:00
changed supreme overlords power calculation function and adjusted tests
This commit is contained in:
parent
705a951347
commit
9a34d6175d
@ -1330,13 +1330,14 @@ export default class BattleScene extends SceneBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.executeWithSeedOffset(() => {
|
this.executeWithSeedOffset(() => {
|
||||||
this.currentBattle = new Battle(this.gameMode, newWaveIndex, newBattleType, newTrainer, newDouble);
|
this.currentBattle = new Battle(this.gameMode, newWaveIndex, newBattleType, newTrainer, newDouble, this.currentBattle?.playerFaints, this.currentBattle?.enemyFaints);
|
||||||
}, newWaveIndex << 3, this.waveSeed);
|
}, newWaveIndex << 3, this.waveSeed);
|
||||||
this.currentBattle.incrementTurn();
|
this.currentBattle.incrementTurn();
|
||||||
|
|
||||||
if (newBattleType === BattleType.MYSTERY_ENCOUNTER) {
|
if (newBattleType === BattleType.MYSTERY_ENCOUNTER) {
|
||||||
// Will generate the actual Mystery Encounter during NextEncounterPhase, to ensure it uses proper biome
|
// Will generate the actual Mystery Encounter during NextEncounterPhase, to ensure it uses proper biome
|
||||||
this.currentBattle.mysteryEncounterType = mysteryEncounterType;
|
this.currentBattle.mysteryEncounterType = mysteryEncounterType;
|
||||||
|
this.resetFaintsCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.pushPhase(new TrainerMessageTestPhase(this, TrainerType.RIVAL, TrainerType.RIVAL_2, TrainerType.RIVAL_3, TrainerType.RIVAL_4, TrainerType.RIVAL_5, TrainerType.RIVAL_6));
|
//this.pushPhase(new TrainerMessageTestPhase(this, TrainerType.RIVAL, TrainerType.RIVAL_2, TrainerType.RIVAL_3, TrainerType.RIVAL_4, TrainerType.RIVAL_5, TrainerType.RIVAL_6));
|
||||||
@ -1354,6 +1355,8 @@ export default class BattleScene extends SceneBase {
|
|||||||
this.arena.updatePoolsForTimeOfDay();
|
this.arena.updatePoolsForTimeOfDay();
|
||||||
}
|
}
|
||||||
if (resetArenaState) {
|
if (resetArenaState) {
|
||||||
|
this.resetFaintsCount();
|
||||||
|
|
||||||
this.arena.resetArenaEffects();
|
this.arena.resetArenaEffects();
|
||||||
|
|
||||||
playerField.forEach((pokemon) => pokemon.lapseTag(BattlerTagType.COMMANDED));
|
playerField.forEach((pokemon) => pokemon.lapseTag(BattlerTagType.COMMANDED));
|
||||||
@ -1403,6 +1406,14 @@ export default class BattleScene extends SceneBase {
|
|||||||
return this.arena;
|
return this.arena;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* resets player/enemyFaints count on {@linkcode currentBattle}
|
||||||
|
*/
|
||||||
|
resetFaintsCount(): void {
|
||||||
|
this.currentBattle.playerFaints = 0;
|
||||||
|
this.currentBattle.enemyFaints = 0;
|
||||||
|
}
|
||||||
|
|
||||||
updateFieldScale(): Promise<void> {
|
updateFieldScale(): Promise<void> {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const fieldScale = Math.floor(Math.pow(1 / this.getField(true)
|
const fieldScale = Math.floor(Math.pow(1 / this.getField(true)
|
||||||
|
@ -102,9 +102,9 @@ export default class Battle {
|
|||||||
private battleSeedState: string | null = null;
|
private battleSeedState: string | null = null;
|
||||||
public moneyScattered: number = 0;
|
public moneyScattered: number = 0;
|
||||||
public lastUsedPokeball: PokeballType | null = null;
|
public lastUsedPokeball: PokeballType | null = null;
|
||||||
/** The number of times a Pokemon on the player's side has fainted this battle */
|
/** The number of times a Pokemon on the player's side has fainted this arena encounter */
|
||||||
public playerFaints: number = 0;
|
public playerFaints: number = 0;
|
||||||
/** The number of times a Pokemon on the enemy's side has fainted this battle */
|
/** The number of times a Pokemon on the enemy's side has fainted this arena encounter */
|
||||||
public enemyFaints: number = 0;
|
public enemyFaints: number = 0;
|
||||||
public playerFaintsHistory: FaintLogEntry[] = [];
|
public playerFaintsHistory: FaintLogEntry[] = [];
|
||||||
public enemyFaintsHistory: FaintLogEntry[] = [];
|
public enemyFaintsHistory: FaintLogEntry[] = [];
|
||||||
@ -115,7 +115,7 @@ export default class Battle {
|
|||||||
|
|
||||||
private rngCounter: number = 0;
|
private rngCounter: number = 0;
|
||||||
|
|
||||||
constructor(gameMode: GameMode, waveIndex: number, battleType: BattleType, trainer?: Trainer, double?: boolean) {
|
constructor(gameMode: GameMode, waveIndex: number, battleType: BattleType, trainer?: Trainer, double?: boolean, playerFaints?: number, enemyFaints?: number) {
|
||||||
this.gameMode = gameMode;
|
this.gameMode = gameMode;
|
||||||
this.waveIndex = waveIndex;
|
this.waveIndex = waveIndex;
|
||||||
this.battleType = battleType;
|
this.battleType = battleType;
|
||||||
@ -125,6 +125,8 @@ export default class Battle {
|
|||||||
? new Array(double ? 2 : 1).fill(null).map(() => this.getLevelForWave())
|
? new Array(double ? 2 : 1).fill(null).map(() => this.getLevelForWave())
|
||||||
: trainer?.getPartyLevels(this.waveIndex);
|
: trainer?.getPartyLevels(this.waveIndex);
|
||||||
this.double = double ?? false;
|
this.double = double ?? false;
|
||||||
|
this.playerFaints = playerFaints ?? 0;
|
||||||
|
this.enemyFaints = enemyFaints ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private initBattleSpec(): void {
|
private initBattleSpec(): void {
|
||||||
|
@ -6319,7 +6319,7 @@ export function initAbilities() {
|
|||||||
new Ability(Abilities.SHARPNESS, 9)
|
new Ability(Abilities.SHARPNESS, 9)
|
||||||
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.SLICING_MOVE), 1.5),
|
.attr(MovePowerBoostAbAttr, (user, target, move) => move.hasFlag(MoveFlags.SLICING_MOVE), 1.5),
|
||||||
new Ability(Abilities.SUPREME_OVERLORD, 9)
|
new Ability(Abilities.SUPREME_OVERLORD, 9)
|
||||||
.attr(VariableMovePowerBoostAbAttr, (user, target, move) => 1 + 0.1 * Math.min(user.isPlayer() ? globalScene.getPlayerParty().filter(pokemon => pokemon.isFainted()).length : globalScene.getEnemyParty().filter(pokemon => pokemon.isFainted()).length, 5)),
|
.attr(VariableMovePowerBoostAbAttr, (user, target, move) => 1 + 0.1 * Math.min(user.isPlayer() ? globalScene.currentBattle.playerFaints : globalScene.currentBattle.enemyFaints, 5)),
|
||||||
new Ability(Abilities.COSTAR, 9)
|
new Ability(Abilities.COSTAR, 9)
|
||||||
.attr(PostSummonCopyAllyStatsAbAttr),
|
.attr(PostSummonCopyAllyStatsAbAttr),
|
||||||
new Ability(Abilities.TOXIC_DEBRIS, 9)
|
new Ability(Abilities.TOXIC_DEBRIS, 9)
|
||||||
|
@ -96,8 +96,7 @@ export class FaintPhase extends PokemonPhase {
|
|||||||
doFaint(): void {
|
doFaint(): void {
|
||||||
const pokemon = this.getPokemon();
|
const pokemon = this.getPokemon();
|
||||||
|
|
||||||
|
// Track total times pokemon have been KO'd for last respects/supreme overlord
|
||||||
// Track total times pokemon have been KO'd for last respects
|
|
||||||
if (pokemon.isPlayer()) {
|
if (pokemon.isPlayer()) {
|
||||||
globalScene.currentBattle.playerFaints += 1;
|
globalScene.currentBattle.playerFaints += 1;
|
||||||
globalScene.currentBattle.playerFaintsHistory.push({ pokemon: pokemon, turn: globalScene.currentBattle.turn });
|
globalScene.currentBattle.playerFaintsHistory.push({ pokemon: pokemon, turn: globalScene.currentBattle.turn });
|
||||||
|
@ -12,6 +12,9 @@ describe("Abilities - Supreme Overlord", () => {
|
|||||||
let phaserGame: Phaser.Game;
|
let phaserGame: Phaser.Game;
|
||||||
let game: GameManager;
|
let game: GameManager;
|
||||||
|
|
||||||
|
const move = allMoves[Moves.TACKLE];
|
||||||
|
const basePower = move.power;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
phaserGame = new Phaser.Game({
|
phaserGame = new Phaser.Game({
|
||||||
type: Phaser.HEADLESS,
|
type: Phaser.HEADLESS,
|
||||||
@ -32,17 +35,14 @@ describe("Abilities - Supreme Overlord", () => {
|
|||||||
.enemyAbility(Abilities.BALL_FETCH)
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
.ability(Abilities.SUPREME_OVERLORD)
|
.ability(Abilities.SUPREME_OVERLORD)
|
||||||
.enemyMoveset([ Moves.SPLASH ])
|
.enemyMoveset([ Moves.SPLASH ])
|
||||||
.moveset([ Moves.TACKLE, Moves.EXPLOSION ]);
|
.moveset([ Moves.TACKLE, Moves.EXPLOSION, Moves.LUNAR_DANCE ]);
|
||||||
|
|
||||||
|
vi.spyOn(move, "calculateBattlePower");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should increase Power by 20% if 2 Pokemon are fainted in the party", async() => {
|
it("should increase Power by 20% if 2 Pokemon are fainted in the party", async() => {
|
||||||
await game.startBattle([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE ]);
|
await game.startBattle([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE ]);
|
||||||
|
|
||||||
const moveToCheck = allMoves[Moves.TACKLE];
|
|
||||||
const basePower = moveToCheck.power;
|
|
||||||
|
|
||||||
vi.spyOn(moveToCheck, "calculateBattlePower");
|
|
||||||
|
|
||||||
game.move.select(Moves.EXPLOSION);
|
game.move.select(Moves.EXPLOSION);
|
||||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
game.doSelectPartyPokemon(1);
|
game.doSelectPartyPokemon(1);
|
||||||
@ -57,6 +57,87 @@ describe("Abilities - Supreme Overlord", () => {
|
|||||||
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
await game.phaseInterceptor.to(MoveEffectPhase);
|
await game.phaseInterceptor.to(MoveEffectPhase);
|
||||||
|
|
||||||
expect(moveToCheck.calculateBattlePower).toHaveReturnedWith(basePower * 1.2);
|
expect(move.calculateBattlePower).toHaveReturnedWith(basePower * 1.2);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should maintain its power during next battle if it is within the same arena encounter", async () => {
|
||||||
|
game.override
|
||||||
|
.enemySpecies(Species.MAGIKARP)
|
||||||
|
.startingWave(1)
|
||||||
|
.enemyLevel(1)
|
||||||
|
.startingLevel(100);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE ]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The first Pokemon faints and another Pokemon in the party is selected.
|
||||||
|
*/
|
||||||
|
game.move.select(Moves.LUNAR_DANCE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
game.doSelectPartyPokemon(1);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enemy Pokemon faints and new wave is entered.
|
||||||
|
*/
|
||||||
|
game.move.select(Moves.TACKLE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
await game.toNextWave();
|
||||||
|
|
||||||
|
game.move.select(Moves.TACKLE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
await game.phaseInterceptor.to("TurnEndPhase");
|
||||||
|
|
||||||
|
expect(move.calculateBattlePower).toHaveLastReturnedWith(basePower * 1.1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should reset playerFaints count if we enter new trainer battle", async () => {
|
||||||
|
game.override
|
||||||
|
.enemySpecies(Species.MAGIKARP)
|
||||||
|
.startingWave(4)
|
||||||
|
.enemyLevel(1)
|
||||||
|
.startingLevel(100);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE ]);
|
||||||
|
|
||||||
|
game.move.select(Moves.LUNAR_DANCE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
game.doSelectPartyPokemon(1);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.move.select(Moves.TACKLE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
await game.toNextWave();
|
||||||
|
|
||||||
|
game.move.select(Moves.TACKLE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
|
|
||||||
|
expect(move.calculateBattlePower).toHaveLastReturnedWith(basePower);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should reset playerFaints count if we enter new biome", async () => {
|
||||||
|
game.override
|
||||||
|
.enemySpecies(Species.MAGIKARP)
|
||||||
|
.startingWave(10)
|
||||||
|
.enemyLevel(1)
|
||||||
|
.startingLevel(100);
|
||||||
|
|
||||||
|
await game.classicMode.startBattle([ Species.BULBASAUR, Species.CHARMANDER, Species.SQUIRTLE ]);
|
||||||
|
|
||||||
|
game.move.select(Moves.LUNAR_DANCE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
game.doSelectPartyPokemon(1);
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.move.select(Moves.TACKLE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.ENEMY, BattlerIndex.PLAYER ]);
|
||||||
|
await game.toNextWave();
|
||||||
|
|
||||||
|
game.move.select(Moves.TACKLE);
|
||||||
|
await game.setTurnOrder([ BattlerIndex.PLAYER, BattlerIndex.ENEMY ]);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
|
|
||||||
|
expect(move.calculateBattlePower).toHaveLastReturnedWith(basePower);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user