From 7cdf07c05049c06d02b03a1f665df2d764602c5a Mon Sep 17 00:00:00 2001 From: Reldnahc Date: Sun, 5 May 2024 00:27:46 -0500 Subject: [PATCH] have arena tags check their sides. (#447) * have arena traps check their sides. * make sure we check the right tags layers --- src/data/move.ts | 7 ++++--- src/field/arena.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 60e492deb..f5fc8e3eb 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -2876,7 +2876,7 @@ export class AddArenaTagAttr extends MoveEffectAttr { public tagType: ArenaTagType; public turnCount: integer; private failOnOverlap: boolean; - private selfSideTarget: boolean; + public selfSideTarget: boolean; constructor(tagType: ArenaTagType, turnCount?: integer, failOnOverlap: boolean = false, selfSideTarget: boolean = false) { super(true, MoveEffectTrigger.POST_APPLY, true); @@ -2909,9 +2909,10 @@ export class AddArenaTagAttr extends MoveEffectAttr { export class AddArenaTrapTagAttr extends AddArenaTagAttr { getCondition(): MoveConditionFunc { return (user, target, move) => { - if (move.category !== MoveCategory.STATUS || !user.scene.arena.getTag(this.tagType)) + const side = (this.selfSideTarget ? user : target).isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY; + if (move.category !== MoveCategory.STATUS || !user.scene.arena.getTagOnSide(this.tagType, side)) return true; - const tag = user.scene.arena.getTag(this.tagType) as ArenaTrapTag; + const tag = user.scene.arena.getTagOnSide(this.tagType, side) as ArenaTrapTag; return tag.layers < tag.maxLayers; }; } diff --git a/src/field/arena.ts b/src/field/arena.ts index 6026560c1..c27e42b89 100644 --- a/src/field/arena.ts +++ b/src/field/arena.ts @@ -492,7 +492,7 @@ export class Arena { } addTag(tagType: ArenaTagType, turnCount: integer, sourceMove: Moves, sourceId: integer, side: ArenaTagSide = ArenaTagSide.BOTH, targetIndex?: BattlerIndex): boolean { - const existingTag = this.getTag(tagType); + const existingTag = this.getTagOnSide(tagType, side); if (existingTag) { existingTag.onOverlap(this); return false;