aboutsummaryrefslogtreecommitdiff
path: root/cpp03/ex02
diff options
context:
space:
mode:
Diffstat (limited to 'cpp03/ex02')
-rw-r--r--cpp03/ex02/ClapTrap.cpp6
-rw-r--r--cpp03/ex02/main.cpp4
2 files changed, 8 insertions, 2 deletions
diff --git a/cpp03/ex02/ClapTrap.cpp b/cpp03/ex02/ClapTrap.cpp
index 550cef4..870cbdd 100644
--- a/cpp03/ex02/ClapTrap.cpp
+++ b/cpp03/ex02/ClapTrap.cpp
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/13 15:28:43 by charles #+# #+# */
-/* Updated: 2020/11/12 10:08:15 by cacharle ### ########.fr */
+/* Updated: 2020/11/17 16:48:43 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -69,9 +69,13 @@ void ClapTrap::meleeAttack(std::string const& target) const
void ClapTrap::takeDamage(unsigned int amount)
{
if (amount < m_armorDamageReduction)
+ {
amount = 0;
+ }
else
+ {
amount -= m_armorDamageReduction;
+ }
if (amount > m_hitPoints)
amount = m_hitPoints;
m_hitPoints -= amount;
diff --git a/cpp03/ex02/main.cpp b/cpp03/ex02/main.cpp
index b8a03b6..92fd23b 100644
--- a/cpp03/ex02/main.cpp
+++ b/cpp03/ex02/main.cpp
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/22 05:41:27 by cacharle #+# #+# */
-/* Updated: 2020/11/12 10:41:46 by cacharle ### ########.fr */
+/* Updated: 2020/11/17 16:46:31 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -26,7 +26,9 @@ int main(void)
devRandom.close();
}
else
+ {
seed = time(NULL);
+ }
srand(seed);
{