mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-21 07:42:25 +02:00
Fix suppressed abilities not activated properly
This commit is contained in:
parent
04133c7e9b
commit
6fe6f7c9d8
@ -1230,10 +1230,12 @@ export class FairyLockTag extends ArenaTag {
|
||||
*/
|
||||
export class SuppressAbilitiesTag extends ArenaTag {
|
||||
private sourceCount: number;
|
||||
private beingRemoved: boolean;
|
||||
|
||||
constructor(sourceId: number) {
|
||||
super(ArenaTagType.NEUTRALIZING_GAS, 0, undefined, sourceId);
|
||||
this.sourceCount = 1;
|
||||
this.beingRemoved = false;
|
||||
}
|
||||
|
||||
public override onAdd(arena: Arena): void {
|
||||
@ -1267,6 +1269,7 @@ export class SuppressAbilitiesTag extends ArenaTag {
|
||||
}
|
||||
|
||||
public override onRemove(arena: Arena, quiet: boolean = false) {
|
||||
this.beingRemoved = true;
|
||||
if (!quiet) {
|
||||
globalScene.queueMessage(i18next.t("arenaTag:neutralizingGasOnRemove"));
|
||||
}
|
||||
@ -1282,6 +1285,10 @@ export class SuppressAbilitiesTag extends ArenaTag {
|
||||
public shouldApplyToSelf(): boolean {
|
||||
return this.sourceCount > 1;
|
||||
}
|
||||
|
||||
public isBeingRemoved() {
|
||||
return this.beingRemoved;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: swap `sourceMove` and `sourceId` and make `sourceMove` an optional parameter
|
||||
|
@ -1501,8 +1501,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
* Suppresses an ability and calls its onlose attributes
|
||||
*/
|
||||
public suppressAbility() {
|
||||
this.summonData.abilitySuppressed = true;
|
||||
[ true, false ].forEach((passive) => applyOnLoseAbAttrs(this, passive));
|
||||
this.summonData.abilitySuppressed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1563,7 +1563,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
||||
return false;
|
||||
}
|
||||
const suppressAbilitiesTag = arena.getTag(ArenaTagType.NEUTRALIZING_GAS) as SuppressAbilitiesTag;
|
||||
if (this.isOnField() && suppressAbilitiesTag) {
|
||||
if (this.isOnField() && suppressAbilitiesTag && !suppressAbilitiesTag.isBeingRemoved()) {
|
||||
const thisAbilitySuppressing = ability.hasAttr(PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr);
|
||||
const hasSuppressingAbility = this.hasAbilityWithAttr(PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr, false);
|
||||
// Neutralizing gas is up - suppress abilities unless they are unsuppressable or this pokemon is responsible for the gas
|
||||
|
Loading…
Reference in New Issue
Block a user