From dbde0b8112c6f019dfae4104b4aede39180208f8 Mon Sep 17 00:00:00 2001 From: Alain Bryden <2285037+alainbryden@users.noreply.github.com> Date: Thu, 25 Nov 2021 23:28:23 -0400 Subject: [PATCH] #1766 Fix blackjack double loss Bet was being removed twice instead of just once. This fact was accounted for in the win and tie if branches, but not the loss branch. --- src/Casino/Blackjack.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Casino/Blackjack.tsx b/src/Casino/Blackjack.tsx index 7a0b88cc8..9219775b1 100644 --- a/src/Casino/Blackjack.tsx +++ b/src/Casino/Blackjack.tsx @@ -75,7 +75,7 @@ export class Blackjack extends Game { } // Take money from player right away so that player's dont just "leave" to avoid the loss (I mean they could - // always reload without saving but w.e) + // always reload without saving but w.e) TODO: Save/Restore the RNG state to limit the value of save-scumming. this.props.p.loseMoney(this.state.bet, "casino"); const playerHand = new Hand([this.deck.safeDrawCard(), this.deck.safeDrawCard()]); @@ -220,12 +220,11 @@ export class Blackjack extends Game { let gains = 0; if (this.isPlayerWinResult(result)) { gains = this.state.bet; - // We 2x the gains because we took away money at the start, so we need to give the original bet back. this.win(this.props.p, 2 * gains); } else if (result === Result.DealerWon) { gains = -1 * this.state.bet; - this.win(this.props.p, -this.state.bet); // Get the original bet back + this.win(this.props.p, 0); // We took away the bet at the start, don't need to take more // Dont need to take money here since we already did it at the start } else if (result === Result.Tie) { this.win(this.props.p, this.state.bet); // Get the original bet back