Fix RandomPlayerAI wrong teamsize assumption (#6216)

This commit is contained in:
Liminalia
2019-12-27 16:04:47 +03:00
committed by Kirk Scheibelhut
parent 189a1421a8
commit afffbeb8b0

View File

@@ -99,7 +99,7 @@ export class RandomPlayerAI extends BattlePlayer {
// Filter out adjacentAlly moves if we have no allies left, unless they're our
// only possible move options.
const hasAlly = !pokemon[i ^ 1].condition.endsWith(` fnt`);
const hasAlly = pokemon.length > 1 && !pokemon[i ^ 1].condition.endsWith(` fnt`);
const filtered = canMove.filter(m => m.target !== `adjacentAlly` || hasAlly);
canMove = filtered.length ? filtered : canMove;