forked from naikajb/Warzone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCards.h
74 lines (56 loc) · 1.77 KB
/
Cards.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
#include <iostream>
#include <string>
#include <vector>
#ifndef CARDS_H
#define CARDS_H
using namespace std;
class Hand;
class Deck;
class Card {
public:
enum CardType {BOMB, REINFORCEMENT, BLOCKADE, AIRLIFT, NEGOTIATE };
//Card constructor that takes type
Card(CardType type);
string getCardType() const;
//This method will be called when the card is played
void play(int index, Hand& hand, Deck& deck);
//required for the shuffle method in the Deck class
bool operator==(const Card& other) const;
// Destructor to free allocated memory
~Card();
// Copy constructor
Card(const Card& other);
//output stream operator
friend ostream& operator<<(ostream& out, const Card& card);
private:
CardType* type;
};
class Deck {
public:
Deck();
~Deck();
Deck(const Deck& other);
Card* draw();
void returnCardToDeck(Card* card);
void displayDeck();
vector<Card *> getCardsInDeck();
friend ostream& operator<<(ostream& out, const Deck& deck);
private:
//Arraylist equivalent in C++ that represents the deck of cards
vector<Card*> cardsInDeck;
};
class Hand {
public:
Hand();
~Hand();
Hand(const Hand& other);
void addCard(Card* card);
friend ostream& operator<<(ostream& out, const Hand& hand);
//Creates an order & returns it to the player's
//list of orders and then returns the card to the deck
void displayHand();
vector <Card*> getCardsHand();// added
//Arraylist equivalent in C++ that represents the hand of cards
vector<Card*> cardsInHand;
};
#endif