mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 22:39:31 +02:00
inital wip
This commit is contained in:
parent
414e0a5447
commit
18450a744d
@ -1202,6 +1202,38 @@ class GrassWaterPledgeTag extends ArenaTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class FairyLockTag extends ArenaTag {
|
||||||
|
constructor(sourceId: number) {
|
||||||
|
super(ArenaTagType.FAIRY_LOCK, 1, Moves.FAIRY_LOCK, sourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
onAdd(arena: Arena): void {
|
||||||
|
arena.scene.queueMessage(i18next.t("arenaTag:fairyLockOnAdd"));
|
||||||
|
}
|
||||||
|
|
||||||
|
onRemove(arena: Arena): void { }
|
||||||
|
|
||||||
|
lapse(arena: Arena): boolean {
|
||||||
|
// const lockedIn = [...arena.scene.getEnemyField(), ...arena.scene.getPlayerField()];
|
||||||
|
// lockedIn?.forEach((p: Pokemon) => {
|
||||||
|
// p.addTag(BattlerTagType.TIMED_TRAP, 1, Moves.FAIRY_LOCK, this.sourceId)
|
||||||
|
// });
|
||||||
|
// return super.lapse(arena);
|
||||||
|
|
||||||
|
const ret = super.lapse(arena);
|
||||||
|
|
||||||
|
if (!ret) {
|
||||||
|
const lockedIn = [ ...arena.scene.getEnemyField(), ...arena.scene.getPlayerField() ];
|
||||||
|
console.log(lockedIn);
|
||||||
|
lockedIn?.forEach((p: Pokemon) => {
|
||||||
|
p.addTag(BattlerTagType.TIMED_TRAP, 1, Moves.FAIRY_LOCK, this.sourceId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: swap `sourceMove` and `sourceId` and make `sourceMove` an optional parameter
|
// TODO: swap `sourceMove` and `sourceId` and make `sourceMove` an optional parameter
|
||||||
export function getArenaTag(tagType: ArenaTagType, turnCount: number, sourceMove: Moves | undefined, sourceId: number, targetIndex?: BattlerIndex, side: ArenaTagSide = ArenaTagSide.BOTH): ArenaTag | null {
|
export function getArenaTag(tagType: ArenaTagType, turnCount: number, sourceMove: Moves | undefined, sourceId: number, targetIndex?: BattlerIndex, side: ArenaTagSide = ArenaTagSide.BOTH): ArenaTag | null {
|
||||||
switch (tagType) {
|
switch (tagType) {
|
||||||
@ -1260,6 +1292,8 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: number, sourceMove
|
|||||||
return new WaterFirePledgeTag(sourceId, side);
|
return new WaterFirePledgeTag(sourceId, side);
|
||||||
case ArenaTagType.GRASS_WATER_PLEDGE:
|
case ArenaTagType.GRASS_WATER_PLEDGE:
|
||||||
return new GrassWaterPledgeTag(sourceId, side);
|
return new GrassWaterPledgeTag(sourceId, side);
|
||||||
|
case ArenaTagType.FAIRY_LOCK:
|
||||||
|
return new FairyLockTag(sourceId);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -2777,6 +2777,24 @@ export class PowerTrickTag extends BattlerTag {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class TimedTrap extends TrappedTag {
|
||||||
|
constructor(turnCount: number, sourceMove: Moves, sourceId: number) {
|
||||||
|
super(BattlerTagType.TRAPPED, BattlerTagLapseType.TURN_END, turnCount, sourceMove, sourceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
onAdd(pokemon: Pokemon): void {}
|
||||||
|
|
||||||
|
onRemove(pokemon: Pokemon): void {}
|
||||||
|
|
||||||
|
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||||
|
const ret = super.lapse(pokemon, lapseType);
|
||||||
|
if (!ret) {
|
||||||
|
pokemon.removeTag(BattlerTagType.TRAPPED);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Retrieves a {@linkcode BattlerTag} based on the provided tag type, turn count, source move, and source ID.
|
* Retrieves a {@linkcode BattlerTag} based on the provided tag type, turn count, source move, and source ID.
|
||||||
* @param sourceId - The ID of the pokemon adding the tag
|
* @param sourceId - The ID of the pokemon adding the tag
|
||||||
@ -2954,6 +2972,8 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
|
|||||||
return new TelekinesisTag(sourceMove);
|
return new TelekinesisTag(sourceMove);
|
||||||
case BattlerTagType.POWER_TRICK:
|
case BattlerTagType.POWER_TRICK:
|
||||||
return new PowerTrickTag(sourceMove, sourceId);
|
return new PowerTrickTag(sourceMove, sourceId);
|
||||||
|
case BattlerTagType.TIMED_TRAP:
|
||||||
|
return new TimedTrap(turnCount, sourceMove, sourceId);
|
||||||
case BattlerTagType.NONE:
|
case BattlerTagType.NONE:
|
||||||
default:
|
default:
|
||||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||||
|
@ -9042,8 +9042,13 @@ export function initMoves() {
|
|||||||
.target(MoveTarget.ALL_NEAR_OTHERS),
|
.target(MoveTarget.ALL_NEAR_OTHERS),
|
||||||
new StatusMove(Moves.FAIRY_LOCK, Type.FAIRY, -1, 10, -1, 0, 6)
|
new StatusMove(Moves.FAIRY_LOCK, Type.FAIRY, -1, 10, -1, 0, 6)
|
||||||
.ignoresSubstitute()
|
.ignoresSubstitute()
|
||||||
|
.ignoresProtect()
|
||||||
.target(MoveTarget.BOTH_SIDES)
|
.target(MoveTarget.BOTH_SIDES)
|
||||||
.unimplemented(),
|
.attr(AddArenaTagAttr, ArenaTagType.FAIRY_LOCK, 1, true)
|
||||||
|
.condition((user, target, move) => {
|
||||||
|
const turnMove = user.getLastXMoves(1);
|
||||||
|
return !turnMove.length || turnMove[0].move !== move.id || turnMove[0].result !== MoveResult.SUCCESS;
|
||||||
|
}),
|
||||||
new SelfStatusMove(Moves.KINGS_SHIELD, Type.STEEL, -1, 10, -1, 4, 6)
|
new SelfStatusMove(Moves.KINGS_SHIELD, Type.STEEL, -1, 10, -1, 4, 6)
|
||||||
.attr(ProtectAttr, BattlerTagType.KINGS_SHIELD)
|
.attr(ProtectAttr, BattlerTagType.KINGS_SHIELD)
|
||||||
.condition(failIfLastCondition),
|
.condition(failIfLastCondition),
|
||||||
|
@ -28,4 +28,5 @@ export enum ArenaTagType {
|
|||||||
FIRE_GRASS_PLEDGE = "FIRE_GRASS_PLEDGE",
|
FIRE_GRASS_PLEDGE = "FIRE_GRASS_PLEDGE",
|
||||||
WATER_FIRE_PLEDGE = "WATER_FIRE_PLEDGE",
|
WATER_FIRE_PLEDGE = "WATER_FIRE_PLEDGE",
|
||||||
GRASS_WATER_PLEDGE = "GRASS_WATER_PLEDGE",
|
GRASS_WATER_PLEDGE = "GRASS_WATER_PLEDGE",
|
||||||
|
FAIRY_LOCK = "FAIRY_LOCK",
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ export enum BattlerTagType {
|
|||||||
AQUA_RING = "AQUA_RING",
|
AQUA_RING = "AQUA_RING",
|
||||||
DROWSY = "DROWSY",
|
DROWSY = "DROWSY",
|
||||||
TRAPPED = "TRAPPED",
|
TRAPPED = "TRAPPED",
|
||||||
|
TIMED_TRAP = "TIMED_TRAP",
|
||||||
BIND = "BIND",
|
BIND = "BIND",
|
||||||
WRAP = "WRAP",
|
WRAP = "WRAP",
|
||||||
FIRE_SPIN = "FIRE_SPIN",
|
FIRE_SPIN = "FIRE_SPIN",
|
||||||
|
71
src/test/moves/fairy_lock.test.ts
Normal file
71
src/test/moves/fairy_lock.test.ts
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
import { ArenaTagSide } from "#app/data/arena-tag";
|
||||||
|
import { ArenaTagType } from "#app/enums/arena-tag-type";
|
||||||
|
import { BattlerTagType } from "#app/enums/battler-tag-type";
|
||||||
|
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("Moves - Fairy Lock", () => {
|
||||||
|
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.FAIRY_LOCK, Moves.SPLASH ])
|
||||||
|
.ability(Abilities.BALL_FETCH)
|
||||||
|
.battleType("double")
|
||||||
|
.disableCrits()
|
||||||
|
.enemySpecies(Species.MAGIKARP)
|
||||||
|
.enemyAbility(Abilities.BALL_FETCH)
|
||||||
|
.enemyMoveset([ Moves.SPLASH, Moves.U_TURN ]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Applies Fairy Lock tag for one turn, then apply Trapped tag for one turn", async () => {
|
||||||
|
await game.classicMode.startBattle([ Species.KLEFKI, Species.TYRUNT ]);
|
||||||
|
const playerPokemon = game.scene.getPlayerField();
|
||||||
|
const enemyField = game.scene.getEnemyField();
|
||||||
|
|
||||||
|
game.move.select(Moves.FAIRY_LOCK);
|
||||||
|
game.move.select(Moves.SPLASH, 1);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH, 1);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH, 1);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
expect(game.scene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, ArenaTagSide.PLAYER)).toBeDefined();
|
||||||
|
expect(game.scene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, ArenaTagSide.ENEMY)).toBeDefined();
|
||||||
|
|
||||||
|
await game.toNextTurn();
|
||||||
|
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
game.move.select(Moves.SPLASH);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH, 1);
|
||||||
|
await game.forceEnemyMove(Moves.SPLASH, 1);
|
||||||
|
await game.phaseInterceptor.to("BerryPhase");
|
||||||
|
expect(game.scene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, ArenaTagSide.PLAYER)).not.toBeDefined();
|
||||||
|
expect(game.scene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, ArenaTagSide.ENEMY)).not.toBeDefined();
|
||||||
|
|
||||||
|
expect(playerPokemon[0].getTag(BattlerTagType.TRAPPED)).toBeDefined();
|
||||||
|
expect(playerPokemon[1].getTag(BattlerTagType.TRAPPED)).toBeDefined();
|
||||||
|
expect(enemyField[0].getTag(BattlerTagType.TRAPPED)).toBeDefined();
|
||||||
|
expect(enemyField[1].getTag(BattlerTagType.TRAPPED)).toBeDefined();
|
||||||
|
|
||||||
|
await game.toNextTurn();
|
||||||
|
expect(playerPokemon[0].getTag(BattlerTagType.TRAPPED)).not.toBeDefined();
|
||||||
|
expect(playerPokemon[1].getTag(BattlerTagType.TRAPPED)).not.toBeDefined();
|
||||||
|
expect(enemyField[0].getTag(BattlerTagType.TRAPPED)).not.toBeDefined();
|
||||||
|
expect(enemyField[1].getTag(BattlerTagType.TRAPPED)).not.toBeDefined();
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user