Study Dungeon  1.0.0
A group project for COSC345
player.h
Go to the documentation of this file.
1 
11 #pragma once
12 #ifndef PLAYER_H
13 #define PLAYER_H
14 
15 #include "menu.h"
16 #include "playing_card.h"
17 #include "util.h"
18 #include <iostream>
19 #include <stdio.h>
20 #include <string.h>
21 #include <vector>
22 
27 class Player
28 {
29 private:
31  int hitPoints;
33  int maxHitPoints;
35  size_t handSize;
37  std::vector<PlayingCard> deck;
39  std::vector<PlayingCard> hand;
40 
41 public:
46  Player();
47 
55  Player(int hitPoints, int maxHitPoints, size_t handSize, const std::vector<PlayingCard> &deck);
56 
62  int getHitPoints();
63 
74  void setHitPoints(int value);
75 
81  int getMaxHitPoints();
82 
88  void setMaxHitPoints(int value);
89 
95  std::vector<PlayingCard> getHand();
96 
106  void setHand(const std::vector<PlayingCard> &hand);
107 
113  size_t getHandSize();
114 
120  void setHandSize(size_t handSize);
121 
127  std::vector<PlayingCard> getDeck();
128 
134  void setDeck(const std::vector<PlayingCard> &deck);
135 
140  void drawCard();
141 
147  void removeCard(PlayingCard &card);
148 
154  void addCard(PlayingCard &card);
155 
162  PlayingCard getCard(int index);
163 
169  void damage(int amount);
170 
176  void heal(int amount);
177 
183  std::string toString();
184 
189  void printHand();
190 };
191 
192 #endif
Class that represents a Player.
Definition: player.h:28
int getMaxHitPoints()
Returns the max hit points of the player.
Definition: player.cpp:50
void printHand()
Prints the hand of the player to std::cout.
Definition: player.cpp:146
void setHitPoints(int value)
Sets the current hit points of the player.
Definition: player.cpp:45
void removeCard(PlayingCard &card)
Removes the given card from the player's hand.
Definition: player.cpp:92
int getHitPoints()
Returns the current hit points of the player.
Definition: player.cpp:40
void setHandSize(size_t handSize)
Sets the hand size of the player.
Definition: player.cpp:77
std::vector< PlayingCard > getHand()
Returns the player's hand.
Definition: player.cpp:62
PlayingCard getCard(int index)
Returns the PlayingCard object that corresponds to the index given.
Definition: player.cpp:111
void heal(int amount)
Heals the player a given amount.
Definition: player.cpp:126
void setHand(const std::vector< PlayingCard > &hand)
Set the player's hand.
Definition: player.cpp:67
void setDeck(const std::vector< PlayingCard > &deck)
Set the Deck of the player.
Definition: player.cpp:87
void damage(int amount)
Applies damage equal to amount to the player.
Definition: player.cpp:118
std::vector< PlayingCard > getDeck()
Get the Deck of the player.
Definition: player.cpp:82
size_t getHandSize()
Returns the hand size of the player.
Definition: player.cpp:72
void setMaxHitPoints(int value)
Sets the maximum hit points of the player.
Definition: player.cpp:55
void addCard(PlayingCard &card)
Adds the given card to the player's hand.
Definition: player.cpp:106
std::string toString()
Converts the player object to a string.
Definition: player.cpp:140
void drawCard()
Draws a card from the player's deck and adds it to the player's hand.
Definition: player.cpp:30
Player()
Construct a new Player object.
Definition: player.cpp:13
Class to define the playing card object.
Definition: playing_card.h:24
Classes and functions for the UI system.
This file defines the classes and methods used for a Playing Card.
Contains useful helper functions.