mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 07:52:17 +02:00
Seems OK
This commit is contained in:
parent
7127dfc6f3
commit
0720f5602c
@ -1,4 +1,5 @@
|
||||
export enum BattleSpec {
|
||||
DEFAULT,
|
||||
FINAL_BOSS
|
||||
FINAL_BOSS,
|
||||
FINAL_BOSS_MONOTYPE
|
||||
}
|
||||
|
@ -2276,7 +2276,7 @@ export class TurnStartPhase extends FieldPhase {
|
||||
super(scene);
|
||||
}
|
||||
|
||||
getOrder(): BattlerIndex[] {
|
||||
getSpeedOrder(): BattlerIndex[] {
|
||||
const playerField = this.scene.getPlayerField().filter(p => p.isActive()) as Pokemon[];
|
||||
const enemyField = this.scene.getEnemyField().filter(p => p.isActive()) as Pokemon[];
|
||||
|
||||
@ -2303,8 +2303,12 @@ export class TurnStartPhase extends FieldPhase {
|
||||
orderedTargets = orderedTargets.reverse();
|
||||
}
|
||||
|
||||
let moveOrder : BattlerIndex[] = orderedTargets.map(t => t.getFieldIndex() + (!t.isPlayer() ? BattlerIndex.ENEMY : 0));
|
||||
return orderedTargets.map(t => t.getFieldIndex() + (!t.isPlayer() ? BattlerIndex.ENEMY : 0));
|
||||
}
|
||||
|
||||
getCommandOrder(): BattlerIndex[] {
|
||||
|
||||
let moveOrder = this.getSpeedOrder();
|
||||
// The creation of the battlerBypassSpeed object contains checks for the ability Quick Draw and the held item Quick Claw
|
||||
// The ability Mycelium Might disables Quick Claw's activation when using a status move
|
||||
// This occurs before the main loop because of battles with more than two Pokemon
|
||||
@ -2378,7 +2382,7 @@ export class TurnStartPhase extends FieldPhase {
|
||||
super.start();
|
||||
|
||||
const field = this.scene.getField();
|
||||
const order = this.getOrder();
|
||||
const order = this.getCommandOrder();
|
||||
|
||||
let orderIndex = 0;
|
||||
|
||||
|
@ -55,7 +55,7 @@ describe("Battle order", () => {
|
||||
});
|
||||
await game.phaseInterceptor.run(EnemyCommandPhase);
|
||||
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
||||
const order = phase.getOrder();
|
||||
const order = phase.getCommandOrder();
|
||||
expect(order[0]).toBe(2);
|
||||
expect(order[1]).toBe(0);
|
||||
}, 20000);
|
||||
@ -76,7 +76,7 @@ describe("Battle order", () => {
|
||||
});
|
||||
await game.phaseInterceptor.run(EnemyCommandPhase);
|
||||
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
||||
const order = phase.getOrder();
|
||||
const order = phase.getCommandOrder();
|
||||
expect(order[0]).toBe(0);
|
||||
expect(order[1]).toBe(2);
|
||||
}, 20000);
|
||||
@ -116,7 +116,7 @@ describe("Battle order", () => {
|
||||
});
|
||||
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
|
||||
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
||||
const order = phase.getOrder();
|
||||
const order = phase.getCommandOrder();
|
||||
expect(order.indexOf(0)).toBeGreaterThan(order.indexOf(2));
|
||||
expect(order.indexOf(0)).toBeGreaterThan(order.indexOf(3));
|
||||
expect(order.indexOf(1)).toBeGreaterThan(order.indexOf(2));
|
||||
@ -158,7 +158,7 @@ describe("Battle order", () => {
|
||||
});
|
||||
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
|
||||
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
||||
const order = phase.getOrder();
|
||||
const order = phase.getCommandOrder();
|
||||
expect(order.indexOf(3)).toBeLessThan(order.indexOf(0));
|
||||
expect(order.indexOf(3)).toBeLessThan(order.indexOf(1));
|
||||
expect(order.indexOf(3)).toBeLessThan(order.indexOf(2));
|
||||
@ -199,7 +199,7 @@ describe("Battle order", () => {
|
||||
});
|
||||
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
|
||||
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
||||
const order = phase.getOrder();
|
||||
const order = phase.getCommandOrder();
|
||||
expect(order.indexOf(1)).toBeLessThan(order.indexOf(0));
|
||||
expect(order.indexOf(1)).toBeLessThan(order.indexOf(2));
|
||||
expect(order.indexOf(3)).toBeLessThan(order.indexOf(0));
|
||||
|
@ -166,7 +166,7 @@ describe("Moves - Dynamax Cannon", () => {
|
||||
|
||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||
// Force user to act before enemy
|
||||
vi.spyOn((game.scene.getCurrentPhase() as TurnStartPhase), "getOrder").mockReturnValue([ BattlerIndex.PLAYER, BattlerIndex. ENEMY]);
|
||||
vi.spyOn((game.scene.getCurrentPhase() as TurnStartPhase), "getCommandOrder").mockReturnValue([ BattlerIndex.PLAYER, BattlerIndex. ENEMY]);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(dynamaxCannon.id);
|
||||
|
@ -388,7 +388,7 @@ export default class GameManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Intercepts `TurnStartPhase` and mocks the getOrder's return value {@linkcode TurnStartPhase.getOrder}
|
||||
* Intercepts `TurnStartPhase` and mocks the getSpeedOrder's return value {@linkcode TurnStartPhase.getSpeedOrder}
|
||||
* Used to modify the turn order.
|
||||
* @param {BattlerIndex[]} order The turn order to set
|
||||
* @example
|
||||
@ -399,7 +399,7 @@ export default class GameManager {
|
||||
async setTurnOrder(order: BattlerIndex[]): Promise<void> {
|
||||
await this.phaseInterceptor.to(TurnStartPhase, false);
|
||||
|
||||
vi.spyOn(this.scene.getCurrentPhase() as TurnStartPhase, "getOrder").mockReturnValue(order);
|
||||
vi.spyOn(this.scene.getCurrentPhase() as TurnStartPhase, "getSpeedOrder").mockReturnValue(order);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user