-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDiamondTrap.cpp
61 lines (53 loc) · 2.21 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* DiamondTrap.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aperez-b <aperez-b@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/09/23 13:05:49 by aperez-b #+# #+# */
/* Updated: 2022/09/29 15:27:44 by aperez-b ### ########.fr */
/* */
/* ************************************************************************** */
#include "DiamondTrap.hpp"
DiamondTrap::DiamondTrap(void)
{
ClapTrap::_name = "default_clap_name";
std::cout << "DiamondTrap " << this->_name << " created with default constructor." << std::endl;
}
DiamondTrap::DiamondTrap(std::string const &name): ClapTrap(name + "_clap_name")
{
this->_name = name;
this->_hp = FragTrap::_hp;
this->_energy_points = ScavTrap::_energy_points;
this->_damage = FragTrap::_damage;
std::cout << "DiamondTrap " << this->_name << " created." << std::endl;
}
DiamondTrap::~DiamondTrap(void)
{
std::cout << "DiamondTrap " << this->_name << " destroyed." << std::endl;
}
DiamondTrap::DiamondTrap(DiamondTrap const ©): ClapTrap(copy), ScavTrap(copy), FragTrap(copy)
{
std::cout << "DiamondTrap " << this->_name << " copied." << std::endl;
}
DiamondTrap &DiamondTrap::operator=(DiamondTrap const ©)
{
std::cout << "Assignment operator for DiamondTrap called." << std::endl;
FragTrap::operator=(copy);
return (*this);
}
void DiamondTrap::whoAmI(void)
{
if (this->_hp <= 0)
std::cout << "Cannot run whoAmI because: DiamondTrap " << this->_name << " is dead." << std::endl;
else
{
std::cout << "DiamondTrap name: " << this->_name << "." << std::endl;
std::cout << "ClapTrap name: " << ClapTrap::_name << "." << std::endl;
}
}
void DiamondTrap::attack(std::string const &target)
{
ScavTrap::attack(target);
}