diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-29 18:43:09 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-29 18:43:09 +0100 |
| commit | 08269639606c0481037cbde7ebaf2e0455460883 (patch) | |
| tree | 57c1f967e8836a1a7da84b1887d932e0067d538f /src/client/games/blackjack.rs | |
| parent | v2.2.0: add blackjack with reserved bets and hit/stand/double (diff) | |
| download | zagan-bet-08269639606c0481037cbde7ebaf2e0455460883.tar.gz zagan-bet-08269639606c0481037cbde7ebaf2e0455460883.zip | |
v2.2.1: forfeit blackjack bets when leaving or disconnecting
Diffstat (limited to '')
| -rw-r--r-- | src/client/games/blackjack.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/client/games/blackjack.rs b/src/client/games/blackjack.rs index a34eb63..bad1781 100644 --- a/src/client/games/blackjack.rs +++ b/src/client/games/blackjack.rs | |||
| @@ -38,6 +38,7 @@ impl BlackjackGame { | |||
| 38 | "push" => "Push. Bet returned.".to_string(), | 38 | "push" => "Push. Bet returned.".to_string(), |
| 39 | "lose" => "Dealer wins.".to_string(), | 39 | "lose" => "Dealer wins.".to_string(), |
| 40 | "bust" => "Bust.".to_string(), | 40 | "bust" => "Bust.".to_string(), |
| 41 | "forfeit" => "Forfeited. Bet lost.".to_string(), | ||
| 41 | "cancelled" => "Cancelled.".to_string(), | 42 | "cancelled" => "Cancelled.".to_string(), |
| 42 | _ => "Hand complete.".to_string(), | 43 | _ => "Hand complete.".to_string(), |
| 43 | } | 44 | } |
| @@ -85,15 +86,15 @@ impl Game for BlackjackGame { | |||
| 85 | } | 86 | } |
| 86 | } | 87 | } |
| 87 | "dealing" => "Dealing...".to_string(), | 88 | "dealing" => "Dealing...".to_string(), |
| 88 | "cancelling" => "Cancelling...".to_string(), | 89 | "forfeiting" => "Forfeiting...".to_string(), |
| 89 | "done" => Self::result_text(&hand.result, hand.winnings), | 90 | "done" => Self::result_text(&hand.result, hand.winnings), |
| 90 | _ => "Press [SPACE] to deal.".to_string(), | 91 | _ => "Press [SPACE] to deal.".to_string(), |
| 91 | }; | 92 | }; |
| 92 | let controls = if status == "player" { | 93 | let controls = if status == "player" { |
| 93 | if hand.actions.iter().any(|action| action == "double") { | 94 | if hand.actions.iter().any(|action| action == "double") { |
| 94 | "[H]it [S]tand [D]ouble [Q]uit".to_string() | 95 | "[H]it [S]tand [D]ouble [Q] Forfeit".to_string() |
| 95 | } else { | 96 | } else { |
| 96 | "[H]it [S]tand [Q]uit".to_string() | 97 | "[H]it [S]tand [Q] Forfeit".to_string() |
| 97 | } | 98 | } |
| 98 | } else { | 99 | } else { |
| 99 | "[SPACE] New hand [+/-] Bet [Q] Quit".to_string() | 100 | "[SPACE] New hand [+/-] Bet [Q] Quit".to_string() |
| @@ -142,7 +143,7 @@ impl Game for BlackjackGame { | |||
| 142 | D - double (when available)\n\ | 143 | D - double (when available)\n\ |
| 143 | SPACE - deal a new hand\n\ | 144 | SPACE - deal a new hand\n\ |
| 144 | +/- - change the next hand's bet\n\ | 145 | +/- - change the next hand's bet\n\ |
| 145 | Q - leave the table" | 146 | Q - forfeit an active hand (bet is lost), or leave when no hand is active" |
| 146 | .to_string() | 147 | .to_string() |
| 147 | } | 148 | } |
| 148 | } | 149 | } |
