mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-05 22:01:54 +02:00
Fix
This commit is contained in:
@@ -41,6 +41,12 @@ module.exports = class BalloonPopCommand extends Command {
|
||||
const user = userTurn ? msg.author : opponent;
|
||||
await msg.say(`${user} pumps the balloon!`);
|
||||
remains -= 50;
|
||||
const popped = !Math.floor(Math.random() * (remains < 0 ? 2 : remains));
|
||||
if (popped) {
|
||||
await msg.say('The balloon pops!');
|
||||
winner = userTurn ? opponent : msg.author;
|
||||
break;
|
||||
}
|
||||
let pump;
|
||||
if (!opponent.bot || (opponent.bot && userTurn)) {
|
||||
await msg.say(`${user}, do you pump the balloon again?`);
|
||||
@@ -52,15 +58,15 @@ module.exports = class BalloonPopCommand extends Command {
|
||||
if (pump) {
|
||||
await msg.say(`${user} pumps the balloon!`);
|
||||
remains -= 50;
|
||||
const popped2 = !Math.floor(Math.random() * (remains < 0 ? 2 : remains));
|
||||
if (popped2) {
|
||||
await msg.say('The balloon pops!');
|
||||
winner = userTurn ? opponent : msg.author;
|
||||
}
|
||||
} else {
|
||||
await msg.say(`${user} steps back!`);
|
||||
userTurn = !userTurn;
|
||||
}
|
||||
const popped = Boolean(Math.floor(Math.random() * (remains < 0 ? 2 : remains)));
|
||||
if (popped) {
|
||||
await msg.say('The balloon pops!');
|
||||
winner = userTurn ? opponent : msg.author;
|
||||
}
|
||||
}
|
||||
this.playing.delete(msg.channel.id);
|
||||
return msg.say(`And the winner is... ${winner}! Great job!`);
|
||||
|
||||
Reference in New Issue
Block a user