mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-23 15:59:26 +02:00
Integration tests + Infiltrator is (P) again
This commit is contained in:
parent
9faceaabf7
commit
d5540961b9
@ -5329,7 +5329,8 @@ export function initAbilities() {
|
|||||||
.attr(PostSummonTransformAbAttr)
|
.attr(PostSummonTransformAbAttr)
|
||||||
.attr(UncopiableAbilityAbAttr),
|
.attr(UncopiableAbilityAbAttr),
|
||||||
new Ability(Abilities.INFILTRATOR, 5)
|
new Ability(Abilities.INFILTRATOR, 5)
|
||||||
.attr(InfiltratorAbAttr),
|
.attr(InfiltratorAbAttr)
|
||||||
|
.partial(), // does not bypass Mist
|
||||||
new Ability(Abilities.MUMMY, 5)
|
new Ability(Abilities.MUMMY, 5)
|
||||||
.attr(PostDefendAbilityGiveAbAttr, Abilities.MUMMY)
|
.attr(PostDefendAbilityGiveAbAttr, Abilities.MUMMY)
|
||||||
.bypassFaint(),
|
.bypassFaint(),
|
||||||
|
@ -97,11 +97,15 @@ export class MistTag extends ArenaTag {
|
|||||||
args[1] as Utils.BooleanHolder
|
args[1] as Utils.BooleanHolder
|
||||||
];
|
];
|
||||||
|
|
||||||
const bypassed = new Utils.BooleanHolder(false);
|
// `StatStageChangePhase` currently doesn't have a reference to the source of stat drops,
|
||||||
// TODO: Allow this to be simulated
|
// so this code currently has no effect on gameplay.
|
||||||
applyAbAttrs(InfiltratorAbAttr, attacker, null, false, bypassed);
|
if (attacker) {
|
||||||
if (bypassed.value) {
|
const bypassed = new Utils.BooleanHolder(false);
|
||||||
return false;
|
// TODO: Allow this to be simulated
|
||||||
|
applyAbAttrs(InfiltratorAbAttr, attacker, null, false, bypassed);
|
||||||
|
if (bypassed.value) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelled.value = true;
|
cancelled.value = true;
|
||||||
@ -146,13 +150,19 @@ export class WeakenMoveScreenTag extends ArenaTag {
|
|||||||
* @returns True if the move was weakened, otherwise false.
|
* @returns True if the move was weakened, otherwise false.
|
||||||
*/
|
*/
|
||||||
apply(arena: Arena, args: any[]): boolean {
|
apply(arena: Arena, args: any[]): boolean {
|
||||||
const attacker = args[0] as Pokemon;
|
// TODO: replace this with safer type inference
|
||||||
|
const [ attacker, moveCategory, isDoubleBattle, damageMultiplier ] = [
|
||||||
|
args[0] as Pokemon,
|
||||||
|
args[1] as MoveCategory,
|
||||||
|
args[2] as boolean,
|
||||||
|
args[3] as Utils.NumberHolder
|
||||||
|
];
|
||||||
const bypassed = new Utils.BooleanHolder(false);
|
const bypassed = new Utils.BooleanHolder(false);
|
||||||
// TODO: allow this to be simulated
|
// TODO: allow this to be simulated
|
||||||
applyAbAttrs(InfiltratorAbAttr, attacker, null, false, bypassed);
|
applyAbAttrs(InfiltratorAbAttr, attacker, null, false, bypassed);
|
||||||
|
|
||||||
if (!bypassed.value && this.weakenedCategories.includes((args[0] as MoveCategory))) {
|
if (!bypassed.value && this.weakenedCategories.includes(moveCategory)) {
|
||||||
(args[2] as Utils.NumberHolder).value = (args[1] as boolean) ? 2732 / 4096 : 0.5;
|
damageMultiplier.value = isDoubleBattle ? 2732 / 4096 : 0.5;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -2594,7 +2594,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
|
|
||||||
/** Reduces damage if this Pokemon has a relevant screen (e.g. Light Screen for special attacks) */
|
/** Reduces damage if this Pokemon has a relevant screen (e.g. Light Screen for special attacks) */
|
||||||
const screenMultiplier = new Utils.NumberHolder(1);
|
const screenMultiplier = new Utils.NumberHolder(1);
|
||||||
this.scene.arena.applyTagsForSide(WeakenMoveScreenTag, defendingSide, move.category, this.scene.currentBattle.double, screenMultiplier);
|
this.scene.arena.applyTagsForSide(WeakenMoveScreenTag, defendingSide, source, move.category, this.scene.currentBattle.double, screenMultiplier);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For each {@linkcode HitsTagAttr} the move has, doubles the damage of the move if:
|
* For each {@linkcode HitsTagAttr} the move has, doubles the damage of the move if:
|
||||||
|
@ -55,7 +55,8 @@ export class StatStageChangePhase extends PokemonPhase {
|
|||||||
|
|
||||||
if (!this.selfTarget && stages.value < 0) {
|
if (!this.selfTarget && stages.value < 0) {
|
||||||
// TODO: Include simulate boolean when tag applications can be simulated
|
// TODO: Include simulate boolean when tag applications can be simulated
|
||||||
this.scene.arena.applyTagsForSide(MistTag, pokemon.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY, cancelled);
|
// also TODO: add a reference to the source of the stat change to fix Infiltrator interaction
|
||||||
|
this.scene.arena.applyTagsForSide(MistTag, pokemon.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY, null, cancelled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cancelled.value && !this.selfTarget && stages.value < 0) {
|
if (!cancelled.value && !this.selfTarget && stages.value < 0) {
|
||||||
|
107
src/test/abilities/infiltrator.test.ts
Normal file
107
src/test/abilities/infiltrator.test.ts
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
import { ArenaTagSide } from "#app/data/arena-tag";
|
||||||
|
import { allMoves } from "#app/data/move";
|
||||||
|
import { ArenaTagType } from "#enums/arena-tag-type";
|
||||||
|
import { BattlerTagType } from "#enums/battler-tag-type";
|
||||||
|
import { Stat } from "#enums/stat";
|
||||||
|
import { StatusEffect } from "#enums/status-effect";
|
||||||
|
import { Abilities } from "#enums/abilities";
|
||||||
|
import { Moves } from "#enums/moves";
|
||||||
|
import { Species } from "#enums/species";
|
||||||
|
import GameManager from "#test/utils/gameManager";
|
||||||
|
import Phaser from "phaser";
|
||||||
|
import { afterEach, beforeAll, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
|
describe("Abilities - Infiltrator", () => {
|
||||||
|
let phaserGame: Phaser.Game;
|
||||||
|
let game: GameManager;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
phaserGame = new Phaser.Game({
|
||||||
|
type: Phaser.HEADLESS,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
game.phaseInterceptor.restoreOg();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
game = new GameManager(phaserGame);
|
||||||
|
game.override
|
||||||
|
.moveset([ Moves.TACKLE, Moves.WATER_GUN, Moves.SPORE, Moves.BABY_DOLL_EYES ])
|
||||||
|
.ability(Abilities.INFILTRATOR)
|
||||||
|
.battleType("single")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.SNORLAX)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset(Moves.SPLASH)
|
||||||
|
.startingLevel(100)
|
||||||
|
.enemyLevel(100);
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
{ effectName: "Light Screen", tagType: ArenaTagType.LIGHT_SCREEN, move: Moves.WATER_GUN },
|
||||||
|
{ effectName: "Reflect", tagType: ArenaTagType.REFLECT, move: Moves.TACKLE },
|
||||||
|
{ effectName: "Aurora Veil", tagType: ArenaTagType.AURORA_VEIL, move: Moves.TACKLE }
|
||||||
|
])("should bypass the target's $effectName", async ({ tagType, move }) => {
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
const player = game.scene.getPlayerPokemon()!;
|
||||||
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
const preScreenDmg = enemy.getAttackDamage(player, allMoves[move]).damage;
|
||||||
|
|
||||||
|
game.scene.arena.addTag(tagType, 1, Moves.NONE, enemy.id, ArenaTagSide.ENEMY, true);
|
||||||
|
|
||||||
|
const postScreenDmg = enemy.getAttackDamage(player, allMoves[move]).damage;
|
||||||
|
|
||||||
|
expect(postScreenDmg).toBe(preScreenDmg);
|
||||||
|
expect(player.battleData.abilitiesApplied[0]).toBe(Abilities.INFILTRATOR);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should bypass the target's Safeguard", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
const player = game.scene.getPlayerPokemon()!;
|
||||||
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
game.scene.arena.addTag(ArenaTagType.SAFEGUARD, 1, Moves.NONE, enemy.id, ArenaTagSide.ENEMY, true);
|
||||||
|
|
||||||
|
game.move.select(Moves.SPORE);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("BerryPhase", false);
|
||||||
|
expect(enemy.status?.effect).toBe(StatusEffect.SLEEP);
|
||||||
|
expect(player.battleData.abilitiesApplied[0]).toBe(Abilities.INFILTRATOR);
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: fix this interaction to pass this test
|
||||||
|
it.skip("should bypass the target's Mist", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
const player = game.scene.getPlayerPokemon()!;
|
||||||
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
game.scene.arena.addTag(ArenaTagType.MIST, 1, Moves.NONE, enemy.id, ArenaTagSide.ENEMY, true);
|
||||||
|
|
||||||
|
game.move.select(Moves.BABY_DOLL_EYES);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
expect(enemy.getStatStage(Stat.ATK)).toBe(-1);
|
||||||
|
expect(player.battleData.abilitiesApplied[0]).toBe(Abilities.INFILTRATOR);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should bypass the target's Substitute", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.MAGIKARP ]);
|
||||||
|
|
||||||
|
const player = game.scene.getPlayerPokemon()!;
|
||||||
|
const enemy = game.scene.getEnemyPokemon()!;
|
||||||
|
|
||||||
|
enemy.addTag(BattlerTagType.SUBSTITUTE, 1, Moves.NONE, enemy.id);
|
||||||
|
|
||||||
|
game.move.select(Moves.BABY_DOLL_EYES);
|
||||||
|
|
||||||
|
await game.phaseInterceptor.to("MoveEndPhase");
|
||||||
|
expect(enemy.getStatStage(Stat.ATK)).toBe(-1);
|
||||||
|
expect(player.battleData.abilitiesApplied[0]).toBe(Abilities.INFILTRATOR);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user