Move canApplyAbility check

This commit is contained in:
Dean 2025-02-24 23:38:34 -08:00
parent d14f71d27a
commit eb84b04e16

View File

@ -5073,6 +5073,10 @@ function applySingleAbAttrs<TAttr extends AbAttr>(
showAbilityInstant: boolean = false,
messages: string[] = []
) {
if (!pokemon?.canApplyAbility(passive) || (passive && (pokemon.getPassiveAbility().id === pokemon.getAbility().id))) {
return;
}
const ability = passive ? pokemon.getPassiveAbility() : pokemon.getAbility();
if (gainedMidTurn && ability.getAttrs(attrType).some(attr => attr instanceof PostSummonAbAttr && !attr.shouldActivateOnGain())) {
return;
@ -5366,14 +5370,12 @@ function applyAbAttrsInternal<TAttr extends AbAttr>(
gainedMidTurn: boolean = false
) {
for (const passive of [ false, true ]) {
if (!pokemon?.canApplyAbility(passive) || (passive && (pokemon.getPassiveAbility().id === pokemon.getAbility().id))) {
continue;
}
if (pokemon) {
applySingleAbAttrs(pokemon, passive, attrType, applyFunc, args, gainedMidTurn, simulated, showAbilityInstant, messages);
globalScene.clearPhaseQueueSplice();
}
}
}
export function applyAbAttrs(
attrType: Constructor<AbAttr>,