mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-20 22:39:31 +02:00
wip set isTrapped to true and removed timedtrap
This commit is contained in:
parent
18450a744d
commit
dce3e1a7d2
@ -1203,35 +1203,14 @@ class GrassWaterPledgeTag extends ArenaTag {
|
||||
}
|
||||
|
||||
export class FairyLockTag extends ArenaTag {
|
||||
constructor(sourceId: number) {
|
||||
super(ArenaTagType.FAIRY_LOCK, 1, Moves.FAIRY_LOCK, sourceId);
|
||||
constructor(turnCount: number, sourceId: number) {
|
||||
super(ArenaTagType.FAIRY_LOCK, turnCount, 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
|
||||
@ -1293,7 +1272,7 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: number, sourceMove
|
||||
case ArenaTagType.GRASS_WATER_PLEDGE:
|
||||
return new GrassWaterPledgeTag(sourceId, side);
|
||||
case ArenaTagType.FAIRY_LOCK:
|
||||
return new FairyLockTag(sourceId);
|
||||
return new FairyLockTag(turnCount, sourceId);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -2776,25 +2776,6 @@ export class PowerTrickTag extends BattlerTag {
|
||||
pokemon.setStat(Stat.DEF, temp, false);
|
||||
}
|
||||
}
|
||||
|
||||
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.
|
||||
* @param sourceId - The ID of the pokemon adding the tag
|
||||
@ -2972,8 +2953,6 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: number, source
|
||||
return new TelekinesisTag(sourceMove);
|
||||
case BattlerTagType.POWER_TRICK:
|
||||
return new PowerTrickTag(sourceMove, sourceId);
|
||||
case BattlerTagType.TIMED_TRAP:
|
||||
return new TimedTrap(turnCount, sourceMove, sourceId);
|
||||
case BattlerTagType.NONE:
|
||||
default:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||
|
@ -9044,7 +9044,7 @@ export function initMoves() {
|
||||
.ignoresSubstitute()
|
||||
.ignoresProtect()
|
||||
.target(MoveTarget.BOTH_SIDES)
|
||||
.attr(AddArenaTagAttr, ArenaTagType.FAIRY_LOCK, 1, true)
|
||||
.attr(AddArenaTagAttr, ArenaTagType.FAIRY_LOCK, 2, true)
|
||||
.condition((user, target, move) => {
|
||||
const turnMove = user.getLastXMoves(1);
|
||||
return !turnMove.length || turnMove[0].move !== move.id || turnMove[0].result !== MoveResult.SUCCESS;
|
||||
|
@ -16,7 +16,6 @@ export enum BattlerTagType {
|
||||
AQUA_RING = "AQUA_RING",
|
||||
DROWSY = "DROWSY",
|
||||
TRAPPED = "TRAPPED",
|
||||
TIMED_TRAP = "TIMED_TRAP",
|
||||
BIND = "BIND",
|
||||
WRAP = "WRAP",
|
||||
FIRE_SPIN = "FIRE_SPIN",
|
||||
|
@ -1523,7 +1523,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
applyCheckTrappedAbAttrs(CheckTrappedAbAttr, opponent, trappedByAbility, this, trappedAbMessages, simulated)
|
||||
);
|
||||
|
||||
return (trappedByAbility.value || !!this.getTag(TrappedTag));
|
||||
const side = this.isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY;
|
||||
return (trappedByAbility.value || !!this.getTag(TrappedTag) || !!this.scene.arena.getTagOnSide(ArenaTagType.FAIRY_LOCK, side));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,5 @@
|
||||
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";
|
||||
@ -54,18 +53,15 @@ describe("Moves - Fairy Lock", () => {
|
||||
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();
|
||||
expect(playerPokemon[0].isTrapped()).toEqual(true);
|
||||
expect(playerPokemon[1].isTrapped()).toEqual(true);
|
||||
expect(enemyField[0].isTrapped()).toEqual(true);
|
||||
expect(enemyField[1].isTrapped()).toEqual(true);
|
||||
|
||||
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();
|
||||
expect(playerPokemon[0].isTrapped()).toEqual(false);
|
||||
expect(playerPokemon[1].isTrapped()).toEqual(false);
|
||||
expect(enemyField[0].isTrapped()).toEqual(false);
|
||||
expect(enemyField[1].isTrapped()).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user