本文整理汇总了C++中mineCard函数的典型用法代码示例。如果您正苦于以下问题:C++ mineCard函数的具体用法?C++ mineCard怎么用?C++ mineCard使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mineCard函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cardEffect
int cardEffect(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus)
{
int i;
int j;
int k;
int index;
int currentPlayer = whoseTurn(state);
int nextPlayer = currentPlayer + 1;
int tributeRevealedCards[2] = {-1, -1};
int drawntreasure=0;
if (nextPlayer > (state->numPlayers - 1)){
nextPlayer = 0;
}
//uses switch to select card and perform actions
switch( card )
{
case adventurer:
return adventurerCard (drawntreasure, state, currentPlayer);
case council_room:
return councilRoomCard (currentPlayer, state, handPos);
case feast:
return feastCard (currentPlayer, state, choice1);
case gardens:
return -1;
case mine:
return mineCard (currentPlayer, state, choice1, choice2, handPos);
case remodel:
return remodelCard (currentPlayer, state, choice1, choice2, handPos);
case smithy:
//+3 Cards
for (i = 0; i < 3; i++)
{
drawCard(currentPlayer, state);
}
//discard card from hand
discardCard(handPos, currentPlayer, state, 0);
return 0;
case village:
//+1 Card
drawCard(currentPlayer, state);
//+2 Actions
state->numActions = state->numActions + 2;
//discard played card from hand
discardCard(handPos, currentPlayer, state, 0);
return 0;
case baron:
state->numBuys++;//Increase buys by 1!
if (choice1 > 0){//Boolean true or going to discard an estate
int p = 0;//Iterator for hand!
int card_not_discarded = 1;//Flag for discard set!
while(card_not_discarded){
if (state->hand[currentPlayer][p] == estate){//Found an estate card!
state->coins += 4;//Add 4 coins to the amount of coins
state->discard[currentPlayer][state->discardCount[currentPlayer]] = state->hand[currentPlayer][p];
state->discardCount[currentPlayer]++;
for (;p < state->handCount[currentPlayer]; p++){
state->hand[currentPlayer][p] = state->hand[currentPlayer][p+1];
}
state->hand[currentPlayer][state->handCount[currentPlayer]] = -1;
state->handCount[currentPlayer]--;
card_not_discarded = 0;//Exit the loop
}
else if (p > state->handCount[currentPlayer]){
if(DEBUG) {
printf("No estate cards in your hand, invalid choice\n");
printf("Must gain an estate if there are any\n");
}
if (supplyCount(estate, state) > 0){
gainCard(estate, state, 0, currentPlayer);
state->supplyCount[estate]--;//Decrement estates
if (supplyCount(estate, state) == 0){
isGameOver(state);
}
}
card_not_discarded = 0;//Exit the loop
}
else{
p++;//Next card
}
}
}
else{
/* MUTANT (rep_op) */ if (supplyCount(estate, state) < 0){
gainCard(estate, state, 0, currentPlayer);//Gain an estate
state->supplyCount[estate]--;//Decrement Estates
if (supplyCount(estate, state) == 0){
isGameOver(state);
}
}
}
//.........这里部分代码省略.........
示例2: cardEffect
//.........这里部分代码省略.........
if (DEBUG){
printf("Coins: %d < %d\n", state->coins, getCost(choice1));
}
}
else{
if (DEBUG){
printf("Deck Count: %d\n", state->handCount[currentPlayer] + state->deckCount[currentPlayer] + state->discardCount[currentPlayer]);
}
gainCard(choice1, state, 0, currentPlayer);//Gain the card
x = 0;//No more buying cards
if (DEBUG){
printf("Deck Count: %d\n", state->handCount[currentPlayer] + state->deckCount[currentPlayer] + state->discardCount[currentPlayer]);
}
}
}
//Reset Hand
for (i = 0; i <= state->handCount[currentPlayer]; i++){
state->hand[currentPlayer][i] = temphand[i];
temphand[i] = -1;
}
//Reset Hand
return 0;
case gardens:
return -1;
case mine:
return mineCard(currentPlayer, state, handPos, choice1, choice2);
case remodel:
j = state->hand[currentPlayer][choice1]; //store card we will trash
if ( (getCost(state->hand[currentPlayer][choice1]) + 2) > getCost(choice2) )
{
return -1;
}
gainCard(choice2, state, 0, currentPlayer);
//discard card from hand
discardCard(handPos, currentPlayer, state, 0);
//discard trashed card
for (i = 0; i < state->handCount[currentPlayer]; i++)
{
if (state->hand[currentPlayer][i] == j)
{
discardCard(i, currentPlayer, state, 0);
break;
}
}
return 0;
case smithy:
return smithyCard(currentPlayer, state, handPos);
case village:
return villageCard(currentPlayer, state, handPos);
示例3: cardEffect
int cardEffect(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus)
{
int i;
int j;
int k;
int x;
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;/*=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:
return adventurerCard(state, drawntreasure, currentPlayer);
case council_room:
council_room_test(currentPlayer, state, handPos);
return 0;
case feast:
return feastCard(state, drawntreasure, currentPlayer);
case gardens:
return -1;
case mine:
return mineCard(state, drawntreasure, currentPlayer);
case remodel:
return remodel_test(currentPlayer, state, handPos, choice1, choice2);
case smithy:
return smithyCard(state, currentPlayer, handPos);
case village:
village_test(currentPlayer, state, handPos);
return 0;
case baron:
return baronCard(state, choice1, currentPlayer);
case great_hall:
great_hall_test(currentPlayer, state, handPos);
return 0;
case minion:
//+1 action
state->numActions++;
//discard card from hand
discardCard(handPos, currentPlayer, state, 0);
if (choice1) //+2 coins
{
state->coins = state->coins + 2;
}
else if (choice2) //discard hand, redraw 4, other players with 5+ cards discard hand and draw 4
{
//discard hand
while(numHandCards(state) > 0)
{
discardCard(handPos, currentPlayer, state, 0);
}
//draw 4
for (i = 0; i < 4; i++)
{
drawCard(currentPlayer, state);
}
//other players discard hand and redraw if hand size > 4
for (i = 0; i < state->numPlayers; i++)
{
if (i != currentPlayer)
{
if ( state->handCount[i] > 4 )
{
//discard hand
while( state->handCount[i] > 0 )
{
discardCard(handPos, i, state, 0);
}
//draw 4
for (j = 0; j < 4; j++)
{
drawCard(i, state);
}
}
//.........这里部分代码省略.........
示例4: cardEffect
int cardEffect(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus)
{
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;
}
switch( card )
{
case adventurer:
return adventurerCard(&drawntreasure, state, &cardDrawn, ¤tPlayer, temphand, &z);
case council_room:
return council_roomCard(¤tPlayer, state, &handPos);
case feast:
return feastCard(state, temphand, ¤tPlayer, &choice1);
case gardens:
return -1;
case mine:
return mineCard(state, ¤tPlayer, &choice1, &choice2, &handPos);
case remodel:
return remodelCard(state, ¤tPlayer, &choice1, &choice2, &handPos);
case smithy:
return smithyCard(state, ¤tPlayer, &handPos);
case village:
return villageCard(state, ¤tPlayer, &handPos);
case baron:
return baronCard(state, ¤tPlayer, &choice1);
case great_hall:
return great_hallCard(state, ¤tPlayer, &handPos);
case minion:
return minionCard(state, ¤tPlayer, &handPos, &choice1, &choice2);
case steward:
return stewardCard(state, ¤tPlayer, &handPos, &choice1, &choice2, &choice3);
case tribute:
return tributeCard(state, ¤tPlayer, &handPos, &nextPlayer, tributeRevealedCards);
case ambassador:
return ambassadorCard(state, ¤tPlayer, &handPos, &choice1, &choice2);
case cutpurse:
return cutpurseCard(state, ¤tPlayer, &handPos);
case embargo:
return embargoCard(state, ¤tPlayer, &handPos, &choice1);
case outpost:
return outpostCard(state, ¤tPlayer, &handPos);
case salvager:
return salvagerCard(state, ¤tPlayer, &handPos, &choice1);
case sea_hag:
return sea_hagCard(state, ¤tPlayer);
case treasure_map:
return treasure_mapCard(state, ¤tPlayer, &handPos);
}
return -1;
}