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.

44 lines
1.6 KiB

3 years ago
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* FragTrap.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/23 15:19:54 by narnaud #+# #+# */
3 years ago
/* Updated: 2022/07/19 02:23:22 by narnaud ### ########.fr */
3 years ago
/* */
/* ************************************************************************** */
#include "FragTrap.hpp"
3 years ago
FragTrap::FragTrap (std::string name):ClapTrap(name){
_health = 100;
_energy = 100;
_attack = 30;
3 years ago
cout << "ClapTrap " << name << " evolved to FragTrap" << endl;
3 years ago
}
FragTrap::~FragTrap (void) {
cout << "FragTrap " << _name << " was destroyed" << endl;
}
void FragTrap::attack(const std::string& target) {
if (_energy == 0 || _health == 0)
cout << _name << " is no more able to attack anyone";
else
{
cout << _name << " hardly attacked " << target << endl;
getClapTrap(target)->takeDamage(_attack);
_energy--;
}
}
3 years ago
void FragTrap::highFivesGuys(void) {
for (int i = 0; i < 128; i++)
{
if (ClapTrap::registery[i])
cout << _name << " high five " << ClapTrap::registery[i]->getName() << endl;
}
}