-
Notifications
You must be signed in to change notification settings - Fork 0
/
Card.hpp
49 lines (40 loc) · 1.21 KB
/
Card.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
class Card;
#ifndef CARD_H
#define CARD_H
#include <functional> // For std::function
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include "Produce.hpp"
#include "Color.hpp"
#include "Pay.hpp"
class Player;
class Card {
public:
Card(std::string name,
Color color,
std::vector<Produce> cost,
std::vector<std::string> chainNames,
std::function<std::vector<Produce> (const Player& p)> produce);
Card() :
name_{"INVALID CARD"}
{}
// Returns what the card gives the given player
std::vector<Produce> getProduce(const Player& p) const;
// Returns all possible options for paying for card
std::vector<Pay> canPlay(const Player& p) const;
// Accessors
std::string getName() const { return name_; }
Color getColor() const { return color_; }
std::vector<Produce> getCost() const { return cost_; }
private:
std::string name_;
Color color_;
std::vector<Produce> cost_;
std::vector<std::string> chainNames_;
// Function that returns what the card produces
std::function<std::vector<Produce> (const Player& p) > getProduce_;
};
std::ostream& operator<< (std::ostream& o, const Card& c);
#endif//CARD_H