You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
1.6 KiB

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ScavTrap.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/23 15:19:54 by narnaud #+# #+# */
/* Updated: 2022/06/24 07:49:17 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#include "ScavTrap.hpp"
ScavTrap::ScavTrap (std::string name, size_t hp, size_t ep, size_t atk):ClapTrap(name, hp, ep, atk){
cout << "ClapTrap " << name << " evolved to ScavTrap" << endl;
}
ScavTrap::~ScavTrap (void) {
cout << "ScavTrap " << _name << " was destroyed" << endl;
}
void ScavTrap::attack(const std::string& target) {
if (_energy == 0 || _health == 0)
cout << _name << " is no more able to attack" << endl;
else
{
cout << _name << " heavily attacked " << target << endl;
getClapTrap(target)->takeDamage(_attack);
_energy--;
}
}
void ScavTrap::guardGate(void) {
if (_health == 0)
cout << _name << " is no more able to guard" << endl;
else
cout << _name << " is now in guard gate mode.\n";
}