mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 07:22:19 +02:00
Fixed tag logic for traps
Ensured side is being checked to allow a one-sided tag like Stealth Rocks to be set on both sides instead of failing when it's already set on the other.
This commit is contained in:
parent
fe09d131cc
commit
fbbf49620c
@ -479,7 +479,7 @@ export class Arena {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addTag(tagType: ArenaTagType, turnCount: integer, sourceMove: Moves, sourceId: integer, side: ArenaTagSide = ArenaTagSide.BOTH, targetIndex?: BattlerIndex): boolean {
|
addTag(tagType: ArenaTagType, turnCount: integer, sourceMove: Moves, sourceId: integer, side: ArenaTagSide = ArenaTagSide.BOTH, targetIndex?: BattlerIndex): boolean {
|
||||||
const existingTag = this.getTag(tagType);
|
const existingTag = this.getTag(tagType,side);
|
||||||
if (existingTag) {
|
if (existingTag) {
|
||||||
existingTag.onOverlap(this);
|
existingTag.onOverlap(this);
|
||||||
return false;
|
return false;
|
||||||
@ -492,8 +492,8 @@ export class Arena {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTag(tagType: ArenaTagType | { new(...args: any[]): ArenaTag }): ArenaTag {
|
getTag(tagType: ArenaTagType | { new(...args: any[]): ArenaTag }, side: ArenaTagSide = ArenaTagSide.BOTH): ArenaTag {
|
||||||
return this.getTagOnSide(tagType, ArenaTagSide.BOTH);
|
return this.getTagOnSide(tagType, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTagOnSide(tagType: ArenaTagType | { new(...args: any[]): ArenaTag }, side: ArenaTagSide): ArenaTag {
|
getTagOnSide(tagType: ArenaTagType | { new(...args: any[]): ArenaTag }, side: ArenaTagSide): ArenaTag {
|
||||||
@ -517,9 +517,9 @@ export class Arena {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
removeTag(tagType: ArenaTagType): boolean {
|
removeTag(tagType: ArenaTagType, side: ArenaTagSide = ArenaTagSide.BOTH): boolean {
|
||||||
const tags = this.tags;
|
const tags = this.tags;
|
||||||
const tag = tags.find(t => t.tagType === tagType);
|
const tag = tags.find(t => t.tagType === tagType && t.side === side);
|
||||||
if (tag) {
|
if (tag) {
|
||||||
tag.onRemove(this);
|
tag.onRemove(this);
|
||||||
tags.splice(tags.indexOf(tag), 1);
|
tags.splice(tags.indexOf(tag), 1);
|
||||||
@ -727,4 +727,4 @@ export class ArenaBase extends Phaser.GameObjects.Container {
|
|||||||
}, (this.scene as BattleScene).currentBattle?.waveIndex || 0, (this.scene as BattleScene).waveSeed);
|
}, (this.scene as BattleScene).currentBattle?.waveIndex || 0, (this.scene as BattleScene).waveSeed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user