mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2024-11-26 00:36:25 +00:00
[Bug] add playerfiled length check for score determination (#2583)
This commit is contained in:
parent
bbc07e22bf
commit
3e5ef3e3fb
@ -436,6 +436,8 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
||||
const partyMemberScores = nonFaintedLegalPartyMembers.map(p => {
|
||||
const playerField = this.scene.getPlayerField().filter(p => p.isAllowedInBattle());
|
||||
let score = 0;
|
||||
|
||||
if (playerField.length > 0) {
|
||||
for (const playerPokemon of playerField) {
|
||||
score += p.getMatchupScore(playerPokemon);
|
||||
if (playerPokemon.species.legendary) {
|
||||
@ -446,6 +448,8 @@ export default class Trainer extends Phaser.GameObjects.Container {
|
||||
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];
|
||||
}) as [integer, integer][];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user