private bool AcesX2(BJStruct bj) { switch (m_SplitAces) { case SplitAces.No: return false; case SplitAces.Once: if (m_SplitAceCount != 0) return false; break; default: break; } if (!m_Resplits && m_SplitCount != 0) return false; if ((bj.HandInfo[bj.activehand].card[0] % 13) == 0 && (bj.HandInfo[bj.activehand].card[1] % 13) == 0 && bj.totalhands < 5) { m_SplitAceCount++; return true; } return false; }
private static BJStruct Split(Mobile from, int bet, BJStruct bj) { short nexthand = bj.totalhands; bj.HandInfo[nexthand].card[0] = bj.HandInfo[bj.activehand].card[1]; bj.HandInfo[bj.activehand].card[1] = -1; bj.HandInfo[bj.activehand].totalcards = 1; bj.HandInfo[bj.activehand] = EvalHand(bj.HandInfo[bj.activehand]); bj.HandInfo[bj.activehand].status = HandStatus.Split; bj.HandInfo[nexthand].bet = bet; bj.totalhands++; bj.HandInfo[nexthand].totalcards = 1; bj.activehand = nexthand; return bj; }
private bool OkToSplit(BJStruct bj) { if ((bj.HandInfo[bj.activehand].card[0] % 13) == 0 && (bj.HandInfo[bj.activehand].card[1] % 13) == 0) return AcesX2(bj); if (!m_Resplits && m_SplitCount != 0) return false; if (bj.HandInfo[bj.activehand].card[0] % 13 == bj.HandInfo[bj.activehand].card[1] % 13 && bj.totalhands < 5) return true; return false; }
private static bool OkToDouble(BJStruct bj, DoubleDown ddRule) { if (ddRule == DoubleDown.AnyPair) return true; else if (ddRule == DoubleDown.Nine211) { if (bj.HandInfo[bj.activehand].bestscore == 9 || bj.HandInfo[bj.activehand].bestscore == 10 || bj.HandInfo[bj.activehand].bestscore == 11 || bj.HandInfo[bj.activehand].altscore == 9 || bj.HandInfo[bj.activehand].altscore == 10 || bj.HandInfo[bj.activehand].altscore == 11) return true; else return false; } else if (ddRule == DoubleDown.Ten11Only) { if (bj.HandInfo[bj.activehand].bestscore == 10 || bj.HandInfo[bj.activehand].bestscore == 11 || bj.HandInfo[bj.activehand].altscore == 10 || bj.HandInfo[bj.activehand].altscore == 11) return true; else return false; } else if (ddRule == DoubleDown.ElevenOnly) { if (bj.HandInfo[bj.activehand].bestscore == 11 || bj.HandInfo[bj.activehand].altscore == 11) return true; else return false; } return false; }
public void Split(Mobile from) { if (!GetBet(from, m_CurrentBet)) { from.SendGump(new BlackJackCardGump(from, this, "Insufficient funds to split.")); return; } m_BJInfo = Split(from, m_CurrentBet, m_BJInfo); m_SplitCount++; Hit(from, false); if (AcesX2(m_BJInfo)) { m_BJInfo.doubleOn = false; m_BJInfo.splitOn = true; m_BJInfo.hitOn = false; if (CardSounds) from.PlaySound(85); from.SendGump(new BlackJackCardGump(from, this, null)); return; } if (m_BJInfo.HandInfo[m_BJInfo.activehand].card[0] % 13 == 0) { m_BJInfo.HandInfo[m_BJInfo.activehand].status = HandStatus.SplitAces; if (!m_BJSplitAces21 && CheckForBlackJack(m_BJInfo.HandInfo[m_BJInfo.activehand])) { if (PlayerCardsFaceUp) { m_BJInfo.HandInfo[m_BJInfo.activehand].status = HandStatus.BlackJack; } if (m_BJSplitAcesPaysEven) { Credit(m_BJInfo.HandInfo[m_BJInfo.activehand].bet * 2, m_BJInfo.HandInfo[m_BJInfo.activehand].bet, m_BJInfo.HandInfo[m_BJInfo.activehand].bet); } else { Credit((int)(m_BJInfo.HandInfo[m_BJInfo.activehand].bet * BlackJackMultiplier(m_BlackJackPays, false)), (int)(m_BJInfo.HandInfo[m_BJInfo.activehand].bet * BlackJackMultiplier(m_BlackJackPays, true)), (int)(m_BJInfo.HandInfo[m_BJInfo.activehand].bet * BlackJackMultiplier(m_BlackJackPays, true))); } } m_BJInfo.hitOn = false; Stand(from); return; } if (m_DoubleAfterSplit) m_BJInfo.doubleOn = OkToDouble(m_BJInfo, m_DoubleDown); m_BJInfo.splitOn = OkToSplit(m_BJInfo); from.SendGump(new BlackJackCardGump(from, this, null)); }
private BJStruct Double(Mobile from, int bet, BJStruct bj) { bj.HandInfo[bj.activehand].bet += bet; bj.doubleOn = false; bj.HandInfo[bj.activehand].status = HandStatus.Double; bj.HandInfo[bj.activehand].card[bj.HandInfo[bj.activehand].totalcards] = carddeck.GetOneCard(); bj.HandInfo[bj.activehand].totalcards++; if (bj.largesthand < bj.HandInfo[bj.activehand].totalcards) bj.largesthand = bj.HandInfo[bj.activehand].totalcards; return bj; }
public void Double(Mobile from) { if (!GetBet(from, m_CurrentBet)) { from.SendGump(new BlackJackCardGump(from, this, "Insufficient funds to double down.")); return; } m_BJInfo = Double(from, m_CurrentBet, m_BJInfo); m_BJInfo.HandInfo[m_BJInfo.activehand] = EvalHand(m_BJInfo.HandInfo[m_BJInfo.activehand]); if (m_BJInfo.HandInfo[m_BJInfo.activehand].bestscore > 21) { m_BJInfo.HandInfo[m_BJInfo.activehand].status = HandStatus.Bust; RecordCollected(m_BJInfo.HandInfo[m_BJInfo.activehand].bet); } if (m_CardSounds) from.PlaySound(85); Stand(from); }