//============================================================================ // Name : gainCard() // Author : LSH // Version : 1.1 // Param : ahand, adeck, adiscard // Return : NULL // Deprecated : Using // See : card.cpp/ActionBureaucrat // Todo : Gain card some card // Bug : No bug //============================================================================ void Player::gainCard(Card c, int count, place dest) { for(int i=0;i<count;i++){ cout << c.GetName() << ", " << c.GetCost() << endl; if(dest ==DISCARD){ adiscard.push_back(c); } else if(dest == HAND){ ahand.push_back(c); } else if(dest == DECK){ adeck.push_front(c); } cout << "name : " << c.GetName() << endl; } };
//============================================================================ // Name : GainCard() // Author : LSH // Version : 1.1 // Param : ahand, adeck, adiscard // Return : NULL // Deprecated : Using // See : card.cpp/ActionBureaucrat // Todo : Gain card some card // Bug : No bug //============================================================================ void Player::GainCard(string name, int count, place dest){ for(int i=0;i<count;i++){ Card *c = new Card; c->SetCard(name); cout << c->GetName() << ", " << c->GetCost() << endl; if(dest ==DISCARD){ adiscard.push_back(*c); } else if(dest == HAND){ ahand.push_back(*c); } else if(dest == DECK){ adeck.push_front(*c); } cout << "name : " << c->GetName() << endl; } };
/* Return the split card to be moved and reduced the current hand value */ const Card Box::MoveSplitCard() { Card TempCard; TempCard = Hand.at(1); qDebug() << "TempCard = " << TempCard.GetName() << " (" << TempCard.GetValue() << ") of " << TempCard.GetSuit(); HandValue -= Hand.at(1).GetValue(); Hand.pop_back(); /* AcesHeld must be reassessed after a split */ string CompareString = Hand.front().GetName(); if (CompareString.compare("Ace") == 0) { AcesHeld = 1; HandValue = 11; } return TempCard; }
/* Receive the card dealt to the box */ void Participant::TakeCard(const Card& DealtCard) { Hand.push_back(DealtCard); HandValue += DealtCard.GetValue(); /* Keep a count of the number of aces held */ string CompareString = DealtCard.GetName(); if (CompareString.compare("Ace") == 0) { AcesHeld++; } /* Soften any aces if required */ if(CheckHand() > 21) { if (AcesHeld > 0) { SoftenAce(); } } }