From 24eafc85d88abf61d01200aa61440ba1cc0c4e42 Mon Sep 17 00:00:00 2001 From: top Date: Thu, 21 Sep 2023 13:31:02 +0000 Subject: [PATCH] Adds some bug fixes QoL changes to the blackjack game. (#203) Updates the wager text to show the wager for both hands instead of the original wager since splitting doubles the bet. Adds the ability to split face cards/ten which is allowed in the rules most casinos (it's also universally terrible so idk why anyone would actually split 10s). Adds the ability to double down on 9 as requested by annoyingthegoyim, probably increases EV a very small amount but not really noticeable since 9 is a pretty rare opening hand (and worse than double down on 10 or 11). Moves the split button to after hit/stay since some users complained about splitting by accident due to button placement Co-authored-by: Chuck Reviewed-on: https://fsdfsd.net/rDrama/rDrama/pulls/203 Co-authored-by: top Co-committed-by: top --- files/assets/js/casino/blackjack_screen.js | 2 +- files/helpers/twentyone.py | 4 ++-- files/templates/casino/blackjack_screen.html | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/files/assets/js/casino/blackjack_screen.js b/files/assets/js/casino/blackjack_screen.js index 97fd8fe24..11cdc394c 100644 --- a/files/assets/js/casino/blackjack_screen.js +++ b/files/assets/js/casino/blackjack_screen.js @@ -171,7 +171,7 @@ function updateBlackjackTable(state) { if (state.status === 'PLAYING' || (state.has_player_split && state.status_split === 'PLAYING')) { - updateResult(`${state.wager.amount} ${currency} are at stake`, "success"); + updateResult(`${state.has_player_split ? state.wager.amount * 2 : state.wager.amount} ${currency} are at stake`, "success"); } else { enableWager(); } diff --git a/files/helpers/twentyone.py b/files/helpers/twentyone.py index ff6347273..5e5e0ea68 100644 --- a/files/helpers/twentyone.py +++ b/files/helpers/twentyone.py @@ -269,12 +269,12 @@ def can_double_down(state): player = state['player'] player_hand_value = get_value_of_hand(player) player_never_hit = len(player) == 2 - return not state['has_player_split'] and player_hand_value in (10, 11) and player_never_hit + return not state['has_player_split'] and player_hand_value in (9, 10, 11) and player_never_hit def can_split(state): player = state['player'] player_never_hit = len(player) == 2 - hand_can_split = player[0][0] == player[1][0] + hand_can_split = player[0][1] == player[1][1] player_has_split = state['has_player_split'] return hand_can_split and player_never_hit and not player_has_split diff --git a/files/templates/casino/blackjack_screen.html b/files/templates/casino/blackjack_screen.html index fc1a20d5b..6c11c00bb 100644 --- a/files/templates/casino/blackjack_screen.html +++ b/files/templates/casino/blackjack_screen.html @@ -15,17 +15,16 @@
- + -