mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Better balloon pop
This commit is contained in:
@@ -36,10 +36,12 @@ module.exports = class BalloonPopCommand extends Command {
|
||||
}
|
||||
let userTurn = false;
|
||||
let winner = null;
|
||||
let remains = 1000;
|
||||
let remains = 500;
|
||||
let turns = 0;
|
||||
while (!winner) {
|
||||
const user = userTurn ? msg.author : opponent;
|
||||
let pump;
|
||||
++turns;
|
||||
if (!opponent.bot || (opponent.bot && userTurn)) {
|
||||
await msg.say(`${user}, do you pump the balloon?`);
|
||||
const verification = await verify(msg.channel, user);
|
||||
@@ -49,14 +51,20 @@ module.exports = class BalloonPopCommand extends Command {
|
||||
}
|
||||
if (pump) {
|
||||
await msg.say(`${user} pumps the balloon!`);
|
||||
remains -= randomRange(25, 75);
|
||||
remains -= randomRange(50, 100);
|
||||
const popped = Math.floor(Math.random() * remains);
|
||||
if (popped < 0) {
|
||||
if (popped <= 0) {
|
||||
await msg.say('The balloon pops!');
|
||||
winner = userTurn ? opponent : msg.author;
|
||||
break;
|
||||
}
|
||||
if (turns >= 3) {
|
||||
turns = 0;
|
||||
userTurn = !userTurn;
|
||||
}
|
||||
} else {
|
||||
await msg.say(`${user} steps back!`);
|
||||
turns = 0;
|
||||
userTurn = !userTurn;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "61.0.0",
|
||||
"version": "61.0.1",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user