Not sure what I was smoking when i put that in
This commit is contained in:
parent
e80dafd6c4
commit
a84ecb86d2
6
index.js
6
index.js
|
@ -642,15 +642,13 @@ client.on("interactionCreate", async interaction => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Flip the coin
|
// Flip the coin
|
||||||
coin = Math.random() <= 0.5 ? "heads" : "tails";
|
Math.random() <= 0.5 ? "heads" : "tails";
|
||||||
side = interaction.options.getString("side");
|
side = interaction.options.getString("side");
|
||||||
outcome = coin == side ? true : false;
|
outcome = coin == side ? true : false;
|
||||||
// If they win, give them the prize, if they lose take up to double the prize away
|
// If they win, give them the prize, if they lose take up to double the prize away
|
||||||
// if they lose inverse the bet and double it
|
// if they lose inverse the bet and double it
|
||||||
if (!outcome) bet = -bet * 2;
|
if (!outcome) bet = -bet * 2;
|
||||||
bet = Math.max( 0, points + bet);
|
await checkAndModifyPoints(interaction.user, bet);
|
||||||
poor = bet <= 0 ? true : false;
|
|
||||||
await checkAndModifyPoints(interaction.user, bet, poor);
|
|
||||||
setCooldown(interaction.user, "coinflip", config.games.coinflip.cooldown * 60 * 1000) //sanity checks in case they somehow started a coinflip despite having a negative balance
|
setCooldown(interaction.user, "coinflip", config.games.coinflip.cooldown * 60 * 1000) //sanity checks in case they somehow started a coinflip despite having a negative balance
|
||||||
if (coin == "heads") return interaction.reply({
|
if (coin == "heads") return interaction.reply({
|
||||||
embeds: [{
|
embeds: [{
|
||||||
|
|
Loading…
Reference in a new issue