From 2e0cf63a219d24ef07412deca9b0e6cb02882b46 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Wed, 11 Nov 2020 08:27:14 +0100 Subject: Fixing small bugs in cpp03 --- cpp03/ex01/ScavTrap.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cpp03/ex01/ScavTrap.cpp') diff --git a/cpp03/ex01/ScavTrap.cpp b/cpp03/ex01/ScavTrap.cpp index 8379228..16b07e1 100644 --- a/cpp03/ex01/ScavTrap.cpp +++ b/cpp03/ex01/ScavTrap.cpp @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/13 14:15:03 by charles #+# #+# */ -/* Updated: 2020/11/10 15:06:00 by cacharle ### ########.fr */ +/* Updated: 2020/11/11 06:32:05 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -81,9 +81,10 @@ void ScavTrap::meleeAttack(std::string const& target) const void ScavTrap::takeDamage(unsigned int amount) { - amount -= m_armorDamageReduction; - if (amount < 0) + if (amount < m_armorDamageReduction) amount = 0; + else + amount -= m_armorDamageReduction; if (amount > m_hitPoints) amount = m_hitPoints; m_hitPoints -= amount; -- cgit