aboutsummaryrefslogtreecommitdiff
path: root/backend/Player.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 16:03:53 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 16:03:53 +0100
commita7e84b60366c78b131d43157980fbe4c2df655e6 (patch)
tree391099bfd358e04c8ef38f33311f92b2cd607afe /backend/Player.cpp
parent798948dbe6f012e194f053c4e862cf697f30b793 (diff)
small cleanup + checks
Diffstat (limited to 'backend/Player.cpp')
-rw-r--r--backend/Player.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/backend/Player.cpp b/backend/Player.cpp
index a113a21..4180458 100644
--- a/backend/Player.cpp
+++ b/backend/Player.cpp
@@ -20,6 +20,8 @@ void Player::take_damage(unsigned int dmg) {
if (this->cheating) return;
dmg = min(dmg, this->health_points);
+ if (this->armor != nullptr)
+ dmg = max(0u, dmg - this->armor->get_protection());
this->health_points -= dmg;
lprtf("Je hebt nog %d levenspunten over.\n", this->health_points);