[Bug] Fix message for StatusEffectImmunityAbAttr (#5701)

Use class var for getTriggerMessage
This commit is contained in:
Dean 2025-04-26 13:32:49 -07:00 committed by GitHub
parent 423bab1057
commit ab7d010a17
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3172,6 +3172,7 @@ export class PreSetStatusAbAttr extends AbAttr {
*/
export class PreSetStatusEffectImmunityAbAttr extends PreSetStatusAbAttr {
protected immuneEffects: StatusEffect[];
private lastEffect: StatusEffect;
/**
* @param immuneEffects - The status effects to which the Pokémon is immune.
@ -3197,6 +3198,7 @@ export class PreSetStatusEffectImmunityAbAttr extends PreSetStatusAbAttr {
*/
override applyPreSetStatus(pokemon: Pokemon, passive: boolean, simulated: boolean, effect: StatusEffect, cancelled: BooleanHolder, args: any[]): void {
cancelled.value = true;
this.lastEffect = effect;
}
getTriggerMessage(pokemon: Pokemon, abilityName: string, ...args: any[]): string {
@ -3204,7 +3206,7 @@ export class PreSetStatusEffectImmunityAbAttr extends PreSetStatusAbAttr {
i18next.t("abilityTriggers:statusEffectImmunityWithName", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),
abilityName,
statusEffectName: getStatusEffectDescriptor(args[0] as StatusEffect)
statusEffectName: getStatusEffectDescriptor(this.lastEffect)
}) :
i18next.t("abilityTriggers:statusEffectImmunity", {
pokemonNameWithAffix: getPokemonNameWithAffix(pokemon),