-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCard7.cpp
More file actions
28 lines (25 loc) · 828 Bytes
/
Copy pathCard7.cpp
File metadata and controls
28 lines (25 loc) · 828 Bytes
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
#include "Card7.h"
Card7::Card7(const CellPosition& pos) : Card(pos) // set the cell position of the card
{
cardNumber = 7; // set the inherited cardNumber data member with the card number (7 here)
}
Card7::~Card7(void)
{
}
void Card7::Apply(Grid* pGrid, Player* pPlayer)
{
int diceNumber = 1 + rand() % 6; // from 1 to 6 --> (random automatic)
//3- Get the "current" player from pGrid
Output* pOut = pGrid->GetOutput();
Input* pIn = pGrid->GetInput();
pOut->PrintMessage("The dice number is " + to_string(diceNumber)+" ,Click to move ...");
//4- Move the currentPlayer using function of class player
pIn->GetCellClicked();
pPlayer->DecTurnCount();
pPlayer->Move(pGrid, diceNumber);
pOut->ClearStatusBar();
}
void Card7::Save(ofstream& OutFile)
{
OutFile << cardNumber << " " << position.GetCellNum() << endl;
}