aboutsummaryrefslogtreecommitdiff
path: root/backend/Player.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 22:47:42 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 22:47:42 +0100
commit07796bea15a2d5f43766f062379b63fc9e9e1b5d (patch)
tree2d398f161a9a933176f50779ff164e76c3871f43 /backend/Player.cpp
parentaf76b9a0ae58dc8c87548053a5bc310ad6be25ce (diff)
WIP consumables
Diffstat (limited to 'backend/Player.cpp')
-rw-r--r--backend/Player.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/backend/Player.cpp b/backend/Player.cpp
index 2de5632..5e3e030 100644
--- a/backend/Player.cpp
+++ b/backend/Player.cpp
@@ -43,6 +43,7 @@ Location & Player::get_location() const {
}
void Player::set_location(Location & location) {
this->location = &location;
+ lprtf("Je staat nu bij de locatie %s.\n", location.get_name().c_str());
}
void Player::equip(WeaponObject * weapon) {
@@ -69,3 +70,20 @@ void Player::equip(ArmorObject * armor) {
lprtf("doet %s aan.\n", this->armor->get_name().c_str());
}
+void Player::add_health(unsigned int bonus) {
+ if (this->is_dead()) return;
+ this->health_points += bonus;
+ lprtf("Je hebt %d levenspunt%s erbij gekregen.\n", bonus, bonus == 1 ? "" : "en");
+}
+
+void Player::add_attack(float bonus) {
+ float max_bonus = 0.90f - this->attack_chance;
+ if (max_bonus < 0.f) {
+ lprtf("Je aanvalskans is niet verder verhoogd.\n");
+ return;
+ }
+ bonus = min(max_bonus, bonus);
+ this->attack_chance += bonus;
+ lprtf("Je aanvalskans is verhoogd met %.1f%%.\n", bonus * 100);
+}
+