From 251c2d4c19e098848c79b0aa30887bc72b168ed4 Mon Sep 17 00:00:00 2001 From: minneelyyyy Date: Tue, 1 Apr 2025 22:57:19 -0400 Subject: [PATCH] properly calculate user's winnings --- src/commands/gambling/blackjack.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/commands/gambling/blackjack.rs b/src/commands/gambling/blackjack.rs index b31cc10..d99286d 100644 --- a/src/commands/gambling/blackjack.rs +++ b/src/commands/gambling/blackjack.rs @@ -253,7 +253,7 @@ pub async fn blackjack(ctx: Context<'_>, amount: String) -> Result<(), Error> Ordering::Less => { if players_count == 21 { let amount = amount * 3 / 2; - balance += amount * 3 / 2; + balance += amount; format!("You've won with a Blackjack! You've gained **{amount}** tokens.") } else { balance += amount; @@ -261,8 +261,14 @@ pub async fn blackjack(ctx: Context<'_>, amount: String) -> Result<(), Error> } } Ordering::Greater if dealers_count > 21 => { - balance += amount; - format!("You've won! **{amount}** tokens have been added to your account.") + if players_count == 21 { + let amount = amount * 3 / 2; + balance += amount; + format!("You've won with a Blackjack! You've gained **{amount}** tokens.") + } else { + balance += amount; + format!("You've won! **{amount}** tokens have been added to your account.") + } } Ordering::Equal => { format!("A draw!")