diff options
Diffstat (limited to 'cpp03/ex04/ScavTrap.cpp')
| -rw-r--r-- | cpp03/ex04/ScavTrap.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/cpp03/ex04/ScavTrap.cpp b/cpp03/ex04/ScavTrap.cpp index b686a5c..1acf126 100644 --- a/cpp03/ex04/ScavTrap.cpp +++ b/cpp03/ex04/ScavTrap.cpp @@ -6,32 +6,28 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 14:15:03 by charles #+# #+# */ -/* Updated: 2020/11/10 15:06:28 by cacharle ### ########.fr */ +/* Updated: 2020/11/11 06:42:58 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "ScavTrap.hpp" -ScavTrap::ScavTrap(): - ClapTrap() +ScavTrap::ScavTrap() : ClapTrap() { - m_prefix = "SC4V-TP "; - m_energyPoints = 50; - m_maxEnergyPoints = 50; - m_meleeAttackDamage = 20; - m_rangedAttackDamage = 15; + m_energyPoints = 50; + m_maxEnergyPoints = 50; + m_meleeAttackDamage = 20; + m_rangedAttackDamage = 15; m_armorDamageReduction = 3; - std::cout << "New " << m_name << ": your gaming references suck" << std::endl; + std::cout << "SC4V-TP New " << m_name << ": your gaming references suck" << std::endl; } -ScavTrap::ScavTrap(std::string name): - ClapTrap(name) +ScavTrap::ScavTrap(std::string const& name) : ClapTrap(name) { - m_prefix = "SC4V-TP "; - m_energyPoints = 50; - m_maxEnergyPoints = 50; - m_meleeAttackDamage = 20; - m_rangedAttackDamage = 15; + m_energyPoints = 50; + m_maxEnergyPoints = 50; + m_meleeAttackDamage = 20; + m_rangedAttackDamage = 15; m_armorDamageReduction = 3; std::cout << "SC4V-TP New " << m_name << ": your gaming references suck" << std::endl; } @@ -41,7 +37,7 @@ ScavTrap::ScavTrap(ScavTrap const& other) *this = other; } -void ScavTrap::operator=(ScavTrap const& other) +ScavTrap& ScavTrap::operator=(ScavTrap const& other) { m_hitPoints = other.m_hitPoints; m_maxHitPoints = other.m_maxHitPoints; @@ -51,6 +47,7 @@ void ScavTrap::operator=(ScavTrap const& other) m_meleeAttackDamage = other.m_meleeAttackDamage; m_rangedAttackDamage = other.m_rangedAttackDamage; m_armorDamageReduction = other.m_armorDamageReduction; + return *this; } ScavTrap::~ScavTrap() |
