本文整理汇总了C++中councilRoomEffect函数的典型用法代码示例。如果您正苦于以下问题:C++ councilRoomEffect函数的具体用法?C++ councilRoomEffect怎么用?C++ councilRoomEffect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了councilRoomEffect函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 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;
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 adventurerEffect(currentPlayer, drawntreasure, cardDrawn, temphand, z, state);
case council_room:
return councilRoomEffect(currentPlayer, state, handPos);
case feast:
return feastEffect(currentPlayer, temphand, choice1, state);
case gardens:
return -1;
case mine:
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 > treasure_map || choice2 < curse)
{
return -1;
}
if ( (getCost(state->hand[currentPlayer][choice1]) + 3) > getCost(choice2) )
{
return -1;
}
gainCard(choice2, state, 2, 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 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 smithyEffect(currentPlayer, state, handPos);
case village:
//.........这里部分代码省略.........
开发者ID:CS362-Winter-2016,项目名称:cs362w16_rogersza,代码行数:101,代码来源:dominion.c
示例2: 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,代码来源:mutant100425_dominion.c
示例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;
//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:
adventurerEffect(currentPlayer,state);
case council_room:
councilRoomEffect(handPos, currentPlayer, state);
case feast:
//gain card with cost up to 5
//Backup hand
for (i = 0; i <= state->handCount[currentPlayer]; i++){
temphand[i] = state->hand[currentPlayer][i];//Backup card
state->hand[currentPlayer][i] = -1;//Set to nothing
}
//Backup hand
//Update Coins for Buy
updateCoins(currentPlayer, state, 5);
x = 1;//Condition to loop on
while( x == 1) {//Buy one card
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));
}
}
else if (state->coins < getCost(choice1)){
printf("That card is too expensive!\n");
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:
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 > treasure_map || choice2 < curse)
{
return -1;
}
if ( (getCost(state->hand[currentPlayer][choice1]) + 3) > getCost(choice2) )
{
//.........这里部分代码省略.........
开发者ID:cr8zd,项目名称:cs362w16,代码行数:101,代码来源:dominion.c
注:本文中的councilRoomEffect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论