From 22b07d4ae6ea444078a02168d4e6b2bb25ad4924 Mon Sep 17 00:00:00 2001 From: Kirk Scheibelhut Date: Wed, 20 Mar 2019 09:27:33 -0700 Subject: [PATCH] Improve autochoose comment per @Slayer95 --- sim/examples/random-player-ai.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sim/examples/random-player-ai.ts b/sim/examples/random-player-ai.ts index ee217fcd8a..8b0eec7278 100644 --- a/sim/examples/random-player-ai.ts +++ b/sim/examples/random-player-ai.ts @@ -28,7 +28,11 @@ export class RandomPlayerAI extends BattlePlayer { receiveError(error: Error) { if (!error.message.startsWith('[Invalid choice]')) throw error; - // Somehow we had a choice error - just let the simulator autochoose for us. + // If we made an invalid choice we just let the simulator auto-choose for us. This can happen + // if we were disabled (Imprison) or trapped (Arena Trap / Magnet Pull / Shadow Tag) and it + // wasn't revealed to us until we made our choice. We could add extra logic to redo the decision, + // removing the invalid choice from our set of options, but given how niche this edge case is + // its not worth dramatically complicating the code to handle it. this.choose(`default`); }