[Bug] Fix trainer double battle crash (#2573)

* fix double battle crash

* remove !

* fixes crash on double battle
This commit is contained in:
Adrian T 2024-06-25 05:32:21 +08:00 committed by GitHub
parent 71299a731c
commit 2bab7d3778
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -432,9 +432,9 @@ export default class Trainer extends Phaser.GameObjects.Container {
}
const party = this.scene.getEnemyParty();
const nonFaintedPartyMembers = party.slice(this.scene.currentBattle.getBattlerCount()).filter(p => !p.isFainted()).filter(p => !trainerSlot || p.trainerSlot === trainerSlot);
const partyMemberScores = nonFaintedPartyMembers.map(p => {
const playerField = this.scene.getPlayerField();
const nonFaintedLegalPartyMembers = party.slice(this.scene.currentBattle.getBattlerCount()).filter(p => p.isAllowedInBattle()).filter(p => !trainerSlot || p.trainerSlot === trainerSlot);
const partyMemberScores = nonFaintedLegalPartyMembers.map(p => {
const playerField = this.scene.getPlayerField().filter(p => p.isAllowedInBattle());
let score = 0;
for (const playerPokemon of playerField) {
score += p.getMatchupScore(playerPokemon);