diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-12 10:54:47 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-12 10:54:47 +0100 |
| commit | 96dcf214a8c40529b251ea31ef037868583dd1da (patch) | |
| tree | ecbb74fd1982829b550f5b5f5451497245db1358 /cpp03/ex02/ClapTrap.cpp | |
| parent | 2e0cf63a219d24ef07412deca9b0e6cb02882b46 (diff) | |
| download | piscine_cpp-96dcf214a8c40529b251ea31ef037868583dd1da.tar.gz piscine_cpp-96dcf214a8c40529b251ea31ef037868583dd1da.tar.bz2 piscine_cpp-96dcf214a8c40529b251ea31ef037868583dd1da.zip | |
Fixing cpp03, moved more common logic in ClapTrap, Added better main
Diffstat (limited to 'cpp03/ex02/ClapTrap.cpp')
| -rw-r--r-- | cpp03/ex02/ClapTrap.cpp | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/cpp03/ex02/ClapTrap.cpp b/cpp03/ex02/ClapTrap.cpp index 4c712c3..550cef4 100644 --- a/cpp03/ex02/ClapTrap.cpp +++ b/cpp03/ex02/ClapTrap.cpp @@ -6,32 +6,18 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 15:28:43 by charles #+# #+# */ -/* Updated: 2020/11/11 06:41:35 by cacharle ### ########.fr */ +/* Updated: 2020/11/12 10:08:15 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "ClapTrap.hpp" -ClapTrap::ClapTrap(): - 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 << "CL4P-TP New " << m_name << ": your gaming references suck" << std::endl; -} - ClapTrap::ClapTrap(std::string const& name): - m_hitPoints(100), - m_maxHitPoints(100), - m_energyPoints(100), - m_maxEnergyPoints(100), - m_level(1), + m_hitPoints(0), + m_maxHitPoints(0), + m_energyPoints(0), + m_maxEnergyPoints(0), + m_level(0), m_name(name), m_meleeAttackDamage(0), m_rangedAttackDamage(0), @@ -42,6 +28,7 @@ ClapTrap::ClapTrap(std::string const& name): ClapTrap::ClapTrap(ClapTrap const& other) { + std::cout << "CL4P-TP New from " << other.m_name << std::endl; *this = other; } @@ -73,7 +60,7 @@ void ClapTrap::rangedAttack(std::string const& target) const void ClapTrap::meleeAttack(std::string const& target) const { - std::cout << "CL4P-TP " << m_name + std::cout << "CL4P-TP " << m_name << " attacks " << target << " in melee mode causing " << m_meleeAttackDamage << " points of damage!" << std::endl; @@ -102,3 +89,5 @@ void ClapTrap::beRepaired(unsigned int amount) << " gained " << amount << " hit points" << std::endl; } + +ClapTrap::ClapTrap() {} |
