[Move] Implement Fusion Flare and Fusion Bolt (#1774)
This commit is contained in:
parent
de7afd026c
commit
b5d77c3d15
|
@ -3406,6 +3406,72 @@ export class MultiHitPowerIncrementAttr extends VariablePowerAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attribute used for moves that double in power if the given move immediately
|
||||
* preceded the move applying the attribute, namely Fusion Flare and
|
||||
* Fusion Bolt.
|
||||
* @extends VariablePowerAttr
|
||||
* @see {@linkcode apply}
|
||||
*/
|
||||
export class LastMoveDoublePowerAttr extends VariablePowerAttr {
|
||||
/** The move that must precede the current move */
|
||||
private move: Moves;
|
||||
|
||||
constructor(move: Moves) {
|
||||
super();
|
||||
|
||||
this.move = move;
|
||||
}
|
||||
|
||||
/**
|
||||
* Doubles power of move if the given move is found to precede the current
|
||||
* move with no other moves being executed in between, only ignoring failed
|
||||
* moves if any.
|
||||
* @param user {@linkcode Pokemon} that used the move
|
||||
* @param target N/A
|
||||
* @param move N/A
|
||||
* @param args [0] {@linkcode Utils.NumberHolder} that holds the resulting power of the move
|
||||
* @returns true if attribute application succeeds, false otherwise
|
||||
*/
|
||||
apply(user: Pokemon, _target: Pokemon, _move: Move, args: any[]): boolean {
|
||||
const power = args[0] as Utils.NumberHolder;
|
||||
const enemy = user.getOpponent(0);
|
||||
const pokemonActed: Pokemon[] = [];
|
||||
|
||||
if (enemy.turnData.acted) {
|
||||
pokemonActed.push(enemy);
|
||||
}
|
||||
|
||||
if (user.scene.currentBattle.double) {
|
||||
const userAlly = user.getAlly();
|
||||
const enemyAlly = enemy.getAlly();
|
||||
|
||||
if (userAlly && userAlly.turnData.acted) {
|
||||
pokemonActed.push(userAlly);
|
||||
}
|
||||
if (enemyAlly && enemyAlly.turnData.acted) {
|
||||
pokemonActed.push(enemyAlly);
|
||||
}
|
||||
}
|
||||
|
||||
pokemonActed.sort((a, b) => b.turnData.order - a.turnData.order);
|
||||
|
||||
for (const p of pokemonActed) {
|
||||
const [ lastMove ] = p.getLastXMoves(1);
|
||||
if (lastMove.result !== MoveResult.FAIL) {
|
||||
if ((lastMove.result === MoveResult.SUCCESS) && (lastMove.move === this.move)) {
|
||||
power.value *= 2;
|
||||
return true;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class VariableAtkAttr extends MoveAttr {
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -7419,10 +7485,10 @@ export function initMoves() {
|
|||
.attr(StatChangeAttr, [ BattleStat.DEF, BattleStat.SPDEF, BattleStat.SPD ], -1, true),
|
||||
new AttackMove(Moves.FUSION_FLARE, Type.FIRE, MoveCategory.SPECIAL, 100, 100, 5, -1, 0, 5)
|
||||
.attr(HealStatusEffectAttr, true, StatusEffect.FREEZE)
|
||||
.partial(),
|
||||
.attr(LastMoveDoublePowerAttr, Moves.FUSION_BOLT),
|
||||
new AttackMove(Moves.FUSION_BOLT, Type.ELECTRIC, MoveCategory.PHYSICAL, 100, 100, 5, -1, 0, 5)
|
||||
.makesContact(false)
|
||||
.partial(),
|
||||
.attr(LastMoveDoublePowerAttr, Moves.FUSION_FLARE)
|
||||
.makesContact(false),
|
||||
new AttackMove(Moves.FLYING_PRESS, Type.FIGHTING, MoveCategory.PHYSICAL, 100, 95, 10, -1, 0, 6)
|
||||
.attr(MinimizeAccuracyAttr)
|
||||
.attr(FlyingTypeMultiplierAttr)
|
||||
|
|
|
@ -4062,6 +4062,7 @@ export class PokemonTurnData {
|
|||
public currDamageDealt: integer = 0;
|
||||
public damageTaken: integer = 0;
|
||||
public attacksReceived: AttackMoveResult[] = [];
|
||||
public order: number;
|
||||
}
|
||||
|
||||
export enum AiType {
|
||||
|
|
|
@ -2314,6 +2314,8 @@ export class TurnStartPhase extends FieldPhase {
|
|||
return aIndex < bIndex ? -1 : aIndex > bIndex ? 1 : 0;
|
||||
});
|
||||
|
||||
let orderIndex = 0;
|
||||
|
||||
for (const o of moveOrder) {
|
||||
|
||||
const pokemon = field[o];
|
||||
|
@ -2326,6 +2328,7 @@ export class TurnStartPhase extends FieldPhase {
|
|||
switch (turnCommand.command) {
|
||||
case Command.FIGHT:
|
||||
const queuedMove = turnCommand.move;
|
||||
pokemon.turnData.order = orderIndex++;
|
||||
if (!queuedMove) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import Phaser from "phaser";
|
||||
import GameManager from "#app/test/utils/gameManager";
|
||||
import overrides from "#app/overrides";
|
||||
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
|
||||
import { Species } from "#enums/species";
|
||||
import { Moves } from "#enums/moves";
|
||||
import { Abilities } from "#enums/abilities";
|
||||
|
||||
describe("Moves - Fusion Bolt", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
const fusionBolt = Moves.FUSION_BOLT;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ fusionBolt ]);
|
||||
vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1);
|
||||
|
||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RESHIRAM);
|
||||
vi.spyOn(overrides, "OPP_ABILITY_OVERRIDE", "get").mockReturnValue(Abilities.ROUGH_SKIN);
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]);
|
||||
|
||||
vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single");
|
||||
vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(97);
|
||||
vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true);
|
||||
});
|
||||
|
||||
it("should not make contact", async() => {
|
||||
await game.startBattle([
|
||||
Species.ZEKROM,
|
||||
]);
|
||||
|
||||
const partyMember = game.scene.getPlayerPokemon();
|
||||
const initialHp = partyMember.hp;
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionBolt));
|
||||
|
||||
await game.toNextTurn();
|
||||
|
||||
expect(initialHp - partyMember.hp).toBe(0);
|
||||
}, 20000);
|
||||
});
|
|
@ -0,0 +1,60 @@
|
|||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import Phaser from "phaser";
|
||||
import GameManager from "#app/test/utils/gameManager";
|
||||
import overrides from "#app/overrides";
|
||||
import { TurnStartPhase } from "#app/phases";
|
||||
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
|
||||
import { StatusEffect } from "#app/data/status-effect";
|
||||
import { Species } from "#enums/species";
|
||||
import { Moves } from "#enums/moves";
|
||||
|
||||
describe("Moves - Fusion Flare", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
const fusionFlare = Moves.FUSION_FLARE;
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ fusionFlare ]);
|
||||
vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1);
|
||||
|
||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RESHIRAM);
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.REST, Moves.REST, Moves.REST, Moves.REST ]);
|
||||
|
||||
vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("single");
|
||||
vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(97);
|
||||
vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true);
|
||||
});
|
||||
|
||||
it("should thaw freeze status condition", async() => {
|
||||
await game.startBattle([
|
||||
Species.RESHIRAM,
|
||||
]);
|
||||
|
||||
const partyMember = game.scene.getPlayerPokemon();
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionFlare));
|
||||
|
||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||
|
||||
// Inflict freeze quietly and check if it was properly inflicted
|
||||
partyMember.trySetStatus(StatusEffect.FREEZE, false);
|
||||
expect(partyMember.status.effect).toBe(StatusEffect.FREEZE);
|
||||
|
||||
await game.toNextTurn();
|
||||
|
||||
// Check if FUSION_FLARE thawed freeze
|
||||
expect(partyMember.status?.effect).toBeUndefined();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,323 @@
|
|||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import Phaser from "phaser";
|
||||
import GameManager from "#app/test/utils/gameManager";
|
||||
import overrides from "#app/overrides";
|
||||
import { MoveEffectPhase, MovePhase, MoveEndPhase, TurnStartPhase, DamagePhase } from "#app/phases";
|
||||
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
|
||||
import { Stat } from "#app/data/pokemon-stat";
|
||||
import { allMoves } from "#app/data/move";
|
||||
import { BattlerIndex } from "#app/battle";
|
||||
import { Species } from "#enums/species";
|
||||
import { Moves } from "#enums/moves";
|
||||
|
||||
describe("Moves - Fusion Flare and Fusion Bolt", () => {
|
||||
let phaserGame: Phaser.Game;
|
||||
let game: GameManager;
|
||||
|
||||
const fusionFlare = allMoves[Moves.FUSION_FLARE];
|
||||
const fusionBolt = allMoves[Moves.FUSION_BOLT];
|
||||
|
||||
beforeAll(() => {
|
||||
phaserGame = new Phaser.Game({
|
||||
type: Phaser.HEADLESS,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
game.phaseInterceptor.restoreOg();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
game = new GameManager(phaserGame);
|
||||
vi.spyOn(overrides, "MOVESET_OVERRIDE", "get").mockReturnValue([ fusionFlare.id, fusionBolt.id ]);
|
||||
vi.spyOn(overrides, "STARTING_LEVEL_OVERRIDE", "get").mockReturnValue(1);
|
||||
|
||||
vi.spyOn(overrides, "OPP_SPECIES_OVERRIDE", "get").mockReturnValue(Species.RESHIRAM);
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.REST, Moves.REST, Moves.REST, Moves.REST ]);
|
||||
|
||||
vi.spyOn(overrides, "BATTLE_TYPE_OVERRIDE", "get").mockReturnValue("double");
|
||||
vi.spyOn(overrides, "STARTING_WAVE_OVERRIDE", "get").mockReturnValue(97);
|
||||
vi.spyOn(overrides, "NEVER_CRIT_OVERRIDE", "get").mockReturnValue(true);
|
||||
|
||||
vi.spyOn(fusionFlare, "calculateBattlePower");
|
||||
vi.spyOn(fusionBolt, "calculateBattlePower");
|
||||
});
|
||||
|
||||
it("FUSION_FLARE should double power of subsequent FUSION_BOLT", async() => {
|
||||
await game.startBattle([
|
||||
Species.ZEKROM,
|
||||
Species.ZEKROM
|
||||
]);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionFlare.id));
|
||||
game.doSelectTarget(BattlerIndex.ENEMY);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionBolt.id));
|
||||
game.doSelectTarget(BattlerIndex.ENEMY);
|
||||
|
||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||
|
||||
// Force user party to act before enemy party
|
||||
vi.spyOn(game.scene.getCurrentPhase() as TurnStartPhase, "getOrder").mockReturnValue([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionFlare.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(100);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionBolt.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200);
|
||||
}, 20000);
|
||||
|
||||
it("FUSION_BOLT should double power of subsequent FUSION_FLARE", async() => {
|
||||
await game.startBattle([
|
||||
Species.ZEKROM,
|
||||
Species.ZEKROM
|
||||
]);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionBolt.id));
|
||||
game.doSelectTarget(BattlerIndex.ENEMY);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionFlare.id));
|
||||
game.doSelectTarget(BattlerIndex.ENEMY);
|
||||
|
||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||
|
||||
// Force user party to act before enemy party
|
||||
vi.spyOn(game.scene.getCurrentPhase() as TurnStartPhase, "getOrder").mockReturnValue([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionBolt.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionFlare.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
|
||||
}, 20000);
|
||||
|
||||
it("FUSION_FLARE should double power of subsequent FUSION_BOLT if a move failed in between", async() => {
|
||||
await game.startBattle([
|
||||
Species.ZEKROM,
|
||||
Species.ZEKROM
|
||||
]);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionFlare.id));
|
||||
game.doSelectTarget(0);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionBolt.id));
|
||||
game.doSelectTarget(0);
|
||||
|
||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||
|
||||
// Force first enemy to act (and fail) in between party
|
||||
vi.spyOn(game.scene.getCurrentPhase() as TurnStartPhase, "getOrder").mockReturnValue([ BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY ]);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionFlare.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(100);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEndPhase);
|
||||
|
||||
// Skip enemy move; because the enemy is at full HP, Rest should fail
|
||||
await game.phaseInterceptor.runFrom(MovePhase).to(MoveEndPhase);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionBolt.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200);
|
||||
}, 20000);
|
||||
|
||||
it("FUSION_FLARE should not double power of subsequent FUSION_BOLT if a move succeeded in between", async() => {
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ Moves.SPLASH, Moves.SPLASH, Moves.SPLASH, Moves.SPLASH ]);
|
||||
await game.startBattle([
|
||||
Species.ZEKROM,
|
||||
Species.ZEKROM
|
||||
]);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionFlare.id));
|
||||
game.doSelectTarget(BattlerIndex.ENEMY);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionBolt.id));
|
||||
game.doSelectTarget(BattlerIndex.ENEMY);
|
||||
|
||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||
|
||||
// Force first enemy to act in between party
|
||||
vi.spyOn(game.scene.getCurrentPhase() as TurnStartPhase, "getOrder").mockReturnValue([ BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY ]);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionFlare.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(100);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEndPhase);
|
||||
// Skip enemy move
|
||||
await game.phaseInterceptor.runFrom(MovePhase).to(MoveEndPhase);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionBolt.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
|
||||
}, 20000);
|
||||
|
||||
it("FUSION_FLARE should double power of subsequent FUSION_BOLT if moves are aimed at allies", async() => {
|
||||
await game.startBattle([
|
||||
Species.ZEKROM,
|
||||
Species.RESHIRAM
|
||||
]);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionBolt.id));
|
||||
game.doSelectTarget(BattlerIndex.PLAYER_2);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionFlare.id));
|
||||
game.doSelectTarget(BattlerIndex.PLAYER);
|
||||
|
||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||
|
||||
// Force user party to act before enemy party
|
||||
vi.spyOn(game.scene.getCurrentPhase() as TurnStartPhase, "getOrder").mockReturnValue([ BattlerIndex.PLAYER, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY, BattlerIndex.ENEMY_2 ]);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionBolt.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionFlare.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
|
||||
}, 20000);
|
||||
|
||||
it("FUSION_FLARE and FUSION_BOLT alternating throughout turn should double power of subsequent moves", async() => {
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ fusionFlare.id, fusionFlare.id, fusionFlare.id, fusionFlare.id ]);
|
||||
await game.startBattle([
|
||||
Species.ZEKROM,
|
||||
Species.ZEKROM
|
||||
]);
|
||||
|
||||
const party = game.scene.getParty();
|
||||
const enemyParty = game.scene.getEnemyParty();
|
||||
|
||||
// Get rid of any modifiers that may alter power
|
||||
game.scene.clearEnemyHeldItemModifiers();
|
||||
game.scene.clearEnemyModifiers();
|
||||
|
||||
// Mock stats by replacing entries in copy with desired values for specific stats
|
||||
const stats = {
|
||||
enemy: [
|
||||
[...enemyParty[0].stats],
|
||||
[...enemyParty[1].stats],
|
||||
],
|
||||
player: [
|
||||
[...party[0].stats],
|
||||
[...party[1].stats],
|
||||
]
|
||||
};
|
||||
|
||||
// Ensure survival by reducing enemy Sp. Atk and boosting party Sp. Def
|
||||
vi.spyOn(enemyParty[0], "stats", "get").mockReturnValue(stats.enemy[0].map((val, i) => (i === Stat.SPATK ? 1 : val)));
|
||||
vi.spyOn(enemyParty[1], "stats", "get").mockReturnValue(stats.enemy[1].map((val, i) => (i === Stat.SPATK ? 1 : val)));
|
||||
vi.spyOn(party[1], "stats", "get").mockReturnValue(stats.player[0].map((val, i) => (i === Stat.SPDEF ? 250 : val)));
|
||||
vi.spyOn(party[1], "stats", "get").mockReturnValue(stats.player[1].map((val, i) => (i === Stat.SPDEF ? 250 : val)));
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionBolt.id));
|
||||
game.doSelectTarget(BattlerIndex.ENEMY);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionBolt.id));
|
||||
game.doSelectTarget(BattlerIndex.ENEMY);
|
||||
|
||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||
|
||||
// Force first enemy to act in between party
|
||||
vi.spyOn(game.scene.getCurrentPhase() as TurnStartPhase, "getOrder").mockReturnValue([ BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY ]);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionBolt.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionFlare.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionBolt.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionFlare.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
|
||||
}, 20000);
|
||||
|
||||
it("FUSION_FLARE and FUSION_BOLT alternating throughout turn should double power of subsequent moves if moves are aimed at allies", async() => {
|
||||
vi.spyOn(overrides, "OPP_MOVESET_OVERRIDE", "get").mockReturnValue([ fusionFlare.id, fusionFlare.id, fusionFlare.id, fusionFlare.id ]);
|
||||
await game.startBattle([
|
||||
Species.ZEKROM,
|
||||
Species.ZEKROM
|
||||
]);
|
||||
|
||||
const party = game.scene.getParty();
|
||||
const enemyParty = game.scene.getEnemyParty();
|
||||
|
||||
// Get rid of any modifiers that may alter power
|
||||
game.scene.clearEnemyHeldItemModifiers();
|
||||
game.scene.clearEnemyModifiers();
|
||||
|
||||
// Mock stats by replacing entries in copy with desired values for specific stats
|
||||
const stats = {
|
||||
enemy: [
|
||||
[...enemyParty[0].stats],
|
||||
[...enemyParty[1].stats],
|
||||
],
|
||||
player: [
|
||||
[...party[0].stats],
|
||||
[...party[1].stats],
|
||||
]
|
||||
};
|
||||
|
||||
// Ensure survival by reducing enemy Sp. Atk and boosting party Sp. Def
|
||||
vi.spyOn(enemyParty[0], "stats", "get").mockReturnValue(stats.enemy[0].map((val, i) => (i === Stat.SPATK ? 1 : val)));
|
||||
vi.spyOn(enemyParty[1], "stats", "get").mockReturnValue(stats.enemy[1].map((val, i) => (i === Stat.SPATK ? 1 : val)));
|
||||
vi.spyOn(party[1], "stats", "get").mockReturnValue(stats.player[0].map((val, i) => (i === Stat.SPDEF ? 250 : val)));
|
||||
vi.spyOn(party[1], "stats", "get").mockReturnValue(stats.player[1].map((val, i) => (i === Stat.SPDEF ? 250 : val)));
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionBolt.id));
|
||||
game.doSelectTarget(BattlerIndex.PLAYER_2);
|
||||
|
||||
game.doAttack(getMovePosition(game.scene, 0, fusionBolt.id));
|
||||
game.doSelectTarget(BattlerIndex.PLAYER);
|
||||
|
||||
await game.phaseInterceptor.to(TurnStartPhase, false);
|
||||
|
||||
// Force first enemy to act in between party
|
||||
vi.spyOn(game.scene.getCurrentPhase() as TurnStartPhase, "getOrder").mockReturnValue([ BattlerIndex.PLAYER, BattlerIndex.ENEMY_2, BattlerIndex.PLAYER_2, BattlerIndex.ENEMY ]);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionBolt.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(100);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionFlare.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionBolt.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionBolt.calculateBattlePower).toHaveLastReturnedWith(200);
|
||||
|
||||
await game.phaseInterceptor.to(MoveEffectPhase, false);
|
||||
expect((game.scene.getCurrentPhase() as MoveEffectPhase).move.moveId).toBe(fusionFlare.id);
|
||||
await game.phaseInterceptor.to(DamagePhase, false);
|
||||
expect(fusionFlare.calculateBattlePower).toHaveLastReturnedWith(200);
|
||||
}, 20000);
|
||||
});
|
Loading…
Reference in New Issue