cpp/cpp03/ex02/ScavTrap.cpp
2022-07-14 02:00:47 +02:00

50 lines
1.9 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ScavTrap.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/13 08:03:51 by apommier #+# #+# */
/* Updated: 2022/07/14 01:23:29 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
#include "ScavTrap.hpp"
ScavTrap::ScavTrap(std::string name) : ClapTrap(name)
{
std::cout << "ScavTrap " << this->_name << " Default constructor called" << std::endl;
this->_hitPoints = 100;
this->_energyPoints = 50;
this->_attackDamage = 20;
}
ScavTrap::ScavTrap(const ScavTrap& copy) : ClapTrap(copy)
{
std::cout << "ScavTrap Copy constructor called" << std::endl;
this->_name = copy.getName();
this->_hitPoints = copy.getHitPoints();
this->_energyPoints = copy.getEnergyPoints();
this->_attackDamage = copy.getAttackDamage();
}
ScavTrap::~ScavTrap()
{
std::cout << "ScavTrap " << this->_name << " Destructor called" << std::endl;
}
ScavTrap &ScavTrap::operator=(const ScavTrap& rhs)
{
std::cout << "ScavTrap " << this->_name << " Assignation operator called" << std::endl;
this->_name = rhs.getName();
this->_hitPoints = rhs.getHitPoints();
this->_energyPoints = rhs.getEnergyPoints();
this->_attackDamage = rhs.getAttackDamage();
return *this;
}
void ScavTrap::guardGate()
{
std::cout << "ScavTrap " << this->_name << " came into Gatekeeper mode\n";
}