Skip to content

Instantly share code, notes, and snippets.

@jgigault
Created June 19, 2015 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgigault/e4c3535947dacf091249 to your computer and use it in GitHub Desktop.
Save jgigault/e4c3535947dacf091249 to your computer and use it in GitHub Desktop.
#ifndef CLAPTRAP_HPP
# define CLAPTRAP_HPP
# include <iostream>
# define DEFAULT_LEVEL 1
# ifndef GAME_NAME
# define GAME_NAME "F4CK-TP"
# endif
# ifndef COLOR_BOLD
# define COLOR_BOLD "\033[37;1m"
# endif
# ifndef COLOR_RED
# define COLOR_RED "\033[48;5;88m"
# endif
# ifndef COLOR_CLEAR
# define COLOR_CLEAR "\033[0m"
# endif
# ifndef COLOR_GREY
# define COLOR_GREY "\033[1;30m"
# endif
# ifndef COLOR_GREEN
# define COLOR_GREEN "\033[44;5m"
# endif
class ClapTrap
{
public:
ClapTrap(void); // constructor
ClapTrap(std::string name); // constructor
~ClapTrap(void); // destructor
ClapTrap(ClapTrap const & a); // copy constructor
ClapTrap & operator=(ClapTrap const & rhs); // assign operator
std::string getName(void) const;
void rangedAttack(std::string const & target) const;
void meleeAttack(std::string const & target) const;
void takeDamage(unsigned int amount);
void beRepaired(unsigned int amount);
unsigned int getHit(void) const;
unsigned int getMaxHit(void) const;
unsigned int getEnergy(void) const;
unsigned int getMaxEnergy(void) const;
unsigned int getLevel(void) const;
unsigned int getMeleeAttackDmg(void) const;
unsigned int getRangedAttackDmg(void) const;
unsigned int getArmor(void) const;
protected:
void setName(std::string name);
void setHit(unsigned int n);
void setMaxHit(unsigned int n);
void setEnergy(unsigned int n);
void setMaxEnergy(unsigned int n);
void setLevel(unsigned int n);
void setMeleeAttackDmg(unsigned int n);
void setRangedAttackDmg(unsigned int n);
void setArmor(unsigned int n);
private:
std::string _name;
unsigned int _hit;
unsigned int _maxHit;
unsigned int _energy;
unsigned int _maxEnergy;
unsigned int _level;
unsigned int _meleeAttackDmg;
unsigned int _rangedAttackDmg;
unsigned int _armor;
};
std::ostream & operator<<(std::ostream & o, ClapTrap const & i); // insertion operator
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment