-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDiamondTrap.cpp
More file actions
65 lines (51 loc) · 2.39 KB
/
Copy pathDiamondTrap.cpp
File metadata and controls
65 lines (51 loc) · 2.39 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* DiamondTrap.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dpoveda- <me@izenynn.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/02/16 03:00:59 by dpoveda- #+# #+# */
/* Updated: 2022/02/16 03:30:29 by dpoveda- ### ########.fr */
/* */
/* ************************************************************************** */
#include "DiamondTrap.hpp"
#include <iostream>
DiamondTrap::DiamondTrap() {
this->_name = "DiamondTrap";
this->ClapTrap::_name = std::string("DiamondTrap").append("_clap_name");
this->_hitPoints = FragTrap::_hitPoints;
this->_energyPoints = ScavTrap::_energyPoints;
this->_attackDamage = FragTrap::_attackDamage;
std::cout << this->_name << " DiamondTrap created" << std::endl;
}
DiamondTrap::DiamondTrap(std::string name) {
this->_name = name;
this->ClapTrap::_name = name.append("_clap_name");
this->_hitPoints = FragTrap::_hitPoints;
this->_energyPoints = ScavTrap::_energyPoints;
this->_attackDamage = FragTrap::_attackDamage;
std::cout << this->_name << " DiamondTrap created" << std::endl;
}
DiamondTrap::DiamondTrap(const DiamondTrap& other) {
*this = other;
std::cout << this->_name << " DiamondTrap copy created" << std::endl;
}
DiamondTrap::~DiamondTrap() {
std::cout << this->_name << " DiamondTrap destroyed" << std::endl;
}
DiamondTrap& DiamondTrap::operator=(const DiamondTrap& other) {
this->ClapTrap::_name = other.ClapTrap::_name;
this->_name = other._name;
this->_hitPoints = other._hitPoints;
this->_energyPoints = other._energyPoints;
this->_attackDamage = other._attackDamage;
std::cout << this->_name << " DiamondTrap = " << other._name << std::endl;
return *this;
}
void DiamondTrap::attack(const std::string& target) const {
this->ScavTrap::attack(target);
}
void DiamondTrap::whoAmI() const {
std::cout << "I am " << this->_name << ", my ClapTrap name is " << this->ClapTrap::_name << std::endl;
}