mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 07:22:19 +02:00
Update removeTag to allow BOTH to be removed
Create handling for removal of either a specific side, or both sides.
This commit is contained in:
parent
81f2d150a6
commit
87770dd439
@ -518,13 +518,22 @@ export class Arena {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeTag(tagType: ArenaTagType, side: ArenaTagSide = ArenaTagSide.BOTH): 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 && t.side === side);
|
if(side == ArenaTagSide.BOTH){
|
||||||
if (tag) {
|
tags.filter(t => (t.tagType == tagType)).forEach(t => {
|
||||||
tag.onRemove(this);
|
t.onRemove(this);
|
||||||
tags.splice(tags.indexOf(tag), 1);
|
tags.splice(tags.indexOf(t), 1);
|
||||||
}
|
})
|
||||||
return !!tag;
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const tag = tags.find(t => t.tagType === tagType && t.side === side);
|
||||||
|
if (tag) {
|
||||||
|
tag.onRemove(this);
|
||||||
|
tags.splice(tags.indexOf(tag), 1);
|
||||||
|
}
|
||||||
|
return !!tag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAllTags(): void {
|
removeAllTags(): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user