コード例 #1
0
        private BlackjackHandSettlement settleHand(BlackjackGameRoundPlayer roundplayer, BlackjackGamePlayer realPlayer)
        {
            if (RoundInProgress.RoundPlayers.Any(a => a.HasAction))
            {
                if (!roundplayer.Hand.IsBusted)
                {
                    throw new InvalidOperationException("Non-busted hands cannot settle until round completes");
                }
            }

            var settlement = new BlackjackHandSettlement(roundplayer, RoundInProgress.DealerHand);

            if (settlement.WagerOutcome == WagerOutcome.Draw)
            {
                roundplayer.Player.Account.Credit(settlement.WagerAmount);
                realPlayer.Account.Credit(settlement.WagerAmount);
            }
            else if (settlement.WagerOutcome == WagerOutcome.Win)
            {
                roundplayer.Player.Account.Credit(settlement.WagerAmount * 2);
                realPlayer.Account.Credit(settlement.WagerAmount * 2);
            }



            RoundInProgress.SettleRoundPlayer(roundplayer, settlement);

            return(settlement);
        }
コード例 #2
0
 public void SettleRoundPlayer(BlackjackGameRoundPlayer roundplayer, BlackjackHandSettlement settlement)
 {
     Settlements.Add(settlement);
     RoundPlayers.Remove(roundplayer);
 }