Rework logic for defeat ability trigger
This commit is contained in:
parent
53c0d501cc
commit
d9ebf99cdd
|
@ -2979,12 +2979,17 @@ export class VictoryPhase extends PokemonPhase {
|
||||||
if (exp) {
|
if (exp) {
|
||||||
const partyMemberIndex = party.indexOf(expPartyMembers[pm]);
|
const partyMemberIndex = party.indexOf(expPartyMembers[pm]);
|
||||||
this.scene.unshiftPhase(expPartyMembers[pm].isOnField() ? new ExpPhase(this.scene, partyMemberIndex, exp) : new ShowPartyExpBarPhase(this.scene, partyMemberIndex, exp));
|
this.scene.unshiftPhase(expPartyMembers[pm].isOnField() ? new ExpPhase(this.scene, partyMemberIndex, exp) : new ShowPartyExpBarPhase(this.scene, partyMemberIndex, exp));
|
||||||
if (expPartyMembers[pm].isOnField())
|
|
||||||
applyPostVictoryAbAttrs(PostVictoryAbAttr, expPartyMembers[pm]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defeatedPokemon = this.getPokemon();
|
||||||
|
if (defeatedPokemon.turnData?.attacksReceived?.length) {
|
||||||
|
const defeatSource = this.scene.getPokemonById(defeatedPokemon.turnData.attacksReceived[0].sourceId);
|
||||||
|
if (defeatSource?.isOnField())
|
||||||
|
applyPostVictoryAbAttrs(PostVictoryAbAttr, defeatSource);
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.scene.getEnemyParty().find(p => this.scene.currentBattle.battleType ? !p?.isFainted(true) : p.isOnField())) {
|
if (!this.scene.getEnemyParty().find(p => this.scene.currentBattle.battleType ? !p?.isFainted(true) : p.isOnField())) {
|
||||||
this.scene.pushPhase(new BattleEndPhase(this.scene));
|
this.scene.pushPhase(new BattleEndPhase(this.scene));
|
||||||
if (this.scene.currentBattle.battleType === BattleType.TRAINER)
|
if (this.scene.currentBattle.battleType === BattleType.TRAINER)
|
||||||
|
|
Loading…
Reference in New Issue