-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiamondTrap.cpp
66 lines (57 loc) · 2.53 KB
/
DiamondTrap.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* DiamondTrap.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: wcorrea- <wcorrea-@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/17 21:09:21 by wcorrea- #+# #+# */
/* Updated: 2023/07/26 08:43:27 by wcorrea- ### ########.fr */
/* */
/* ************************************************************************** */
#include "DiamondTrap.hpp"
// --------------------------- CONSTURCTORS ----------------------------------
DiamondTrap::DiamondTrap(void)
{
std::cout << "DiamondTrap default constructor called" << std::endl;
this->_name = "default";
this->_hitPoints = FragTrap::initHit;
this->_energyPoints = ScavTrap::initEnergy;
this->_attackDamage = FragTrap::initDamage;
this->ClapTrap::_name = this->_name + "_clap_name";
}
DiamondTrap::DiamondTrap(std::string const diamondName) : ClapTrap(diamondName), ScavTrap(diamondName), FragTrap(diamondName)
{
std::cout << "DiamondTrap constructor with parameter called" << std::endl;
this->_name = diamondName;
this->_hitPoints = FragTrap::initHit;
this->_energyPoints = ScavTrap::initEnergy;
this->_attackDamage = FragTrap::initDamage;
this->ClapTrap::_name = this->_name + "_clap_name";
}
DiamondTrap::DiamondTrap(DiamondTrap const ©) : ClapTrap(copy), ScavTrap(copy), FragTrap(copy)
{
std::cout << "DiamondTrap copy constructor called" << std::endl;
this->_name = copy._name;
}
DiamondTrap::~DiamondTrap(void)
{
std::cout << "DiamondTrap destructor called" << std::endl;
}
// --------------------------- OPERATORS ----------------------------------
DiamondTrap &DiamondTrap::operator = (DiamondTrap const ©)
{
if (this == ©)
return (*this);
this->_name = copy._name;
this->_hitPoints = copy.getHitPoints();
this->_energyPoints = copy.getEnergyPoints();
this->_attackDamage = copy.getAttackDamage();
this->ClapTrap::_name = copy.ClapTrap::_name;
return (*this);
}
void DiamondTrap::whoAmI(void)
{
std::cout << "DiamondTrap " << this->_name;
std::cout << " is also known as " << this->ClapTrap::_name << std::endl;
}