Better balloon pop

This commit is contained in:
Daniel Odendahl Jr
2018-01-08 15:41:33 +00:00
parent 4c47d6bdef
commit 1e86bdbbe1
2 changed files with 12 additions and 4 deletions
+11 -3
View File
@@ -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
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "61.0.0",
"version": "61.0.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {