aboutsummaryrefslogtreecommitdiff
path: root/cpp03/ex04/ScavTrap.cpp
blob: d310ab183234359a1debc6d6c4545d2ae114e941 (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   ScavTrap.cpp                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   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       */
/*                                                                            */
/* ************************************************************************** */

#include "ScavTrap.hpp"

ScavTrap::ScavTrap():
    ClapTrap()
{
    m_prefix = "SC4V-TP ";
    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;
}

ScavTrap::ScavTrap(std::string name):
    ClapTrap(name)
{
    m_prefix = "SC4V-TP ";
    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;
}

ScavTrap::ScavTrap(ScavTrap const& other)
{
    *this = other;
}

void ScavTrap::operator=(ScavTrap 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;
}

ScavTrap::~ScavTrap()
{
	std::cout << "SC4V-TP Delete " << m_name << ": your gaming references still suck" << std::endl;
}

void ScavTrap::challengeNewcomer(std::string const& target)
{
    std::string challenges[5] = {
        "lick your elbow",
        "do 1 push up",
        "dont talk for 1 hour",
        "draw your name by peeing in the snow",
        "punch me"
    };
	std::cout << "SC4V-TP " << m_name
              << " challenge " << target
              << " to " << challenges[rand() % 5] << std::endl;
    m_energyPoints -= 25;
}