add retaliate test as draft

This commit is contained in:
Lylian 2024-08-11 23:30:47 +02:00
parent 60b237f424
commit c27ff58592
2 changed files with 69 additions and 4 deletions

View File

@ -7564,10 +7564,13 @@ export function initMoves() {
.attr(CopyTypeAttr),
new AttackMove(Moves.RETALIATE, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 5, -1, 0, 5)
.attr(MovePowerMultiplierAttr, (user, target, move) => (
user.scene.currentBattle.turn - user.scene.currentBattle.playerFaintsHistory.at(-1).turn === 1 &&
user instanceof PlayerPokemon ||
user.scene.currentBattle.turn - user.scene.currentBattle.enemyFaintsHistory.at(-1).turn === 1 &&
user instanceof EnemyPokemon) ? 2 : 1),
user.scene.currentBattle.playerFaintsHistory.at(-1) !== undefined &&
user.scene.currentBattle.turn - user.scene.currentBattle.playerFaintsHistory.at(-1)!.turn === 1 &&
user.isPlayer() ||
user.scene.currentBattle.enemyFaintsHistory.at(-1) !== undefined &&
user.scene.currentBattle.turn - user.scene.currentBattle.enemyFaintsHistory.at(-1)!.turn === 1 &&
!user.isPlayer()
) ? 2 : 1),
new AttackMove(Moves.FINAL_GAMBIT, Type.FIGHTING, MoveCategory.SPECIAL, -1, 100, 5, -1, 0, 5)
.attr(UserHpDamageAttr)
.attr(SacrificialAttrOnHit),

View File

@ -0,0 +1,62 @@
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
import Phaser from "phaser";
import GameManager from "#app/test/utils/gameManager";
import { Species } from "#enums/species";
import { Moves } from "#enums/moves";
import { getMovePosition } from "#app/test/utils/gameManagerUtils";
import { allMoves } from "#app/data/move.js";
describe("Moves - Retaliate", () => {
let phaserGame: Phaser.Game;
let game: GameManager;
const retaliate = allMoves[Moves.RETALIATE];
beforeAll(() => {
phaserGame = new Phaser.Game({
type: Phaser.HEADLESS,
});
});
afterEach(() => {
game.phaseInterceptor.restoreOg();
});
beforeEach(() => {
game = new GameManager(phaserGame);
game.override.battleType("single");
game.override.enemySpecies(Species.SNORLAX);
game.override.enemyMoveset([Moves.RETALIATE, Moves.RETALIATE, Moves.RETALIATE, Moves.RETALIATE]);
game.override.enemyLevel(100);
game.override.moveset([Moves.RETALIATE, Moves.SPLASH]);
game.override.startingHeldItems([{name: "WIDE_LENS", count: 3}]);
game.override.startingLevel(70);
game.override.disableCrits();
});
it("increases power if ally died previous turn", async () => {
await game.startBattle([Species.ABRA, Species.COBALION]);
game.doAttack(getMovePosition(game.scene, 0, Moves.SPLASH));
game.doSelectPartyPokemon(1);
await game.toNextTurn();
game.doAttack(getMovePosition(game.scene, 0, Moves.RETALIATE));
//await game.phaseInterceptor.to(DamagePhase);
console.log("ALLO1");
let snorlax = game.scene.getEnemyPokemon()!;
let cobalion = game.scene.getPlayerPokemon()!;
expect(cobalion.name).equals("Cobalion");
expect(retaliate.calculateBattlePower(cobalion, snorlax)).equals(140);
expect(retaliate.calculateBattlePower(snorlax, cobalion)).equals(70);
console.log(game.scene.getEnemyPokemon()!.hp);
console.log(game.scene.getPlayerPokemon()!.hp);
//await game.toNextTurn();
console.log("ALLO2");
game.doAttack(getMovePosition(game.scene, 0, Moves.RETALIATE));
snorlax = game.scene.getEnemyPokemon()!;
cobalion = game.scene.getPlayerPokemon()!;
expect(retaliate.calculateBattlePower(cobalion, snorlax)).equals(70);
expect(retaliate.calculateBattlePower(snorlax, cobalion)).equals(70);
});
});