/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* DiamondTrap.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/06/23 15:19:54 by narnaud #+# #+# */ /* Updated: 2022/08/03 10:30:43 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ #include "DiamondTrap.hpp" DiamondTrap::DiamondTrap (std::string name): ScavTrap(name), FragTrap(name){ cout << ScavTrap::_energy << endl; ClapTrap::_name = name + "_clap_name"; _name = name; _health = FragTrap::_health; _energy = ScavTrap::_energy; _attack = FragTrap::_attack; cout << name << "is now a DiamondTrap" << endl; } DiamondTrap::~DiamondTrap (void) { cout << "DiamondTrap " << _name << " was destroyed" << endl; } void DiamondTrap::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 DiamondTrap::whoAmI(void) { cout << "Name: " << _name << " - Clap name: " << ClapTrap::_name << endl; }