properly calculate user's winnings
This commit is contained in:
@@ -253,7 +253,7 @@ pub async fn blackjack(ctx: Context<'_>, amount: String) -> Result<(), Error>
|
|||||||
Ordering::Less => {
|
Ordering::Less => {
|
||||||
if players_count == 21 {
|
if players_count == 21 {
|
||||||
let amount = amount * 3 / 2;
|
let amount = amount * 3 / 2;
|
||||||
balance += amount * 3 / 2;
|
balance += amount;
|
||||||
format!("You've won with a Blackjack! You've gained **{amount}** tokens.")
|
format!("You've won with a Blackjack! You've gained **{amount}** tokens.")
|
||||||
} else {
|
} else {
|
||||||
balance += amount;
|
balance += amount;
|
||||||
@@ -261,9 +261,15 @@ pub async fn blackjack(ctx: Context<'_>, amount: String) -> Result<(), Error>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ordering::Greater if dealers_count > 21 => {
|
Ordering::Greater if dealers_count > 21 => {
|
||||||
|
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;
|
balance += amount;
|
||||||
format!("You've won! **{amount}** tokens have been added to your account.")
|
format!("You've won! **{amount}** tokens have been added to your account.")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Ordering::Equal => {
|
Ordering::Equal => {
|
||||||
format!("A draw!")
|
format!("A draw!")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user