44 : name(other.name), hitPoints(other.hitPoints), energyPoints(other.energyPoints), attackDamage(other.attackDamage) {
62 hitPoints = other.hitPoints;
63 energyPoints = other.energyPoints;
64 attackDamage = other.attackDamage;
74 if (hitPoints > 0 && energyPoints > 0) {
75 std::cout <<
"ClapTrap " << name <<
" attacks " << target <<
", causing " << attackDamage
78 }
else if (hitPoints == 0) {
79 std::cout <<
"ClapTrap " << name <<
" is out of hit points and cannot attack!" <<
std::endl;
81 std::cout <<
"ClapTrap " << name <<
" is out of energy points and cannot attack!" <<
std::endl;
94 std::cout <<
"ClapTrap " << name <<
" takes " << amount <<
" points of damage!" <<
std::endl;
95 if (amount >= hitPoints) {
100 std::cout <<
"ClapTrap " << name <<
" has " << hitPoints <<
" hit points remaining." <<
std::endl;
109 if (hitPoints > 0 && energyPoints > 0) {
110 std::cout <<
"ClapTrap " << name <<
" repairs itself, regaining " << amount <<
" hit points!" <<
std::endl;
113 std::cout <<
"ClapTrap " << name <<
" now has " << hitPoints <<
" hit points and " << energyPoints
115 }
else if (hitPoints == 0) {
116 std::cout <<
"ClapTrap " << name <<
" cannot be repaired as it has no hit points!" <<
std::endl;
118 std::cout <<
"ClapTrap " << name <<
" is out of energy points and cannot repair!" <<
std::endl;
Represents a basic robot character.
void beRepaired(unsigned int amount)
beRepaired function implementation.
unsigned int getHitPoints() const
Gets the current hit points of the ClapTrap.
unsigned int getAttackDamage() const
Gets the attack damage of the ClapTrap.
ClapTrap()
Default constructor implementation.
void takeDamage(unsigned int amount)
takeDamage function implementation.
void attack(const std::string &target)
Attack function implementation.
ClapTrap & operator=(const ClapTrap &other)
Copy assignment operator implementation.
~ClapTrap()
Destructor implementation.
const std::string & getName() const
Gets the name of the ClapTrap.
unsigned int getEnergyPoints() const
Gets the current energy points of the ClapTrap.
Header file for the ClapTrap class.