#include "ScavTrap.hpp" #include "ClapTrap.hpp" #include #include ScavTrap::ScavTrap() { this->_name = ""; this->_life = 100; this->_energy = 50; this->_damage = 20; std::cout << "ScavTrap()" << std::endl; } ScavTrap::ScavTrap(const std::string& name) { this->_name = name; this->_life = 100; this->_energy = 50; this->_damage = 20; std::cout << "ScavTrap(" << name << ")" << std::endl; } ScavTrap::ScavTrap(const ScavTrap& src): ClapTrap(src) { *this = src; std::cout << "ScavTrap(ScavTrap)" << std::endl; } ScavTrap::~ScavTrap() { std::cout << "~ScavTrap()" << std::endl; } ScavTrap& ScavTrap::operator=(const ScavTrap &src) { this->_life = src._life; this->_name = src._name; this->_energy = src._energy; this->_damage = src._damage; return *this; } void ScavTrap::guardGate() { std::cout << "ScavTrap " << this->_name << " turn in Gate keeper mode" << std::endl; } void ScavTrap::attack(const std::string& target) { if (this->_life == 0 || this->_energy == 0) { std::cout << "error: ScavTrap " << this->_name << " dead" << std::endl; return; } this->_energy--; std::cout << "ScavTrap " << this->_name << " attacks " << target << ", causing " << this->_damage << " points of damage!" << std::endl; }