示例#1
0
void ExpandCard::OnActionPhase( Engine* pEngine )
{
    Player* pPlayer = pEngine->GetCurrentPlayer();
    IAI* pAI = pPlayer->GetAI();
    Card* pCardToTrash = pAI->OnExpand();
    
    if( pPlayer->IsCardInHand( pCardToTrash ) )
    {
        pPlayer->TrashFromHand( pCardToTrash );
        Treasure cost = pCardToTrash->Cost( pEngine ) + Treasure( 3, 0 );
        pPlayer->OnGainACard( &cost );
    }
    else
    {
        // TODO: report error
        throw std::wstring( L"Error: ExpandCard::OnActionPhase" );
    }
}
示例#2
0
void UniversityCard::OnActionPhase( Engine* pEngine )
{
    Player* pPlayer = pEngine->GetCurrentPlayer();
    IAI* pAI = pPlayer->GetAI();

    pPlayer->PlusActions( 2 );

    Card* pActionCardToGain = pAI->OnUniversity();

    if( pActionCardToGain->IsActionCard() &&
        pActionCardToGain->Cost( pEngine ) < Treasure( 5, 0 ) )
    {
        pPlayer->GainCardOnDiscard( pActionCardToGain );
    }
    else
    {
        // TODO: report error
        throw std::wstring( L"Error: UniversityCard::OnActionPhase" );
    }
}