-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.hpp
82 lines (70 loc) · 2.53 KB
/
Player.hpp
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
class Player;
#ifndef PLAYER_H
#define PLAYER_H
#include <vector>
#include <list>
#include <string>
#include <iostream>
#include "Card.hpp"
#include "Pay.hpp"
#include "Produce.hpp"
#include "Wonder.hpp"
#include "Game.hpp"
class Player {
public:
Player(std::string name);
void setLeftRightPlayers(Player* left, Player* right);
void setGame(Game* gm);
void chooseWonder(std::vector<Wonder>& options);
void giveWonder(const Wonder& w);
void chooseWonderSide();
static const size_t turnRounds = 4;
void takeTurn(size_t i); // Index is
void postAge(); // Called after the age is done
void giveHand(std::list<Card>* hand);
void giveCoins(size_t numCoins);
void militaryWin(size_t pts) { militaryWinPts_ += pts; }
void militaryLoss() { ++militaryLosses_; }
std::vector<Card> getCards() const ;
std::vector<Produce> getProduce() const;
std::string getName() const { return name_; }
const Player* getLeftPlayer() const { return leftPlayer_; }
const Player* getRightPlayer() const { return rightPlayer_; }
size_t getCoins() const { return coins_; }
size_t getMilitaryPts() const { return militaryWinPts_ - militaryLosses_; }
size_t getMilitaryLosses() const { return militaryLosses_; }
bool isLeftRawCheap() const;
bool isRightRawCheap() const;
bool isManufacturedCheap() const;
size_t getWonderStagesBuilt() const { return wonder_.getNumCompleted(); };
private:
const std::string name_;
Wonder wonder_;
Game* game_;
std::vector<Card> cards_;
std::list<Card>* hand_;
size_t militaryWinPts_;
size_t militaryLosses_;
Player* leftPlayer_;
Player* rightPlayer_;
size_t coins_;
bool playFromDiscard_;
bool usedFreeBuild_;
// Stuff to know what to do at end of turn
enum class ActionType { BURY, BURN, PLAY };
struct Action {
ActionType type;
decltype(hand_->begin()) cardIt;
Pay pay;
};
//std::vector<Action> nextActions_;
Action nextAction;
// Takes the coins for playing the card and adds it to list of cards
void playCard(const Card& c);
bool selectPayment(Action& action, std::vector<Pay> payPossibilities, bool canUseFreeBuild);
void processProduce(const std::vector<Produce>& produce);
};
std::ostream& operator<< (std::ostream& o, const Player& player);
std::vector<Produce> cancelResources(const Player& player, std::vector<Produce> produce, bool forSelf = true);
std::vector<Pay> payForResources(const Player& player, std::vector<Produce> toBePaid);
#endif//PLAYER_H