本文整理汇总了C++中playedCard函数的典型用法代码示例。如果您正苦于以下问题:C++ playedCard函数的具体用法?C++ playedCard怎么用?C++ playedCard使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了playedCard函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: councilRoomEffect
int councilRoomEffect(int currentPlayer, int handPos, struct gameState *state) {
int i;
playedCard(handPos, NULL, NULL, state);
//+4 Cards
for (i = 0; i < 4; i++) {
drawCard(currentPlayer, state);
}
//+1 Buy
state->numBuys++;
//Each other player draws a card
for (i = 0; i < state->numPlayers; i++) {
if (i != currentPlayer) {
drawCard(i, state);
}
}
//put played card in played card pile
endPlayed(state, 0);
return 0;
}
开发者ID:cs362sp16,项目名称:cs362sp16_berezam,代码行数:23,代码来源:mutant101519_dominion.c
示例2: if
void Model::processCurrentPlayer()
{
if (players_[currentPlayer]->isHuman())
{
HumanPlayer* humanPointer = static_cast <HumanPlayer*> (players_[currentPlayer]);
humanPointer->determineValidPlays(deckGrid);
}
else if (!players_[currentPlayer]->isHuman())
{
ComputerPlayer* computerPointer = static_cast <ComputerPlayer*> (players_[currentPlayer]);
if (computerPointer->hasValidMove(deckGrid))
{
computerDiscard = false;
computerPlayed = computerPointer->playCard(deckGrid);
playedCard(computerPlayed);
}
else
{
computerDiscard = true;
computerPlayed = computerPointer->discardCard();
}
}
}
开发者ID:Scourae,项目名称:Straights,代码行数:23,代码来源:model.cpp
示例3: cardEffect
int cardEffect(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus)
{
int i;
int j;
int index;
int currentPlayer = whoseTurn(state);
int nextPlayer = currentPlayer + 1;
int tributeRevealedCards[2] = { -1, -1 };
int temphand[MAX_HAND];// moved above the if statement
int drawntreasure = 0;
int cardDrawn;
int z = 0;// this is the counter for the temp hand
if (nextPlayer > (state->numPlayers - 1)) {
nextPlayer = 0;
}
//uses switch to select card and perform actions
switch (card)
{
case adventurer:
playedCard(handPos, NULL, NULL, state);
while (drawntreasure < 2) {
if (drawCard(currentPlayer, state) == -1)
break;
cardDrawn = state->hand[currentPlayer][state->handCount[currentPlayer] - 1];//top card of hand is most recently drawn card.
if (cardDrawn == copper || cardDrawn == silver || cardDrawn == gold)
drawntreasure++;
else {
temphand[z] = cardDrawn;
state->hand[currentPlayer][state->handCount[currentPlayer] - 1] = -1;
state->handCount[currentPlayer]--; //this should just remove the top card (the most recently drawn one).
z++;
}
}
while (z > 0) {
state->discard[currentPlayer][state->discardCount[currentPlayer]++] = temphand[z - 1]; // discard all cards in play that have been drawn
z--;
}
endPlayed(state, 0);
return 0;
case council_room:
return councilRoomEffect(currentPlayer, handPos, state);
case feast:
if (choice1 < curse || choice1 > treasure_map)
return -1;
if (supplyCount(choice1, state) <= 0) {
if (DEBUG)
printf("None of that card left, sorry!\n");
if (DEBUG) {
printf("Cards Left: %d\n", supplyCount(choice1, state));
}
return -1;
}
else if (5 < getCost(choice1)) {
if (DEBUG) {
printf("That card is too expensive!\n");
printf("Coins: %d < %d\n", state->coins, getCost(choice1));
}
return -1;
}
playedCard(handPos, NULL, NULL, state);
if (DEBUG) {
printf("Deck Count: %d\n", state->handCount[currentPlayer] + state->deckCount[currentPlayer] + state->discardCount[currentPlayer]);
}
gainCard(choice1, state, 0, currentPlayer);//Gain the card
if (DEBUG) {
printf("Deck Count: %d\n", state->handCount[currentPlayer] + state->deckCount[currentPlayer] + state->discardCount[currentPlayer]);
}
//trash feast
endPlayed(state, 1);
return 0;
case gardens:
return -1;
case mine:
if (choice1 >= state->handCount[currentPlayer] || choice1 < 0 || choice1 == handPos)
return -1;
j = state->hand[currentPlayer][choice1]; //store card we will trash
if (state->hand[currentPlayer][choice1] < copper || state->hand[currentPlayer][choice1] > gold)
{
return -1;
}
if (choice2 > gold || choice2 < copper)
{
//.........这里部分代码省略.........
开发者ID:cs362sp16,项目名称:cs362sp16_berezam,代码行数:101,代码来源:mutant100384_dominion.c
注:本文中的playedCard函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论