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.
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* FragTrap.cpp :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2022/06/23 15:19:54 by narnaud #+# #+# */
|
|
|
|
/* Updated: 2022/06/24 07:46:44 by narnaud ### ########.fr */
|
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#include "FragTrap.hpp"
|
|
|
|
|
|
|
|
FragTrap::FragTrap (std::string name, size_t hp, size_t ep, size_t atk):ClapTrap(name, hp, ep, atk){
|
|
|
|
cout << "ClapTrap " << name << " evolved to FragTrap" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
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--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FragTrap::highFivesGuys(void) {
|
|
|
|
for (int i = 0; i < 128; i++)
|
|
|
|
{
|
|
|
|
if (ClapTrap::registery[i])
|
|
|
|
cout << _name << " high five " << ClapTrap::registery[i]->getName() << endl;
|
|
|
|
}
|
|
|
|
}
|