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
44 lines
1.6 KiB
2 years ago
|
/* ************************************************************************** */
|
||
|
/* */
|
||
|
/* ::: :::::::: */
|
||
|
/* FragTrap.cpp :+: :+: :+: */
|
||
|
/* +:+ +:+ +:+ */
|
||
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
||
|
/* +#+#+#+#+#+ +#+ */
|
||
|
/* Created: 2022/06/23 15:19:54 by narnaud #+# #+# */
|
||
|
/* Updated: 2022/07/19 02:29:38 by narnaud ### ########.fr */
|
||
|
/* */
|
||
|
/* ************************************************************************** */
|
||
|
|
||
|
#include "FragTrap.hpp"
|
||
|
|
||
|
FragTrap::FragTrap (std::string name):ClapTrap(name){
|
||
|
_health = 100;
|
||
|
_energy = 100;
|
||
|
_attack = 30;
|
||
|
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;
|
||
|
}
|
||
|
}
|