-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCardSeven.cpp
More file actions
38 lines (33 loc) · 2.17 KB
/
CardSeven.cpp
File metadata and controls
38 lines (33 loc) · 2.17 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
#include "CardSeven.h"
CardSeven::CardSeven(const CellPosition& pos) : Card(pos)
{
cardNumber = 7;
}
void CardSeven::Apply(Grid* pGrid, Player* pPlayer) {
Card::Apply(pGrid, pPlayer);
CellPosition c(8, 0); //first cell
Player* p = pGrid->GetCurrentPlayer();
pGrid->AdvanceCurrentPlayer();
Player* p1 = pGrid->GetCurrentPlayer();
pGrid->AdvanceCurrentPlayer();
Player* p2 = pGrid->GetCurrentPlayer();
pGrid->AdvanceCurrentPlayer();
Player* p3 = pGrid->GetCurrentPlayer();
pGrid->AdvanceCurrentPlayer();
if (p1->GetCell()->GetCellPosition().GetCellNum() > p->GetCell()->GetCellPosition().GetCellNum() && (p1->GetCell()->GetCellPosition().GetCellNum() <= p2->GetCell()->GetCellPosition().GetCellNum() || p2->GetCell()->GetCellPosition().GetCellNum() <= p->GetCell()->GetCellPosition().GetCellNum()) && (p1->GetCell()->GetCellPosition().GetCellNum() <= p3->GetCell()->GetCellPosition().GetCellNum() || p3->GetCell()->GetCellPosition().GetCellNum() <= p->GetCell()->GetCellPosition().GetCellNum()))
{
pGrid->UpdatePlayerCell(p1, c);
return;
}
if (p2->GetCell()->GetCellPosition().GetCellNum() > p->GetCell()->GetCellPosition().GetCellNum() && (p2->GetCell()->GetCellPosition().GetCellNum() <= p1->GetCell()->GetCellPosition().GetCellNum() || p1->GetCell()->GetCellPosition().GetCellNum() <= p->GetCell()->GetCellPosition().GetCellNum()) && (p1->GetCell()->GetCellPosition().GetCellNum() <= p3->GetCell()->GetCellPosition().GetCellNum() || p3->GetCell()->GetCellPosition().GetCellNum() <= p->GetCell()->GetCellPosition().GetCellNum()))
{
pGrid->UpdatePlayerCell(p2, c);
return;
}
if (p3->GetCell()->GetCellPosition().GetCellNum() > p->GetCell()->GetCellPosition().GetCellNum() && (p3->GetCell()->GetCellPosition().GetCellNum() <= p2->GetCell()->GetCellPosition().GetCellNum() || p2->GetCell()->GetCellPosition().GetCellNum() <= p->GetCell()->GetCellPosition().GetCellNum()) && (p3->GetCell()->GetCellPosition().GetCellNum() <= p1->GetCell()->GetCellPosition().GetCellNum() || p1->GetCell()->GetCellPosition().GetCellNum() <= p->GetCell()->GetCellPosition().GetCellNum()))
{
pGrid->UpdatePlayerCell(p3, c);
return;
}
}
CardSeven:: ~CardSeven() {}