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
545e09565b
commit
08a3e27d77
@ -1,4 +1,5 @@
|
|||||||
export enum BattleSpec {
|
export enum BattleSpec {
|
||||||
DEFAULT,
|
DEFAULT,
|
||||||
FINAL_BOSS
|
FINAL_BOSS,
|
||||||
|
FINAL_BOSS_MONOTYPE
|
||||||
}
|
}
|
||||||
|
@ -2276,7 +2276,7 @@ export class TurnStartPhase extends FieldPhase {
|
|||||||
super(scene);
|
super(scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrder(): BattlerIndex[] {
|
getSpeedOrder(): BattlerIndex[] {
|
||||||
const playerField = this.scene.getPlayerField().filter(p => p.isActive()) as Pokemon[];
|
const playerField = this.scene.getPlayerField().filter(p => p.isActive()) as Pokemon[];
|
||||||
const enemyField = this.scene.getEnemyField().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();
|
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 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
|
// 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
|
// 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();
|
super.start();
|
||||||
|
|
||||||
const field = this.scene.getField();
|
const field = this.scene.getField();
|
||||||
const order = this.getOrder();
|
const order = this.getCommandOrder();
|
||||||
|
|
||||||
let orderIndex = 0;
|
let orderIndex = 0;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ describe("Battle order", () => {
|
|||||||
});
|
});
|
||||||
await game.phaseInterceptor.run(EnemyCommandPhase);
|
await game.phaseInterceptor.run(EnemyCommandPhase);
|
||||||
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
||||||
const order = phase.getOrder();
|
const order = phase.getCommandOrder();
|
||||||
expect(order[0]).toBe(2);
|
expect(order[0]).toBe(2);
|
||||||
expect(order[1]).toBe(0);
|
expect(order[1]).toBe(0);
|
||||||
}, 20000);
|
}, 20000);
|
||||||
@ -73,7 +73,7 @@ describe("Battle order", () => {
|
|||||||
});
|
});
|
||||||
await game.phaseInterceptor.run(EnemyCommandPhase);
|
await game.phaseInterceptor.run(EnemyCommandPhase);
|
||||||
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
||||||
const order = phase.getOrder();
|
const order = phase.getCommandOrder();
|
||||||
expect(order[0]).toBe(0);
|
expect(order[0]).toBe(0);
|
||||||
expect(order[1]).toBe(2);
|
expect(order[1]).toBe(2);
|
||||||
}, 20000);
|
}, 20000);
|
||||||
@ -113,7 +113,7 @@ describe("Battle order", () => {
|
|||||||
});
|
});
|
||||||
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
|
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
|
||||||
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
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(2));
|
||||||
expect(order.indexOf(0)).toBeGreaterThan(order.indexOf(3));
|
expect(order.indexOf(0)).toBeGreaterThan(order.indexOf(3));
|
||||||
expect(order.indexOf(1)).toBeGreaterThan(order.indexOf(2));
|
expect(order.indexOf(1)).toBeGreaterThan(order.indexOf(2));
|
||||||
@ -155,7 +155,7 @@ describe("Battle order", () => {
|
|||||||
});
|
});
|
||||||
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
|
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
|
||||||
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
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(0));
|
||||||
expect(order.indexOf(3)).toBeLessThan(order.indexOf(1));
|
expect(order.indexOf(3)).toBeLessThan(order.indexOf(1));
|
||||||
expect(order.indexOf(3)).toBeLessThan(order.indexOf(2));
|
expect(order.indexOf(3)).toBeLessThan(order.indexOf(2));
|
||||||
@ -196,7 +196,7 @@ describe("Battle order", () => {
|
|||||||
});
|
});
|
||||||
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
|
await game.phaseInterceptor.runFrom(SelectTargetPhase).to(TurnStartPhase, false);
|
||||||
const phase = game.scene.getCurrentPhase() as TurnStartPhase;
|
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(0));
|
||||||
expect(order.indexOf(1)).toBeLessThan(order.indexOf(2));
|
expect(order.indexOf(1)).toBeLessThan(order.indexOf(2));
|
||||||
expect(order.indexOf(3)).toBeLessThan(order.indexOf(0));
|
expect(order.indexOf(3)).toBeLessThan(order.indexOf(0));
|
||||||
|
@ -164,7 +164,7 @@ describe("Moves - Dynamax Cannon", () => {
|
|||||||
|
|
||||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||||
// Force user to act before enemy
|
// 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);
|
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(dynamaxCannon.id);
|
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(dynamaxCannon.id);
|
||||||
|
@ -391,7 +391,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.
|
* Used to modify the turn order.
|
||||||
* @param {BattlerIndex[]} order The turn order to set
|
* @param {BattlerIndex[]} order The turn order to set
|
||||||
* @example
|
* @example
|
||||||
@ -402,7 +402,7 @@ export default class GameManager {
|
|||||||
async setTurnOrder(order: BattlerIndex[]): Promise<void> {
|
async setTurnOrder(order: BattlerIndex[]): Promise<void> {
|
||||||
await this.phaseInterceptor.to(TurnStartPhase, false);
|
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