mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-09 00:49:27 +02:00
Fixed tests and such
This commit is contained in:
parent
4885a6abc5
commit
314f46a22b
@ -1533,6 +1533,7 @@ export class CritOnlyAttr extends MoveAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Fix subclasses to actually extend from `getDamage`
|
||||||
export class FixedDamageAttr extends MoveAttr {
|
export class FixedDamageAttr extends MoveAttr {
|
||||||
private damage: number;
|
private damage: number;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Status } from "#data/status-effect";
|
import { Status } from "#data/status-effect";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
|
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||||
import { BattlerTagType } from "#enums/battler-tag-type";
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
@ -104,27 +105,26 @@ describe("Abilities - SHIELDS DOWN", () => {
|
|||||||
expect(game.field.getPlayerPokemon().status).toBe(undefined);
|
expect(game.field.getPlayerPokemon().status).toBe(undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
// toxic spikes currently does not poison flying types when gravity is in effect
|
it("should be poisoned by toxic spikes when Gravity is active before changing forms", async () => {
|
||||||
test.todo("should become poisoned by toxic spikes when grounded", async () => {
|
|
||||||
game.override
|
|
||||||
.enemyMoveset([MoveId.GRAVITY, MoveId.TOXIC_SPIKES, MoveId.SPLASH])
|
|
||||||
.moveset([MoveId.GRAVITY, MoveId.SPLASH]);
|
|
||||||
|
|
||||||
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MINIOR]);
|
await game.classicMode.startBattle([SpeciesId.MAGIKARP, SpeciesId.MINIOR]);
|
||||||
|
|
||||||
// turn 1
|
// Change minior to core form in a state where it would revert on switch
|
||||||
game.move.select(MoveId.GRAVITY);
|
const minior = game.scene.getPlayerParty()[1];
|
||||||
await game.move.selectEnemyMove(MoveId.TOXIC_SPIKES);
|
minior.formIndex = redCoreForm;
|
||||||
|
|
||||||
|
game.move.use(MoveId.GRAVITY);
|
||||||
|
await game.move.forceEnemyMove(MoveId.TOXIC_SPIKES);
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
// turn 2
|
expect(game).toHaveArenaTag(ArenaTagType.GRAVITY);
|
||||||
|
|
||||||
game.doSwitchPokemon(1);
|
game.doSwitchPokemon(1);
|
||||||
await game.move.selectEnemyMove(MoveId.SPLASH);
|
|
||||||
await game.toNextTurn();
|
await game.toNextTurn();
|
||||||
|
|
||||||
expect(game.field.getPlayerPokemon().species.speciesId).toBe(SpeciesId.MINIOR);
|
expect(minior.species.speciesId).toBe(SpeciesId.MINIOR);
|
||||||
expect(game.field.getPlayerPokemon().species.formIndex).toBe(0);
|
expect(minior.formIndex).toBe(0);
|
||||||
expect(game.field.getPlayerPokemon().status?.effect).toBe(StatusEffect.POISON);
|
expect(minior.isGrounded()).toBe(true);
|
||||||
|
expect(minior).toHaveStatusEffect(StatusEffect.POISON);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("should ignore yawn", async () => {
|
test("should ignore yawn", async () => {
|
||||||
|
@ -48,14 +48,14 @@ describe("Moves - Fly and Bounce", () => {
|
|||||||
const player = game.field.getPlayerPokemon();
|
const player = game.field.getPlayerPokemon();
|
||||||
const enemy = game.field.getEnemyPokemon();
|
const enemy = game.field.getEnemyPokemon();
|
||||||
|
|
||||||
expect(player.getTag(BattlerTagType.FLYING)).toBeDefined();
|
expect(player).toHaveBattlerTag(BattlerTagType.FLYING);
|
||||||
expect(enemy.getLastXMoves(1)[0].result).toBe(MoveResult.MISS);
|
expect(enemy.getLastXMoves(1)[0].result).toBe(MoveResult.MISS);
|
||||||
expect(player.hp).toBe(player.getMaxHp());
|
expect(player.hp).toBe(player.getMaxHp());
|
||||||
expect(enemy.hp).toBe(enemy.getMaxHp());
|
expect(enemy.hp).toBe(enemy.getMaxHp());
|
||||||
expect(player.getMoveQueue()[0].move).toBe(MoveId.FLY);
|
expect(player.getMoveQueue()[0].move).toBe(MoveId.FLY);
|
||||||
|
|
||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
expect(player.getTag(BattlerTagType.FLYING)).toBeUndefined();
|
expect(player).not.toHaveBattlerTag(BattlerTagType.FLYING);
|
||||||
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
expect(enemy.hp).toBeLessThan(enemy.getMaxHp());
|
||||||
expect(player.getMoveHistory()).toHaveLength(2);
|
expect(player.getMoveHistory()).toHaveLength(2);
|
||||||
|
|
||||||
@ -63,6 +63,7 @@ describe("Moves - Fly and Bounce", () => {
|
|||||||
expect(playerFly?.ppUsed).toBe(1);
|
expect(playerFly?.ppUsed).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: Move to a No Guard test file
|
||||||
it("should not allow the user to evade attacks from Pokemon with No Guard", async () => {
|
it("should not allow the user to evade attacks from Pokemon with No Guard", async () => {
|
||||||
game.override.enemyAbility(AbilityId.NO_GUARD);
|
game.override.enemyAbility(AbilityId.NO_GUARD);
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ describe("Moves - Fly and Bounce", () => {
|
|||||||
const playerPokemon = game.field.getPlayerPokemon();
|
const playerPokemon = game.field.getPlayerPokemon();
|
||||||
const enemyPokemon = game.field.getEnemyPokemon();
|
const enemyPokemon = game.field.getEnemyPokemon();
|
||||||
|
|
||||||
game.move.select(MoveId.FLY);
|
game.move.use(MoveId.FLY);
|
||||||
|
|
||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
expect(playerPokemon.hp).toBeLessThan(playerPokemon.getMaxHp());
|
expect(playerPokemon.hp).toBeLessThan(playerPokemon.getMaxHp());
|
||||||
@ -85,10 +86,10 @@ describe("Moves - Fly and Bounce", () => {
|
|||||||
|
|
||||||
const playerPokemon = game.field.getPlayerPokemon();
|
const playerPokemon = game.field.getPlayerPokemon();
|
||||||
|
|
||||||
game.move.select(MoveId.FLY);
|
game.move.use(MoveId.FLY);
|
||||||
|
|
||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
expect(playerPokemon.getTag(BattlerTagType.FLYING)).toBeUndefined();
|
expect(playerPokemon).not.toHaveBattlerTag(BattlerTagType.FLYING);
|
||||||
expect(playerPokemon.status?.effect).toBe(StatusEffect.SLEEP);
|
expect(playerPokemon.status?.effect).toBe(StatusEffect.SLEEP);
|
||||||
|
|
||||||
const playerFly = playerPokemon.getMoveset().find(mv => mv && mv.moveId === MoveId.FLY);
|
const playerFly = playerPokemon.getMoveset().find(mv => mv && mv.moveId === MoveId.FLY);
|
||||||
@ -110,13 +111,13 @@ describe("Moves - Fly and Bounce", () => {
|
|||||||
|
|
||||||
// Bounce should've worked until hit
|
// Bounce should've worked until hit
|
||||||
const azurill = game.field.getPlayerPokemon();
|
const azurill = game.field.getPlayerPokemon();
|
||||||
expect(azurill.getTag(BattlerTagType.FLYING)).toBeDefined();
|
expect(azurill).toHaveBattlerTag(BattlerTagType.FLYING);
|
||||||
expect(azurill.getTag(BattlerTagType.IGNORE_FLYING)).toBeUndefined();
|
expect(azurill).not.toHaveBattlerTag(BattlerTagType.IGNORE_FLYING);
|
||||||
|
|
||||||
await game.phaseInterceptor.to("MoveEndPhase");
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
|
||||||
expect(azurill.getTag(BattlerTagType.FLYING)).toBeUndefined();
|
expect(azurill).not.toHaveBattlerTag(BattlerTagType.FLYING);
|
||||||
expect(azurill.getTag(BattlerTagType.IGNORE_FLYING)).toBeDefined();
|
expect(azurill).toHaveBattlerTag(BattlerTagType.IGNORE_FLYING);
|
||||||
expect(azurill.getMoveQueue()).toHaveLength(0);
|
expect(azurill.getMoveQueue()).toHaveLength(0);
|
||||||
expect(azurill.visible).toBe(true);
|
expect(azurill.visible).toBe(true);
|
||||||
if (move !== MoveId.GRAVITY) {
|
if (move !== MoveId.GRAVITY) {
|
||||||
|
@ -46,10 +46,9 @@ describe("Moves - Smack Down and Thousand Arrows", () => {
|
|||||||
expect(enemy.isGrounded()).toBe(false);
|
expect(enemy.isGrounded()).toBe(false);
|
||||||
|
|
||||||
game.move.use(move);
|
game.move.use(move);
|
||||||
await game.phaseInterceptor.to("MoveEffectPhase", false);
|
|
||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
expect(enemy.getTag(BattlerTagType.IGNORE_FLYING)).toBeDefined();
|
expect(enemy).toHaveBattlerTag(BattlerTagType.IGNORE_FLYING);
|
||||||
expect(enemy.isGrounded()).toBe(true);
|
expect(enemy.isGrounded()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -61,45 +60,33 @@ describe("Moves - Smack Down and Thousand Arrows", () => {
|
|||||||
expect(eelektross.isGrounded()).toBe(false);
|
expect(eelektross.isGrounded()).toBe(false);
|
||||||
|
|
||||||
game.move.use(MoveId.THOUSAND_ARROWS);
|
game.move.use(MoveId.THOUSAND_ARROWS);
|
||||||
await game.phaseInterceptor.to("MoveEffectPhase", false);
|
|
||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
expect(eelektross.getTag(BattlerTagType.IGNORE_FLYING)).toBeDefined();
|
expect(eelektross).toHaveBattlerTag(BattlerTagType.IGNORE_FLYING);
|
||||||
expect(eelektross.hp).toBeLessThan(eelektross.getMaxHp());
|
expect(eelektross.hp).toBeLessThan(eelektross.getMaxHp());
|
||||||
expect(eelektross.isGrounded()).toBe(true);
|
expect(eelektross.isGrounded()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
{ name: "Telekinesis", move: MoveId.TELEKINESIS, tags: [BattlerTagType.TELEKINESIS, BattlerTagType.FLOATING] },
|
{ name: "TELEKINESIS", tag: BattlerTagType.TELEKINESIS },
|
||||||
{ name: "Magnet Rise", move: MoveId.MAGNET_RISE, tags: [BattlerTagType.FLOATING] },
|
{ name: "FLOATING", tag: BattlerTagType.FLOATING },
|
||||||
])("should cancel the ungrounding effects of $name", async ({ move, tags }) => {
|
])("should cancel the effects of BattlerTagType.$name", async ({ tag }) => {
|
||||||
await game.classicMode.startBattle([SpeciesId.ILLUMISE]);
|
await game.classicMode.startBattle([SpeciesId.ILLUMISE]);
|
||||||
|
|
||||||
game.move.use(MoveId.SMACK_DOWN);
|
|
||||||
await game.move.forceEnemyMove(move);
|
|
||||||
await game.setTurnOrder([BattlerIndex.ENEMY, BattlerIndex.PLAYER]);
|
|
||||||
await game.phaseInterceptor.to("MoveEndPhase");
|
|
||||||
|
|
||||||
// ensure move suceeeded before getting knocked down
|
|
||||||
const eelektross = game.field.getEnemyPokemon();
|
const eelektross = game.field.getEnemyPokemon();
|
||||||
tags.forEach(t => {
|
eelektross.addTag(tag);
|
||||||
expect(eelektross.getTag(t)).toBeDefined();
|
|
||||||
});
|
|
||||||
expect(eelektross.isGrounded()).toBe(false);
|
|
||||||
|
|
||||||
|
game.move.use(MoveId.SMACK_DOWN);
|
||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
tags.forEach(t => {
|
expect(eelektross).not.toHaveBattlerTag(tag);
|
||||||
expect(eelektross.getTag(t)).toBeUndefined();
|
expect(eelektross).toHaveBattlerTag(BattlerTagType.IGNORE_FLYING);
|
||||||
});
|
|
||||||
expect(eelektross.hp).toBeLessThan(eelektross.getMaxHp());
|
|
||||||
expect(eelektross.getTag(BattlerTagType.IGNORE_FLYING)).toBeDefined();
|
|
||||||
expect(eelektross.isGrounded()).toBe(false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// NB: This test might sound useless, but semi-invulnerable pokemon are technically considered "ungrounded"
|
// NB: This test might sound useless, but semi-invulnerable pokemon are technically considered "ungrounded"
|
||||||
// by most things
|
// by most things
|
||||||
it("should not ground semi-invulnerable targets unless already ungrounded", async () => {
|
it("should not ground semi-invulnerable targets hit via No Guard unless already ungrounded", async () => {
|
||||||
|
game.override.ability(AbilityId.NO_GUARD);
|
||||||
await game.classicMode.startBattle([SpeciesId.ILLUMISE]);
|
await game.classicMode.startBattle([SpeciesId.ILLUMISE]);
|
||||||
|
|
||||||
game.move.use(MoveId.THOUSAND_ARROWS);
|
game.move.use(MoveId.THOUSAND_ARROWS);
|
||||||
@ -110,7 +97,7 @@ describe("Moves - Smack Down and Thousand Arrows", () => {
|
|||||||
// Eelektross took damage but was not forcibly grounded
|
// Eelektross took damage but was not forcibly grounded
|
||||||
const eelektross = game.field.getEnemyPokemon();
|
const eelektross = game.field.getEnemyPokemon();
|
||||||
expect(eelektross.isGrounded()).toBe(true);
|
expect(eelektross.isGrounded()).toBe(true);
|
||||||
expect(eelektross.getTag(BattlerTagType.IGNORE_FLYING)).toBeUndefined();
|
expect(eelektross).not.toHaveBattlerTag(BattlerTagType.IGNORE_FLYING);
|
||||||
expect(eelektross.hp).toBeLessThan(eelektross.getMaxHp());
|
expect(eelektross.hp).toBeLessThan(eelektross.getMaxHp());
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -129,7 +116,7 @@ describe("Moves - Smack Down and Thousand Arrows", () => {
|
|||||||
await game.toEndOfTurn();
|
await game.toEndOfTurn();
|
||||||
|
|
||||||
expect(hitSpy).toHaveReturnedWith([expect.anything(), 1]);
|
expect(hitSpy).toHaveReturnedWith([expect.anything(), 1]);
|
||||||
expect(archeops.getTag(BattlerTagType.IGNORE_FLYING)).toBeDefined();
|
expect(archeops).toHaveBattlerTag(BattlerTagType.IGNORE_FLYING);
|
||||||
expect(archeops.isGrounded()).toBe(true);
|
expect(archeops.isGrounded()).toBe(true);
|
||||||
expect(archeops.hp).toBeLessThan(archeops.getMaxHp());
|
expect(archeops.hp).toBeLessThan(archeops.getMaxHp());
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user