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.

43 lines
1.6 KiB

3 years ago
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ScavTrap.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/23 15:19:54 by narnaud #+# #+# */
3 years ago
/* Updated: 2022/07/19 02:22:09 by narnaud ### ########.fr */
3 years ago
/* */
/* ************************************************************************** */
#include "ScavTrap.hpp"
3 years ago
ScavTrap::ScavTrap (std::string name):ClapTrap(name){
_health = 100;
_energy = 50;
_attack = 20;
3 years ago
cout << "ClapTrap " << name << " evolved to ScavTrap" << endl;
3 years ago
}
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";
}