Repository navigation
Expand file tree
/
Copy pathCard.cpp
More file actions
95 lines (88 loc) · 2.24 KB
/
Copy pathCard.cpp
File metadata and controls
95 lines (88 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#include "Card.h"
#include "CardDefinition.h"
#include "Cards.h"
#include "OrderedDeck.h"
#include "Player.h"
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
Card::Card()
{
cardID = NULL_CARD;
deckIndex = 0;
containerDeck = 0;
}
Card::Card(CardIDs cardID, unsigned int deckIndex, OrderedDeck *containerDeck)
{
this->cardID = cardID;
this->deckIndex = deckIndex;
this->containerDeck = containerDeck;
}
Card::~Card()
{
}
std::string Card::name()
{
return Cards::cardDefinitions[cardID].name;
}
int Card::getPrice(Card *card, Player *owner, std::vector<Player*> &otherPlayers)
{
return getPrice(card, owner, &otherPlayers);
}
int Card::getPrice(Card *card, Player *owner, std::vector<Player*> *otherPlayers)
{
return Cards::cardDefinitions[cardID].getPrice(card, owner, otherPlayers);
}
Card::CardTypes Card::cardType()
{
return Cards::cardDefinitions[cardID].cardType;
}
std::string Card::description()
{
return Cards::cardDefinitions[cardID].description;
}
int Card::getVPValue(Player *owner)
{
return Cards::cardDefinitions[cardID].getVPValue(owner);
}
void Card::playAction(Player *owner, vector<Player*> &otherPlayers)
{
Cards::cardDefinitions[cardID].playAction(this, owner, otherPlayers);
}
void Card::playTreasure(Player *owner, std::vector<Player*> &otherPlayers)
{
Cards::cardDefinitions[cardID].playTreasure(this, owner, otherPlayers);
}
void Card::playDuration(Player *owner, std::vector<Player*> &otherPlayers)
{
Cards::cardDefinitions[cardID].playDuration(this, owner, otherPlayers);
}
void Card::setupCardOnBoard()
{
Cards::cardDefinitions[cardID].setupCardOnBoard();
}
void Card::printNameAndDescription(Player *player)
{
stringstream output;
output << name() << " - " << description() << endl;
player->displayMessage(output.str(), false);
}
void Card::sameDeckSwap(Card &otherCard)
{
CardIDs tempID = otherCard.cardID;
unsigned int tempIndex = otherCard.deckIndex;
OrderedDeck *tempDeck = otherCard.containerDeck;
otherCard.cardID = cardID;
otherCard.deckIndex = deckIndex;
otherCard.containerDeck = containerDeck;
cardID = tempID;
deckIndex = tempIndex;
containerDeck = tempDeck;
}
void Card::moveToAnotherDeck(OrderedDeck &deck)
{
Card tempCopy = *this;
containerDeck->removeCard(*this);
deck.addCard(tempCopy);
}