Study Dungeon  1.0.0
A group project for COSC345
Public Member Functions | Data Fields
Game Class Reference

Represents a Game. More...

#include <gameloop.h>

Public Member Functions

void damageEffect (PlayingCard &card)
 Apply the damage effect to the player whose turn it is. More...
 
void healEffect (PlayingCard &card)
 Apply the heal effect to the player whose turn it is. More...
 
void swapHandEffect ()
 Swap the hands between the players.
 
void switchTurn ()
 Switches the turn to the next player.
 
void playEffect (PlayingCard &card)
 Plays the effect of the given playing card. More...
 
void drawCard ()
 Draws a card for the player whose turn it is.
 
 Game (Player p1, Player p2)
 Construct a new Game object. More...
 
 Game ()
 Construct a new Game object.
 
void nextTurn (PlayingCard &nextCard)
 Plays the next turn of the game.
 
bool isGameOver ()
 Checks if the game is over. More...
 
short getWinner ()
 Which player was the winner. More...
 

Data Fields

short turn
 
Player p1
 
Player p2
 

Detailed Description

Represents a Game.

A Game involves 2 Players, which both have a deck of playing cards and a hand of cards

Constructor & Destructor Documentation

◆ Game()

Game::Game ( Player  p1,
Player  p2 
)

Construct a new Game object.

Parameters
p1Player 1
p2Player 2

Member Function Documentation

◆ damageEffect()

void Game::damageEffect ( PlayingCard card)

Apply the damage effect to the player whose turn it is.

Parameters
cardthe PlayingCard object.

◆ getWinner()

short Game::getWinner ( )

Which player was the winner.

Returns
short

◆ healEffect()

void Game::healEffect ( PlayingCard card)

Apply the heal effect to the player whose turn it is.

Parameters
cardthe PlayingCard object

◆ isGameOver()

bool Game::isGameOver ( )

Checks if the game is over.

Checks whether the game is over. Returns true if the game is over by either one player reaching 0 hit points, or neither player having any playing cards left. Returns false if none of these conditions are met.

Returns
true
false

◆ playEffect()

void Game::playEffect ( PlayingCard card)

Plays the effect of the given playing card.

Parameters
card

Field Documentation

◆ p1

Player Game::p1

Player 1

◆ p2

Player Game::p2

Player 2

◆ turn

short Game::turn

The current turn. 1 for Player 1; 2 for Player 2.


The documentation for this class was generated from the following files: