From e66ec4b64c2cc09667e90da8f576310c8bc5e848 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Tue, 19 Jan 2021 06:35:41 -0500 Subject: [PATCH] Fix --- commands/games-mp/connect-four.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/commands/games-mp/connect-four.js b/commands/games-mp/connect-four.js index c04e3e46..650c83b3 100644 --- a/commands/games-mp/connect-four.js +++ b/commands/games-mp/connect-four.js @@ -104,6 +104,7 @@ module.exports = class ConnectFourCommand extends Command { } else { await msg.say(stripIndents` ${user}, which column do you pick? Type \`end\` to forefeit. + Can't think of a move? Use \`play for me\`. ${opponent.bot ? `I placed mine in **${lastMove}**.` : `Previous Move: **${lastMove}**`} ${this.displayBoard(board, playerOneEmoji, playerTwoEmoji)} @@ -113,6 +114,7 @@ module.exports = class ConnectFourCommand extends Command { if (res.author.id !== user.id) return false; const choice = res.content; if (choice.toLowerCase() === 'end') return true; + if (choice.toLowerCase() === 'play for me') return true; const j = Number.parseInt(choice, 10) - 1; return board[colLevels[j]] && board[colLevels[j]][j] !== undefined; }; @@ -124,7 +126,6 @@ module.exports = class ConnectFourCommand extends Command { await msg.say('Sorry, time is up! I\'ll pick their move for them.'); i = AIEngine.playAI('hard'); lastMove = i + 1; - userTurn = !userTurn; continue; } const choice = turn.first().content; @@ -132,6 +133,11 @@ module.exports = class ConnectFourCommand extends Command { winner = userTurn ? opponent : msg.author; break; } + if (choice.toLowerCase() === 'play for me') { + i = AIEngine.playAI('hard'); + lastMove = i + 1; + continue; + } i = Number.parseInt(choice, 10) - 1; AIEngine.play(i); lastMove = i + 1;