Ejemplo n.º 1
0
HerbalistCard::HerbalistCard( void )
    : Card( 
        L"Herbalist",
        CARDID::HERBALIST,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 2, 0 ) )
{
}
Ejemplo n.º 2
0
CellarCard::CellarCard( void ) 
    : Card( 
        L"Cellar",
        CARDID::CELLAR,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 2, 0 ) )
{
}
Ejemplo n.º 3
0
MoatCard::MoatCard( void )
    : Card( 
        L"Moat",
        CARDID::MOAT,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 2, 0 ) )
{
}
Ejemplo n.º 4
0
MarketCard::MarketCard( void )
    : Card( 
        L"Market",
        CARDID::MARKET,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 5, 0 ) )
{
}
Ejemplo n.º 5
0
TributeCard::TributeCard( void )
    : Card( 
        L"Tribute",
        CARDID::TRIBUTE,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 5, 0 ) )
{
}
Ejemplo n.º 6
0
TalismanCard::TalismanCard(void)
    : Card( 
        L"Talisman",
        CARDID::TALISMAN,
        CARDTYPE::TREASURE,
        0,
        Treasure( 1, 0 ),
        Treasure( 4, 0 ) )
{
}
Ejemplo n.º 7
0
ExpandCard::ExpandCard(void)
    : Card( 
        L"Expand",
        CARDID::EXPAND,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 7, 0 ) )
{
}
Ejemplo n.º 8
0
PhilosophersStoneCard::PhilosophersStoneCard( void )
    : Card( 
        L"Philosopher's Stone",
        CARDID::PHILOSOPHERSSTONE,
        CARDTYPE::TREASURE,
        0,
        Treasure( 0, 0 ),
        Treasure( 3, 1 ) )
{
}
Ejemplo n.º 9
0
CurseCard::CurseCard( void )
    : Card( 
        L"Curse",
        CARDID::CURSE,
        CARDTYPE::CURSE,
        -1,
        Treasure( 0, 0 ),
        Treasure( 0, 0 ) )
{
}
Ejemplo n.º 10
0
LighthouseCard::LighthouseCard( void )
    : Card( 
        L"Lighthouse",
        CARDID::LIGHTHOUSE,
        CARDTYPE::ACTION_DURATION,
        0,
        Treasure( 0, 0 ),
        Treasure( 2, 0 ) )
{
}
Ejemplo n.º 11
0
SpyCard::SpyCard( void )
: Card(
       L"Spy",
       CARDID::SPY,
       CARDTYPE::ACTION_ATTACK,
       0,
       Treasure( 0, 0 ),
       Treasure( 4, 0 ) )
{
}
Ejemplo n.º 12
0
MonumentCard::MonumentCard(void)
    : Card( 
        L"Monument",
        CARDID::MONUMENT,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 4, 0 ) )
{
}
Ejemplo n.º 13
0
GolemCard::GolemCard( void )
    : Card( 
        L"Golem",
        CARDID::GOLEM,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 4, 1 ) )
{
}
Ejemplo n.º 14
0
WorkersVillageCard::WorkersVillageCard(void)
    : Card( 
        L"Worker's Village",
        CARDID::WORKERSVILLAGE,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 4, 0 ) )
{
}
Ejemplo n.º 15
0
CountingHouseCard::CountingHouseCard(void)
    : Card( 
        L"Counting House",
        CARDID::COUNTINGHOUSE,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 5, 0 ) )
{
}
Ejemplo n.º 16
0
UniversityCard::UniversityCard( void )
    : Card( 
        L"University",
        CARDID::UNIVERSITY,
        CARDTYPE::ACTION,
        0,
        Treasure( 0, 0 ),
        Treasure( 2, 1 ) )
{
}
Ejemplo n.º 17
0
Treasure PhilosophersStoneCard::OnTreasurePhase( Engine* pEngine )
{
    Player* pPlayer = pEngine->GetCurrentPlayer();
    int numCardsInDraw = pPlayer->DrawSize();
    int numCardsInDiscard = pPlayer->DiscardSize();
    return Treasure( (int)( ( numCardsInDraw + numCardsInDiscard ) / 5 ), 0 );
}
Ejemplo n.º 18
0
MapEntity* Pickable::parse(Game& game, const std::string& line) {
	std::istringstream iss(line);
	
	int entity_type; int x; int y; std::string item_name;
	iss >> entity_type >> x >> y >> item_name;

	return new Pickable(Treasure(game, item_name), x, y);
}
Ejemplo n.º 19
0
/**
 * @brief Creates an instance from an input stream.
 *
 * The input stream must respect the syntax of this entity type.
 *
 * @param game the game that will contain the entity created
 * @param is an input stream
 * @param layer the layer
 * @param x x coordinate of the entity
 * @param y y coordinate of the entity
 * @return the instance created
 */
MapEntity* Chest::parse(Game &game, std::istream &is, Layer layer, int x, int y) {

  std::string name, treasure_name;
  int big_chest, treasure_variant, treasure_savegame_variable;

  FileTools::read(is, name);
  FileTools::read(is, big_chest);
  FileTools::read(is, treasure_name);
  FileTools::read(is, treasure_variant);
  FileTools::read(is, treasure_savegame_variable);

  return new Chest(name, Layer(layer), x, y, (big_chest != 0),
      Treasure(game, treasure_name, treasure_variant, treasure_savegame_variable));
}
Ejemplo n.º 20
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" );
    }
}
Ejemplo n.º 21
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" );
    }
}
Ejemplo n.º 22
0
void FileParser::createGameElement(char source, Pos pos)
{
	switch (source) {
		case ' ':
		case 'x':
		case 'X':
			// WALL
			story->set(pos, source);
			break;

		case 'h':
		case 'H':
			// HERO
			{
				elements->player = Player(pos);
			}
			break;

		case 'a':
		case 'A':
			// WEAPON
			{
				elements->weapon_vec.push_back(Weapon(pos));
			}
			break;

		case 's':
		case 'S':
			// MONSTER
			{
				elements->monster_vec.push_back(Monster(pos));
			}
			break;

		case 'k':
		case 'K':
			// TREASURE
			{
				elements->treasure_vec.push_back(Treasure(pos));
			}
			break;

		case 'i':
		case 'I':
			// POTION
			{
				elements->potion_vec.push_back(Potion(pos));
			}
			break;

		case 'c':
		case 'C':
			// TRAP
			{
				elements->trap_vec.push_back(Trap(pos));
			}
			break;

		case 'j':
		case 'J':
			// EXIT
			{
				elements->exit_vec.push_back(Exit(pos));
			}
			break;

		default:
			break;
	}
}