Exemple #1
0
void TributeCard::OnActionPhase( Engine* pEngine )
{
    Player* pPlayer = pEngine->GetCurrentPlayer();
    Player* pPlayerToLeft = pEngine->GetNextPlayer( pPlayer );
    CardList cardsDrawnList = 
        pPlayerToLeft->RevealCardsFromDeck( 2 );
    CardListIter cardIter;

    Card* pFirstCard = *cardIter;

    if( pFirstCard->IsActionCard() )
    {
        pPlayer->PlusActions( 2 );
    }

    if( pFirstCard->IsTreasureCard() )
    {
        pPlayer->PlusCoins( 2 );
    }

    if( pFirstCard->IsVictoryCard() )
    {
        pPlayer->DrawCardsToHand( 2 );
    }

    cardIter++;
    Card* pSecondCard = *cardIter;
    
    if( pSecondCard->CardId() != pFirstCard->CardId() )
    {
        if( pSecondCard->IsActionCard() )
        {
            pPlayer->PlusActions( 2 );
        }

        if( pSecondCard->IsTreasureCard() )
        {
            pPlayer->PlusCoins( 2 );
        }

        if( pSecondCard->IsVictoryCard() )
        {
            pPlayer->DrawCardsToHand( 2 );
        }
    }

}
Exemple #2
0
void GolemCard::OnActionPhase( Engine* pEngine )
{
    // TODO: Not sure how to implement the Golem playing two cards since it is
    // not the player playing the cards since the cards in Hand are not
    // avaliable
    throw std::wstring( L"GolemCard::OnActionPhase - To be implemented..." );

    Player* pPlayer = pEngine->GetCurrentPlayer();
    IAI* pAI = pPlayer->GetAI();
    CardList revealedCardList;
    CardList actionCardList;

    do
    {
        Card* pRevealedCard = pPlayer->RevealCardFromDeck();

        if( pRevealedCard->IsNullCard() )
        {
            break;
        }
        else if( pRevealedCard->IsActionCard() &&
                 pRevealedCard->CardId() != CARDID::GOLEM )
        {
            actionCardList.push_back( pRevealedCard );
        }
        else
        {
            revealedCardList.push_back( pRevealedCard );
        }
    }
    while( actionCardList.size() < 2 );

    pPlayer->PutCardsInDiscard( revealedCardList );

    CardList reorderedCardList = 
        pAI->OnGolem( revealedCardList );

    if( Card::CardListsMatch( revealedCardList, reorderedCardList ) )
    {
        CardListIter cardIter;

        pPlayer->SetGolemFlag( true );

        for( cardIter = reorderedCardList.begin();
             cardIter != reorderedCardList.end();
             cardIter++ )
        {
            Card* pCardToPlay = (Card*)*cardIter;
            pCardToPlay->OnActionPhase( pEngine );
        }

        pPlayer->SetGolemFlag( false );

        pPlayer->PutCardsInPlay( actionCardList );
    }
    else
    {
        // TODO: report error
        throw std::wstring( L"Error: ScoutCard::OnActionPhase" );
    }
}