diff options
Diffstat (limited to 'cpp03/ex04')
| -rw-r--r-- | cpp03/ex04/ScavTrap.cpp | 3 | ||||
| -rw-r--r-- | cpp03/ex04/SuperTrap.cpp | 7 | ||||
| -rw-r--r-- | cpp03/ex04/SuperTrap.hpp | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/cpp03/ex04/ScavTrap.cpp b/cpp03/ex04/ScavTrap.cpp index d310ab1..b686a5c 100644 --- a/cpp03/ex04/ScavTrap.cpp +++ b/cpp03/ex04/ScavTrap.cpp @@ -6,7 +6,7 @@ /* 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:28 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -70,5 +70,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; } diff --git a/cpp03/ex04/SuperTrap.cpp b/cpp03/ex04/SuperTrap.cpp index c30f973..7e96570 100644 --- a/cpp03/ex04/SuperTrap.cpp +++ b/cpp03/ex04/SuperTrap.cpp @@ -6,13 +6,13 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 17:52:56 by charles #+# #+# */ -/* Updated: 2020/04/13 17:55:14 by charles ### ########.fr */ +/* Updated: 2020/11/10 14:44:33 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "SuperTrap.hpp" -SuperTrap::SuperTrap(): +SuperTrap::SuperTrap() : m_prefix("SUP3R-TP"), m_hitPoints(100), m_maxHitPoints(100), @@ -27,7 +27,7 @@ SuperTrap::SuperTrap(): std::cout << m_prefix << "New " << m_name << ": your gaming references suck" << std::endl; } -SuperTrap::SuperTrap(std::string name): +SuperTrap::SuperTrap(std::string const& name) : m_prefix("SUP3R-TP"), m_hitPoints(100), m_maxHitPoints(100), @@ -57,6 +57,7 @@ void SuperTrap::operator=(SuperTrap const& other) m_meleeAttackDamage = other.m_meleeAttackDamage; m_rangedAttackDamage = other.m_rangedAttackDamage; m_armorDamageReduction = other.m_armorDamageReduction; + return *this; } SuperTrap::~SuperTrap() diff --git a/cpp03/ex04/SuperTrap.hpp b/cpp03/ex04/SuperTrap.hpp index ebebd18..39a0378 100644 --- a/cpp03/ex04/SuperTrap.hpp +++ b/cpp03/ex04/SuperTrap.hpp @@ -6,7 +6,7 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 17:48:31 by charles #+# #+# */ -/* Updated: 2020/04/13 18:42:28 by charles ### ########.fr */ +/* Updated: 2020/11/10 14:44:07 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,9 +22,9 @@ class SuperTrap : public FragTrap, public NinjaTrap { public: SuperTrap(); - SuperTrap(std::string name); + SuperTrap(std::string const& name); SuperTrap(SuperTrap const& other); - void operator=(SuperTrap const& other); + SuperTrap& operator=(SuperTrap const& other); ~SuperTrap(); void rangedAttack(std::string const& target) const; |
