From afffbeb8b0c52e050c52b6461f2002d42e04a4e1 Mon Sep 17 00:00:00 2001 From: Liminalia Date: Fri, 27 Dec 2019 16:04:47 +0300 Subject: [PATCH] Fix RandomPlayerAI wrong teamsize assumption (#6216) --- sim/tools/random-player-ai.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sim/tools/random-player-ai.ts b/sim/tools/random-player-ai.ts index 455f19d925..2494d3c781 100644 --- a/sim/tools/random-player-ai.ts +++ b/sim/tools/random-player-ai.ts @@ -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;