-
Notifications
You must be signed in to change notification settings - Fork 0
/
FireCard_5.cpp
52 lines (39 loc) · 1.17 KB
/
FireCard_5.cpp
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
#include "FireCard_5.h"
FireCard_5::FireCard_5(const CellPosition & pos) : Card(pos) // set the cell position of the card
{
cardNumber = 5; // set the inherited cardNumber data member with the card number
}
FireCard_5::FireCard_5(){
cardNumber = 5;
}
FireCard_5::~FireCard_5()
{
}
void FireCard_5::ReadActionParameters()
{
// no parameters to read from user
}
void FireCard_5 :: Apply(Grid* pGrid, Player* pPlayer)
{
Card::Apply (pGrid, pPlayer);
Input * in = pGrid -> GetInput();
Output * out = pGrid -> GetOutput();
for (int i = 0; i < 3; i++)
{
pGrid -> AdvanceCurrentPlayer();
if (pGrid -> GetCurrentPlayer() -> GetCell () -> GetCellPosition() . HCell() == GetPosition() . HCell() || pGrid -> GetCurrentPlayer() -> GetCell () -> GetCellPosition() . VCell() == GetPosition() . VCell() )
{
pGrid -> UpdatePlayerCell (pGrid -> GetCurrentPlayer() , CellPosition(NumVerticalCells - 1, 0));
pGrid -> GetCurrentPlayer() -> SetWallet (pGrid -> GetCurrentPlayer() -> GetWallet () / 2);
}
}
pGrid -> AdvanceCurrentPlayer();
}
void FireCard_5::Save(ofstream& outFile, Type gameObj)
{
if (gameObj == CARDS)
{
Card::Save(outFile, gameObj);
outFile << std::endl;
}
}