Files
42_INT_09_piscine_cpp/d03/ex03/ScavTrap.cpp
2022-02-22 22:18:43 +01:00

60 lines
1.6 KiB
C++

#include "ScavTrap.hpp"
/*********************************************
* CONSTRUCTORS
*********************************************/
ScavTrap::ScavTrap( std::string name ) : ClapTrap(name) {
_class = _dClass;
_hit = _dHit;
_energy = _dEnergy;
_attack = _dAttack;
std::cout << _class << " " << _name << "-" << _number << " created\n";
return;
}
ScavTrap::ScavTrap( ScavTrap const & src ) {
_class = _dClass;
*this = src;
_number = getTotalNumber();
std::cout << _class << " " << _name << "-" << _number << " copied from " << src._class << "-" << src._name << "-" << src._number << "\n";
return;
}
/*********************************************
* DESTRUCTORS
*********************************************/
ScavTrap::~ScavTrap( void ) {
std::cout << _class << " " << _name << "-" << _number << " destructed\n";
return;
}
/*********************************************
* OPERATORS
*********************************************/
ScavTrap & ScavTrap::operator=( ScavTrap const & rhs ) {
ClapTrap::operator=(rhs);
return *this;
}
/*********************************************
* PUBLIC MEMBER FUNCTIONS
*********************************************/
void ScavTrap::guardGate() {
std::cout << _class << " " << _name << "-" << _number << " entered special mode Gate Keeper\n";
}
/*********************************************
* STATICS
*********************************************/
std::string const ScavTrap::_dName = "robot";
std::string const ScavTrap::_dClass = "ScavTrap";
int const ScavTrap::_dHit = 100;
int const ScavTrap::_dEnergy = 50;
int const ScavTrap::_dAttack = 20;