aboutsummaryrefslogtreecommitdiff
path: root/cpp03/ex02/ScavTrap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp03/ex02/ScavTrap.cpp')
-rw-r--r--cpp03/ex02/ScavTrap.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/cpp03/ex02/ScavTrap.cpp b/cpp03/ex02/ScavTrap.cpp
index d310ab1..c2f7e9b 100644
--- a/cpp03/ex02/ScavTrap.cpp
+++ b/cpp03/ex02/ScavTrap.cpp
@@ -6,14 +6,13 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/13 14:15:03 by charles #+# #+# */
-/* Updated: 2020/04/13 15:46:56 by charles ### ########.fr */
+/* Updated: 2020/11/10 15:06:12 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "ScavTrap.hpp"
-ScavTrap::ScavTrap():
- ClapTrap()
+ScavTrap::ScavTrap() : ClapTrap()
{
m_prefix = "SC4V-TP ";
m_energyPoints = 50;
@@ -24,8 +23,7 @@ ScavTrap::ScavTrap():
std::cout << "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;
@@ -41,7 +39,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 +49,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()
@@ -70,5 +69,4 @@ void ScavTrap::challengeNewcomer(std::string const& target)
std::cout << "SC4V-TP " << m_name
<< " challenge " << target
<< " to " << challenges[rand() % 5] << std::endl;
- m_energyPoints -= 25;
}