aboutsummaryrefslogtreecommitdiff
path: root/cpp03/ex04/SuperTrap.cpp
blob: 7e96570d9301a0678db8a34fcabf21bdda4ded85 (plain)
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
66
67
68
69
70
71
72
73
74
75
76
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   SuperTrap.cpp                                      :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/13 17:52:56 by charles           #+#    #+#             */
/*   Updated: 2020/11/10 14:44:33 by cacharle         ###   ########.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 const& 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;
    return *this;
}

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);
}