-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPlayer.h
140 lines (120 loc) · 4.15 KB
/
Player.h
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#pragma once
#include "map.h"
#include "Orders.h"
#include "Cards.h"
#include "PlayerStrategies.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Territory;
class Order;
class Orderlist;
class Advanceorder;
class Deck;
class Hand;
class PlayerStrategy;
class Player
{
private:
// name of player
string name;
//Player's reinforcement armies pool
int reinforcementPool = 0;
// minimum number of armies for a player
static const int MINARMIES;
// captured a territory boolean (for card distribution after teh round);
bool* capturedTerritory;
//the paleyrs stragety
PlayerStrategy* playerstrategy;
// a vector of strings that hold the names of players negotiated with
vector<string*>* negotiatedFriends;
// player owns a collection of territories
vector<Territory*>* territoriesToDefend;
vector<Territory*>* territoriesToAttack;
vector<Territory*>* surroundingterr;
// player owns a hand of cards
Hand* playerHand;
// player's orderlist
Orderlist* playerOlist;
//bonus value for continents owned
int continentBonus;
public:
// default constructor
Player();
void clear();
//gettermethod
PlayerStrategy* getstartegy();
// parametrized constructor
Player(string, PlayerStrategy*);
// destructor
~Player();
//copy constructor
Player(const Player&);
// assignment operator
Player& operator = (const Player& o);
// stream insertion operator
friend ostream &operator << (ostream &output, const Player &o);
//stream insertion operator overload for printing a vector list of territory references
friend ostream& operator << (ostream& out, const vector<Territory*>& t);
//Add reinforcements to pool
void addReinforcements(int);
//get current amount of reinforcements owned by player
int getCurrentReinforcements();
//set Current amount of reinforcements owned by player
void setCurrentReinforcements(int i);
// method to set the name of player
void setName(string name);
// method to return name of player
string getName();
// get number of territories owned by the player
int getNumTerrOwned();
// get hand owned by player
Hand* getHand();
//clear method
void clearhand();
// get player's orderlist
Orderlist* getPlayerlist();
// method toDefend which returns a list
// of territories to defend
vector<Territory*>* toDefend(Map &m);
//returns the todefend list
vector<Territory*>* gettoDefend(Map& m);
// method toAttack which returns a list
// of territories to attack
vector<Territory*>* toAttack(Map &m,Territory& t);
//returns all possible territories to attack
vector<Territory*>* toAttack(Map &m);
//returns all enemy territories
vector<Territory*>* allnonFriendlies(Map &m);
//to string method
string toString(vector<Territory*>* t);
//method issue order which begins the players issue order phase based on its player strategy
void issueOrder(Map* m, vector<Player*>* pl,Deck* deckpointer);
//Getter method for boolean capture territory
bool getcaptureTerritory();
//setter method for capture territory
void setcaptureTerritory(bool b);
//adds a player to the negotiated friends list
void addnegotiateFriends(string s);
//clears the list
void clearnegotiateFriends();
//checks if a name is in the list
bool isNegotiatedFriend(string s);
//For a given territory on a map returns all surrounding territories
static vector<Territory*>* surroundingterritories(Map& m,Territory &l);
//find friendly territories that border a given territory
vector<Territory*>* friendlyAdjacentTerritories(Map &m,Territory &t);
//updates the lsit of territories to defend
void updatetoDefend(Map &m);
//returns orderlist
vector<Order*>* getOrderList();
//returns the bonus troops awarded for owning territories
int getContinentBonus(Map* m);
//adds a single order to the list
void addOrder(Order* o);
//getter mtehod
vector<Territory*>* getterritoriesToAttack();
//getter method
vector<Territory*>* getSurroundingterr();
};