eslint fixes

This commit is contained in:
Christopher Schmidt 2024-10-04 19:00:24 -04:00
parent dfdbe133d6
commit 0ac69d1ee6
6 changed files with 22 additions and 24 deletions

View File

@ -569,7 +569,7 @@ export class InterruptedTag extends BattlerTag {
super.onAdd(pokemon); super.onAdd(pokemon);
pokemon.getMoveQueue().shift(); pokemon.getMoveQueue().shift();
pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.OTHER, targets: [] }); pokemon.pushMoveHistory({ move: Moves.NONE, result: MoveResult.OTHER, targets: []});
} }
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean { lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {

View File

@ -2577,7 +2577,7 @@ export class ChargeAttr extends OverrideMoveEffectAttr {
applyMoveAttrs(MoveEffectAttr, user, target, move); applyMoveAttrs(MoveEffectAttr, user, target, move);
} }
const isVirtual = args[1] as boolean; const isVirtual = args[1] as boolean;
user.pushMoveHistory({ move: move.id, targets: [ target.getBattlerIndex() ], result: MoveResult.OTHER}); user.pushMoveHistory({ move: move.id, targets: [ target.getBattlerIndex() ], result: MoveResult.OTHER });
user.getMoveQueue().push({ move: move.id, targets: [ target.getBattlerIndex() ], virtual: isVirtual }); user.getMoveQueue().push({ move: move.id, targets: [ target.getBattlerIndex() ], virtual: isVirtual });
user.addTag(BattlerTagType.CHARGING, 1, move.id, user.id); user.addTag(BattlerTagType.CHARGING, 1, move.id, user.id);
resolve(true); resolve(true);
@ -5811,7 +5811,7 @@ export class RandomMovesetMoveAttr extends CallMoveAttr {
if (this.includeParty) { if (this.includeParty) {
allies = user.isPlayer() ? user.scene.getParty() : user.scene.getEnemyParty(); allies = user.isPlayer() ? user.scene.getParty() : user.scene.getEnemyParty();
} else { } else {
allies = [user]; allies = [ user ];
} }
const partyMoveset = allies.map(p => p.moveset).flat(); const partyMoveset = allies.map(p => p.moveset).flat();
const moves = partyMoveset.filter(m => !this.invalidMoves.includes(m!.moveId) && !m!.getMove().name.endsWith(" (N)")); const moves = partyMoveset.filter(m => !this.invalidMoves.includes(m!.moveId) && !m!.getMove().name.endsWith(" (N)"));

View File

@ -1,5 +1,4 @@
import { SemiInvulnerableTag } from "#app/data/battler-tags"; import { SemiInvulnerableTag } from "#app/data/battler-tags";
import { getMoveTargets } from "#app/data/move";
import { Abilities } from "#app/enums/abilities"; import { Abilities } from "#app/enums/abilities";
import { Stat } from "#app/enums/stat"; import { Stat } from "#app/enums/stat";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
@ -25,7 +24,7 @@ describe("Moves - Metronome", () => {
beforeEach(() => { beforeEach(() => {
game = new GameManager(phaserGame); game = new GameManager(phaserGame);
game.override game.override
.moveset([Moves.METRONOME, Moves.SPLASH]) .moveset([ Moves.METRONOME, Moves.SPLASH ])
.battleType("single") .battleType("single")
.startingLevel(100) .startingLevel(100)
.starterSpecies(Species.REGIELEKI) .starterSpecies(Species.REGIELEKI)
@ -81,7 +80,7 @@ describe("Moves - Metronome", () => {
it("should only target ally for Aromatic Mist", async () => { it("should only target ally for Aromatic Mist", async () => {
game.override.battleType("double"); game.override.battleType("double");
await game.classicMode.startBattle([Species.REGIELEKI, Species.RATTATA]); await game.classicMode.startBattle([ Species.REGIELEKI, Species.RATTATA ]);
const [ leftPlayer, rightPlayer ] = game.scene.getPlayerField(); const [ leftPlayer, rightPlayer ] = game.scene.getPlayerField();
const [ leftOpp, rightOpp ] = game.scene.getEnemyField(); const [ leftOpp, rightOpp ] = game.scene.getEnemyField();
vi.spyOn(leftPlayer, "randSeedInt").mockReturnValue(Moves.AROMATIC_MIST); vi.spyOn(leftPlayer, "randSeedInt").mockReturnValue(Moves.AROMATIC_MIST);
@ -98,16 +97,15 @@ describe("Moves - Metronome", () => {
expect(rightOpp.getStatStage(Stat.SPDEF)).toBe(0); expect(rightOpp.getStatStage(Stat.SPDEF)).toBe(0);
}); });
it("should be able to target itself or its ally with Acupressure", {repeats: 20}, async () => { // it("should be able to target itself or its ally with Acupressure", { repeats: 20 }, async () => {
game.override.battleType("double"); // game.override.battleType("double");
await game.classicMode.startBattle([Species.REGIELEKI, Species.RATTATA]); // await game.classicMode.startBattle([ Species.REGIELEKI, Species.RATTATA ]);
const [ leftPlayer, rightPlayer ] = game.scene.getPlayerField(); // vi.spyOn(leftPlayer, "randSeedInt").mockReturnValue(Moves.ACUPRESSURE);
vi.spyOn(leftPlayer, "randSeedInt").mockReturnValue(Moves.ACUPRESSURE);
// game.move.select(Moves.METRONOME); // // game.move.select(Moves.METRONOME);
// game.move.select(Moves.SPLASH, 1); // // game.move.select(Moves.SPLASH, 1);
// await game.phaseInterceptor.to("MoveEffectPhase"); // // await game.phaseInterceptor.to("MoveEffectPhase");
// await game.move.forceHit(); // // await game.move.forceHit();
// await game.toNextTurn(); // // await game.toNextTurn();
}); // });
}); });

View File

@ -124,7 +124,7 @@ describe("Moves - Spit Up", () => {
game.move.select(Moves.SPIT_UP); game.move.select(Moves.SPIT_UP);
await game.phaseInterceptor.to(TurnInitPhase); await game.phaseInterceptor.to(TurnInitPhase);
expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SPIT_UP, result: MoveResult.FAIL, targets: [ game.scene.getEnemyPokemon()!.getBattlerIndex() ] }); expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SPIT_UP, result: MoveResult.FAIL, targets: [ game.scene.getEnemyPokemon()!.getBattlerIndex() ]});
expect(spitUp.calculateBattlePower).not.toHaveBeenCalled(); expect(spitUp.calculateBattlePower).not.toHaveBeenCalled();
}); });
@ -147,7 +147,7 @@ describe("Moves - Spit Up", () => {
await game.phaseInterceptor.to(TurnInitPhase); await game.phaseInterceptor.to(TurnInitPhase);
expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SPIT_UP, result: MoveResult.SUCCESS, targets: [ game.scene.getEnemyPokemon()!.getBattlerIndex() ] }); expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SPIT_UP, result: MoveResult.SUCCESS, targets: [ game.scene.getEnemyPokemon()!.getBattlerIndex() ]});
expect(spitUp.calculateBattlePower).toHaveBeenCalledOnce(); expect(spitUp.calculateBattlePower).toHaveBeenCalledOnce();
@ -175,7 +175,7 @@ describe("Moves - Spit Up", () => {
game.move.select(Moves.SPIT_UP); game.move.select(Moves.SPIT_UP);
await game.phaseInterceptor.to(TurnInitPhase); await game.phaseInterceptor.to(TurnInitPhase);
expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SPIT_UP, result: MoveResult.SUCCESS, targets: [ game.scene.getEnemyPokemon()!.getBattlerIndex() ] }); expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SPIT_UP, result: MoveResult.SUCCESS, targets: [ game.scene.getEnemyPokemon()!.getBattlerIndex() ]});
expect(spitUp.calculateBattlePower).toHaveBeenCalledOnce(); expect(spitUp.calculateBattlePower).toHaveBeenCalledOnce();

View File

@ -71,7 +71,7 @@ describe("Moves - Stockpile", () => {
expect(user.getStatStage(Stat.SPDEF)).toBe(3); expect(user.getStatStage(Stat.SPDEF)).toBe(3);
expect(stockpilingTag).toBeDefined(); expect(stockpilingTag).toBeDefined();
expect(stockpilingTag.stockpiledCount).toBe(3); expect(stockpilingTag.stockpiledCount).toBe(3);
expect(user.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ result: MoveResult.FAIL, move: Moves.STOCKPILE, targets: [ user.getBattlerIndex() ] }); expect(user.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ result: MoveResult.FAIL, move: Moves.STOCKPILE, targets: [ user.getBattlerIndex() ]});
} }
} }
}); });

View File

@ -134,7 +134,7 @@ describe("Moves - Swallow", () => {
game.move.select(Moves.SWALLOW); game.move.select(Moves.SWALLOW);
await game.phaseInterceptor.to(TurnInitPhase); await game.phaseInterceptor.to(TurnInitPhase);
expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SWALLOW, result: MoveResult.FAIL, targets: [ pokemon.getBattlerIndex() ] }); expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SWALLOW, result: MoveResult.FAIL, targets: [ pokemon.getBattlerIndex() ]});
}); });
describe("restores stat stage boosts granted by stacks", () => { describe("restores stat stage boosts granted by stacks", () => {
@ -155,7 +155,7 @@ describe("Moves - Swallow", () => {
await game.phaseInterceptor.to(TurnInitPhase); await game.phaseInterceptor.to(TurnInitPhase);
expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SWALLOW, result: MoveResult.SUCCESS, targets: [ pokemon.getBattlerIndex() ] }); expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SWALLOW, result: MoveResult.SUCCESS, targets: [ pokemon.getBattlerIndex() ]});
expect(pokemon.getStatStage(Stat.DEF)).toBe(0); expect(pokemon.getStatStage(Stat.DEF)).toBe(0);
expect(pokemon.getStatStage(Stat.SPDEF)).toBe(0); expect(pokemon.getStatStage(Stat.SPDEF)).toBe(0);
@ -182,7 +182,7 @@ describe("Moves - Swallow", () => {
await game.phaseInterceptor.to(TurnInitPhase); await game.phaseInterceptor.to(TurnInitPhase);
expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SWALLOW, result: MoveResult.SUCCESS, targets: [ pokemon.getBattlerIndex() ] }); expect(pokemon.getMoveHistory().at(-1)).toMatchObject<TurnMove>({ move: Moves.SWALLOW, result: MoveResult.SUCCESS, targets: [ pokemon.getBattlerIndex() ]});
expect(pokemon.getStatStage(Stat.DEF)).toBe(1); expect(pokemon.getStatStage(Stat.DEF)).toBe(1);
expect(pokemon.getStatStage(Stat.SPDEF)).toBe(-2); expect(pokemon.getStatStage(Stat.SPDEF)).toBe(-2);