diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-01 16:03:53 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-01 16:03:53 +0100 |
commit | a7e84b60366c78b131d43157980fbe4c2df655e6 (patch) | |
tree | 391099bfd358e04c8ef38f33311f92b2cd607afe /backend/Player.cpp | |
parent | 798948dbe6f012e194f053c4e862cf697f30b793 (diff) |
small cleanup + checks
Diffstat (limited to 'backend/Player.cpp')
-rw-r--r-- | backend/Player.cpp | 2 |
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); |