mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-03-06 18:09:10 +00:00
[Bug] Fix canApplyAbility check #5413
This commit is contained in:
parent
870bff0e6e
commit
2cc0ac90f8
@ -5152,6 +5152,10 @@ function applySingleAbAttrs<TAttr extends AbAttr>(
|
|||||||
showAbilityInstant: boolean = false,
|
showAbilityInstant: boolean = false,
|
||||||
messages: string[] = []
|
messages: string[] = []
|
||||||
) {
|
) {
|
||||||
|
if (!pokemon?.canApplyAbility(passive) || (passive && (pokemon.getPassiveAbility().id === pokemon.getAbility().id))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const ability = passive ? pokemon.getPassiveAbility() : pokemon.getAbility();
|
const ability = passive ? pokemon.getPassiveAbility() : pokemon.getAbility();
|
||||||
if (gainedMidTurn && ability.getAttrs(attrType).some(attr => attr instanceof PostSummonAbAttr && !attr.shouldActivateOnGain())) {
|
if (gainedMidTurn && ability.getAttrs(attrType).some(attr => attr instanceof PostSummonAbAttr && !attr.shouldActivateOnGain())) {
|
||||||
return;
|
return;
|
||||||
@ -5445,13 +5449,11 @@ function applyAbAttrsInternal<TAttr extends AbAttr>(
|
|||||||
gainedMidTurn: boolean = false
|
gainedMidTurn: boolean = false
|
||||||
) {
|
) {
|
||||||
for (const passive of [ false, true ]) {
|
for (const passive of [ false, true ]) {
|
||||||
if (!pokemon?.canApplyAbility(passive) || (passive && (pokemon.getPassiveAbility().id === pokemon.getAbility().id))) {
|
if (pokemon) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
applySingleAbAttrs(pokemon, passive, attrType, applyFunc, args, gainedMidTurn, simulated, showAbilityInstant, messages);
|
applySingleAbAttrs(pokemon, passive, attrType, applyFunc, args, gainedMidTurn, simulated, showAbilityInstant, messages);
|
||||||
globalScene.clearPhaseQueueSplice();
|
globalScene.clearPhaseQueueSplice();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function applyAbAttrs(
|
export function applyAbAttrs(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user