-
Notifications
You must be signed in to change notification settings - Fork 0
/
CardFive.cpp
52 lines (45 loc) · 1.16 KB
/
CardFive.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
52
#include "CardFive.h"
CardFive::CardFive(const CellPosition& pos):Card(pos)
{
cardNumber = 5;
}
void CardFive::ReadCardParameters(Grid* pGrid)
{
}
void CardFive::SetNumberOfDecrementSteps(int x)
{
NumberOfDecrementSteps = x;
}
CardFive::CardFive(const CellPosition& pos,int num) :Card(pos) {
cardNumber = 5;
NumberOfDecrementSteps = num;
}
Card* CardFive::GetCopy() {
return new CardFive(position,NumberOfDecrementSteps);
}
void CardFive::Apply(Grid* pGrid, Player* pPlayer)
{
//get just rolled number(need implemntation) in player.h
// clear position
//update player cell postion
//draw player in new cell position
Card::Apply(pGrid,pPlayer);
CellPosition n(pPlayer->GetCell()->GetCellPosition().GetCellNum() - pPlayer->GetJustRolled());
pGrid->UpdatePlayerCell(pPlayer, n);
if (pPlayer->GetCell()->GetGameObject())
{
pPlayer->GetCell()->GetGameObject()->Apply(pGrid, pPlayer);
}
}
void CardFive::Save(ofstream& OutFile, const CellPosition& startCellPos)
{
Card::Save(OutFile, startCellPos);
OutFile << endl;
}
void CardFive::Load(ifstream& Infile)
{
Infile >> NumberOfDecrementSteps;
}
CardFive::~CardFive()
{
}