aboutsummaryrefslogtreecommitdiff
path: root/cpp04/ex03/AMateria.cpp
blob: b08c4f24d4dc475efdbf448ba36ec6d3e3015b46 (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   AMateria.cpp                                       :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/14 16:26:57 by charles           #+#    #+#             */
/*   Updated: 2020/11/13 14:26:28 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "AMateria.hpp"

AMateria::AMateria(AMateria const& other) : m_type(other.m_type)
{
    *this = other;
}

AMateria& AMateria::operator=(AMateria const& other)
{
    _xp    = other._xp;
    // subject doesn't want type to be copied
    return *this;
}

AMateria::~AMateria() {}

AMateria::AMateria(std::string const& type) : m_type(type), _xp(0) {}

std::string const& AMateria::getType() const { return m_type; }
unsigned int       AMateria::getXP()   const { return _xp;    }

void AMateria::use(ICharacter& target)
{
    (void)target;
    _xp += 10;
}

AMateria::AMateria() {}