public BidInfo GetBidInfo(int position, long amount, BidTypeEnum bidType) { var player = Players[position]; var user = JoinedPlayers[player.UserId]; if (user.Cash < amount) { throw new InvalidOperationException("Not enought cash for user {0} "); } var bet = CalculateNewBet(position, amount); if (bidType == BidTypeEnum.Raise) { MaxRaisedValue = Math.Max(MaxRaisedValue, bet - CurrentBidding.CurrentStage.GetMaxBet()); } return(new BidInfo { Position = position, Bid = player.Bid + amount, Amount = amount, Bet = bet, UserId = player.UserId, NewCashValue = user.Cash - amount, BiddingStage = CurrentBidding.Stage, BidType = bidType }); }
private void MarkBlindsIfGameStarts(PlayerDocument player, BidTypeEnum bidType) { if (bidType == BidTypeEnum.SmallBlind || bidType == BidTypeEnum.BigBlind) { player.IsSmallBlind = bidType == BidTypeEnum.SmallBlind; player.IsBigBlind = bidType == BidTypeEnum.BigBlind; } }