have arena tags check their sides. (#447)
* have arena traps check their sides. * make sure we check the right tags layerspull/478/head
parent
dd76cbc7a2
commit
7cdf07c050
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue