aboutsummaryrefslogtreecommitdiff
path: root/cpp03/ex04/SuperTrap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp03/ex04/SuperTrap.cpp')
-rw-r--r--cpp03/ex04/SuperTrap.cpp75
1 files changed, 75 insertions, 0 deletions
diff --git a/cpp03/ex04/SuperTrap.cpp b/cpp03/ex04/SuperTrap.cpp
index e69de29..c30f973 100644
--- a/cpp03/ex04/SuperTrap.cpp
+++ b/cpp03/ex04/SuperTrap.cpp
@@ -0,0 +1,75 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* SuperTrap.cpp :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* 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 */
+/* */
+/* ************************************************************************** */
+
+#include "SuperTrap.hpp"
+
+SuperTrap::SuperTrap():
+ m_prefix("SUP3R-TP"),
+ m_hitPoints(100),
+ m_maxHitPoints(100),
+ m_energyPoints(100),
+ m_maxEnergyPoints(100),
+ m_level(1),
+ m_name(""),
+ m_meleeAttackDamage(0),
+ m_rangedAttackDamage(0),
+ m_armorDamageReduction(0)
+{
+ std::cout << m_prefix << "New " << m_name << ": your gaming references suck" << std::endl;
+}
+
+SuperTrap::SuperTrap(std::string name):
+ m_prefix("SUP3R-TP"),
+ m_hitPoints(100),
+ m_maxHitPoints(100),
+ m_energyPoints(100),
+ m_maxEnergyPoints(100),
+ m_level(1),
+ m_name(name),
+ m_meleeAttackDamage(0),
+ m_rangedAttackDamage(0),
+ m_armorDamageReduction(0)
+{
+ std::cout << m_prefix << "New " << m_name << ": your gaming references suck" << std::endl;
+}
+
+SuperTrap::SuperTrap(SuperTrap const& other)
+{
+ *this = other;
+}
+
+void SuperTrap::operator=(SuperTrap const& other)
+{
+ m_hitPoints = other.m_hitPoints;
+ m_maxHitPoints = other.m_maxHitPoints;
+ m_energyPoints = other.m_energyPoints;
+ m_maxEnergyPoints = other.m_maxEnergyPoints;
+ m_level = other.m_level;
+ m_meleeAttackDamage = other.m_meleeAttackDamage;
+ m_rangedAttackDamage = other.m_rangedAttackDamage;
+ m_armorDamageReduction = other.m_armorDamageReduction;
+}
+
+SuperTrap::~SuperTrap()
+{
+ std::cout << "SUP3R-TP" << "Delete "<< m_name << ": your gaming references still suck" << std::endl;
+}
+
+void SuperTrap::rangedAttack(std::string const& target) const
+{
+ FragTrap::rangedArray(target);
+}
+
+void SuperTrap::meleeAttack(std::string const& target) const
+{
+ NinjaTrap::rangedArray(target);
+}