[Bug] add playerfiled length check for score determination (#2583)
This commit is contained in:
parent
bbc07e22bf
commit
3e5ef3e3fb
|
@ -436,16 +436,20 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
||||||
const partyMemberScores = nonFaintedLegalPartyMembers.map(p => {
|
const partyMemberScores = nonFaintedLegalPartyMembers.map(p => {
|
||||||
const playerField = this.scene.getPlayerField().filter(p => p.isAllowedInBattle());
|
const playerField = this.scene.getPlayerField().filter(p => p.isAllowedInBattle());
|
||||||
let score = 0;
|
let score = 0;
|
||||||
for (const playerPokemon of playerField) {
|
|
||||||
score += p.getMatchupScore(playerPokemon);
|
if (playerField.length > 0) {
|
||||||
if (playerPokemon.species.legendary) {
|
for (const playerPokemon of playerField) {
|
||||||
score /= 2;
|
score += p.getMatchupScore(playerPokemon);
|
||||||
|
if (playerPokemon.species.legendary) {
|
||||||
|
score /= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
score /= playerField.length;
|
||||||
|
if (forSwitch && !p.isOnField()) {
|
||||||
|
this.scene.arena.findTagsOnSide(t => t instanceof ArenaTrapTag, ArenaTagSide.ENEMY).map(t => score *= (t as ArenaTrapTag).getMatchupScoreMultiplier(p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
score /= playerField.length;
|
|
||||||
if (forSwitch && !p.isOnField()) {
|
|
||||||
this.scene.arena.findTagsOnSide(t => t instanceof ArenaTrapTag, ArenaTagSide.ENEMY).map(t => score *= (t as ArenaTrapTag).getMatchupScoreMultiplier(p));
|
|
||||||
}
|
|
||||||
return [party.indexOf(p), score];
|
return [party.indexOf(p), score];
|
||||||
}) as [integer, integer][];
|
}) as [integer, integer][];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue