From c994db725e4d6fa4177003d5b4a26c43c3ffa282 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 11 Jun 2020 10:25:45 -0400 Subject: [PATCH] Poker Fixes --- commands/games-mp/poker.js | 41 +++++++++++++++++++------------------- package.json | 2 +- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/commands/games-mp/poker.js b/commands/games-mp/poker.js index 14ec1fb8..a9195511 100644 --- a/commands/games-mp/poker.js +++ b/commands/games-mp/poker.js @@ -56,7 +56,7 @@ module.exports = class PokerCommand extends Command { const { players, deck, turnData } = this.client.games.get(msg.channel.id).data; for (const player of awaitedPlayers) { players.set(player, { - money: 5000, + money: 2000, id: player, hand: [], user: await this.client.users.fetch(player), @@ -98,37 +98,37 @@ module.exports = class PokerCommand extends Command { turnData.pot = bigBlindAmount + smallBlindAmount; turnData.currentBet = bigBlindAmount; turnData.highestBetter = bigBlind; - let keepGoing = await this.gameRound(msg, players, folded, turnData, bigBlind, smallBlind); + let keepGoing = await this.gameRound(msg, players, deck, folded, turnData, bigBlind, smallBlind); if (!keepGoing) continue; const dealerHand = deck.draw(3); await msg.say(stripIndents` **Dealer Hand:** ${dealerHand.map(card => card.textDisplay).join('\n')} - _Next betting round begins in 5 seconds._ + _Next betting round begins in 10 seconds._ `); - await delay(5000); - keepGoing = await this.gameRound(msg, players, folded, turnData, bigBlind, smallBlind); + await delay(10000); + keepGoing = await this.gameRound(msg, players, deck, folded, turnData, bigBlind, smallBlind); if (!keepGoing) continue; dealerHand.push(deck.draw()); await msg.say(stripIndents` **Dealer Hand:** ${dealerHand.map(card => card.textDisplay).join('\n')} - _Next betting round begins in 5 seconds._ + _Next betting round begins in 10 seconds._ `); - await delay(5000); - keepGoing = await this.gameRound(msg, players, folded, turnData, bigBlind, smallBlind); + await delay(10000); + keepGoing = await this.gameRound(msg, players, deck, folded, turnData, bigBlind, smallBlind); if (!keepGoing) continue; dealerHand.push(deck.draw()); await msg.say(stripIndents` **Dealer Hand:** ${dealerHand.map(card => card.textDisplay).join('\n')} - _Next betting round begins in 5 seconds._ + _Next betting round begins in 10 seconds._ `); - await delay(5000); - keepGoing = await this.gameRound(msg, players, folded, turnData, bigBlind, smallBlind); + await delay(10000); + keepGoing = await this.gameRound(msg, players, deck, folded, turnData, bigBlind, smallBlind); if (!keepGoing) continue; const solved = []; for (const playerID of rotation) { @@ -150,7 +150,7 @@ module.exports = class PokerCommand extends Command { __**Results**__ ${solved.map(solve => `${solve.user.user.tag}: ${solve.descr}`).join('\n')} - _Next game starting in 10 seconds._ + _Next game starting in 15 seconds._ `); const splitPot = turnData.pot / winners.length; for (const win of winners) win.user.money += splitPot; @@ -161,16 +161,16 @@ module.exports = class PokerCommand extends Command { __**Results**__ ${solved.map(solve => `${solve.user.user.tag}: ${solve.descr}`).join('\n')} - _Next game starting in 10 seconds._ + _Next game starting in 15 seconds._ `); winners[0].user.money += turnData.pot; } - await this.resetGame(msg, players); + await this.resetGame(msg, players, deck); if (players.size <= 1) { winner = players.first(); break; } - await delay(10000); + await delay(15000); } this.client.games.delete(msg.channel.id); return msg.say(`Congrats, ${winner.user}!`); @@ -197,7 +197,7 @@ module.exports = class PokerCommand extends Command { ].filter(player => !folded.includes(player)); } - async gameRound(msg, players, folded, turnData, bigBlind, smallBlind) { + async gameRound(msg, players, deck, folded, turnData, bigBlind, smallBlind) { let turnOver = false; const turnRotation = this.makeTurnRotation(players, folded, bigBlind, smallBlind); while (!turnOver) turnOver = await this.bettingRound(msg, players, turnRotation, folded, turnData); @@ -207,11 +207,11 @@ module.exports = class PokerCommand extends Command { await msg.say(stripIndents` ${remainer.user} takes the pot. - _Next game starting in 10 seconds._ + _Next game starting in 15 seconds._ `); remainer.money += turnData.pot; - await this.resetGame(msg, players); - await delay(10000); + await this.resetGame(msg, players, deck); + await delay(15000); return false; } return true; @@ -291,7 +291,8 @@ module.exports = class PokerCommand extends Command { || turnRotation.length === 1; } - async resetGame(msg, players) { + async resetGame(msg, players, deck) { + deck.reset(); for (const player of players.values()) { if (player.money <= 0 || player.strikes >= 3) { await msg.say(`${player.user} has been kicked.`); diff --git a/package.json b/package.json index ace55a4e..2b031eff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "116.16.0", + "version": "116.16.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {