aboutsummaryrefslogtreecommitdiff
path: root/frontend/Player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'frontend/Player.cpp')
-rw-r--r--frontend/Player.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/frontend/Player.cpp b/frontend/Player.cpp
index fddea95..9ecbd08 100644
--- a/frontend/Player.cpp
+++ b/frontend/Player.cpp
@@ -53,3 +53,19 @@ FollowupAction Player::cmd(Argv argv) {
return FollowupAction::NONE;
}
+float Player::get_attack() {
+ if (this->cheating) return 1.f;
+ return this->attack_chance;
+}
+
+void Player::take_damage(unsigned int dmg) {
+ if (this->cheating) return;
+
+ dmg = min(dmg, this->health_points);
+ this->health_points -= dmg;
+
+ if (this->health_points == 0) {
+ this->cmdset_death();
+ }
+}
+