mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 06:37:32 +02:00
Fix
This commit is contained in:
@@ -161,6 +161,7 @@ module.exports = class PokerCommand extends Command {
|
|||||||
}
|
}
|
||||||
const solved = [];
|
const solved = [];
|
||||||
for (const playerID of turnRotation) {
|
for (const playerID of turnRotation) {
|
||||||
|
if (folded.includes(playerID)) continue;
|
||||||
const player = players.get(playerID);
|
const player = players.get(playerID);
|
||||||
const solvedHand = Hand.solve([
|
const solvedHand = Hand.solve([
|
||||||
...player.hand.map(card => card.pokersolverKey),
|
...player.hand.map(card => card.pokersolverKey),
|
||||||
@@ -178,7 +179,12 @@ module.exports = class PokerCommand extends Command {
|
|||||||
const splitPot = turnData.pot / winners.length;
|
const splitPot = turnData.pot / winners.length;
|
||||||
for (const win of winners) win.user.money += splitPot;
|
for (const win of winners) win.user.money += splitPot;
|
||||||
} else {
|
} else {
|
||||||
await msg.say(`${winners[0].user.user} takes the pot, with **${winners[0].descr}**.`);
|
await msg.say(stripIndents`
|
||||||
|
${winners[0].user.user} takes the pot, with **${winners[0].descr}**.
|
||||||
|
|
||||||
|
__**Results**__
|
||||||
|
${solved.map(solve => `${solve.user.user.tag}: ${solve.descr}`).join('\n')}
|
||||||
|
`);
|
||||||
winners[0].user.money += turnData.pot;
|
winners[0].user.money += turnData.pot;
|
||||||
}
|
}
|
||||||
await this.resetGame(msg, players);
|
await this.resetGame(msg, players);
|
||||||
@@ -250,7 +256,8 @@ module.exports = class PokerCommand extends Command {
|
|||||||
choice = choice.replace(/[$,]/g, '');
|
choice = choice.replace(/[$,]/g, '');
|
||||||
const amount = Number.parseInt(choice.match(raiseRegex)[1], 10);
|
const amount = Number.parseInt(choice.match(raiseRegex)[1], 10);
|
||||||
if (amount + data.currentBet > turnPlayer.money || amount < 1) {
|
if (amount + data.currentBet > turnPlayer.money || amount < 1) {
|
||||||
res.reply(`You only have $${formatNumber(turnPlayer.money)}!`).catch(() => null);
|
const maxBet = turnPlayer.money - data.currentBet;
|
||||||
|
res.reply(`You can only bet up to $${formatNumber(maxBet)}!`).catch(() => null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user