Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
4003cem-polymorphism_orig/entity.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
45 lines (38 sloc)
768 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef ENTITY_H | |
#define ENTITY_H | |
/** | |
* The Entity class represents all playable and non-playable characters | |
*/ | |
class Entity | |
{ | |
protected: | |
const int maxHp; | |
int damage; | |
public: | |
/** | |
* Construct an entity | |
* @param[_maxHp] maximum amount of health possible | |
*/ | |
Entity( int _maxHp ); | |
/** | |
* Cause the entity to take damage | |
* @param[points] number of points damage to take | |
*/ | |
void take_damage( int points ); | |
/** | |
* Heal the entity | |
* @param[points] number of points of healing to do | |
*/ | |
void heal( int points ); | |
/** | |
* What is the current health of the entity | |
* @return current health in points | |
*/ | |
int health() const; | |
/** | |
* Is the entity currently alive | |
* @return true is health() > 0 else false | |
*/ | |
bool alive() const; | |
}; | |
#endif |