[P1] Fix crash caused by removing arena tags on a new catch (#4888)
This commit is contained in:
parent
e825e308f9
commit
33d8db73ef
|
@ -3101,10 +3101,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
lapseTag(tagType: BattlerTagType): boolean {
|
lapseTag(tagType: BattlerTagType): boolean {
|
||||||
const tags = this.summonData?.tags;
|
if (!this.summonData) {
|
||||||
if (isNullOrUndefined(tags)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
const tags = this.summonData.tags;
|
||||||
const tag = tags.find(t => t.tagType === tagType);
|
const tag = tags.find(t => t.tagType === tagType);
|
||||||
if (tag && !(tag.lapse(this, BattlerTagLapseType.CUSTOM))) {
|
if (tag && !(tag.lapse(this, BattlerTagLapseType.CUSTOM))) {
|
||||||
tag.onRemove(this);
|
tag.onRemove(this);
|
||||||
|
@ -3114,6 +3114,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
lapseTags(lapseType: BattlerTagLapseType): void {
|
lapseTags(lapseType: BattlerTagLapseType): void {
|
||||||
|
if (!this.summonData) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const tags = this.summonData.tags;
|
const tags = this.summonData.tags;
|
||||||
tags.filter(t => lapseType === BattlerTagLapseType.FAINT || ((t.lapseTypes.some(lType => lType === lapseType)) && !(t.lapse(this, lapseType)))).forEach(t => {
|
tags.filter(t => lapseType === BattlerTagLapseType.FAINT || ((t.lapseTypes.some(lType => lType === lapseType)) && !(t.lapse(this, lapseType)))).forEach(t => {
|
||||||
t.onRemove(this);
|
t.onRemove(this);
|
||||||
|
@ -3122,6 +3125,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeTag(tagType: BattlerTagType): boolean {
|
removeTag(tagType: BattlerTagType): boolean {
|
||||||
|
if (!this.summonData) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const tags = this.summonData.tags;
|
const tags = this.summonData.tags;
|
||||||
const tag = tags.find(t => t.tagType === tagType);
|
const tag = tags.find(t => t.tagType === tagType);
|
||||||
if (tag) {
|
if (tag) {
|
||||||
|
|
Loading…
Reference in New Issue