This commit is contained in:
Dragon Fire
2021-01-22 16:57:52 -05:00
parent 9db111803a
commit 2e42f869a8
+4 -4
View File
@@ -95,9 +95,9 @@ module.exports = class NimCommand extends Command {
`); `);
const rowFilter = res => { const rowFilter = res => {
if (res.author.id !== user.id) return false; if (res.author.id !== user.id) return false;
const choice = res.content; const chosen = res.content;
if (choice.toLowerCase() === 'end' || choice.toLowerCase() === 'back') return true; if (chosen.toLowerCase() === 'end' || chosen.toLowerCase() === 'back') return true;
const i = Number.parseInt(choice, 10) - 1; const i = Number.parseInt(chosen, 10) - 1;
return row >= i && row > 0; return row >= i && row > 0;
}; };
const rowTurn = await msg.channel.awaitMessages(rowFilter, { const rowTurn = await msg.channel.awaitMessages(rowFilter, {
@@ -124,7 +124,7 @@ module.exports = class NimCommand extends Command {
if (rowChoice.toLowerCase() === 'back') continue; if (rowChoice.toLowerCase() === 'back') continue;
board[picked - 1] -= rowPicked; board[picked - 1] -= rowPicked;
if (!userTurn && firstTurn) firstTurn = false; if (!userTurn && firstTurn) firstTurn = false;
if (!board.some(row => row !== 0)) { if (!board.some(r => r !== 0)) {
winner = userTurn ? opponent : msg.author; winner = userTurn ? opponent : msg.author;
break; break;
} }