diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-29 23:47:03 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-29 23:47:03 +0100 |
commit | e4261302944303781c952943e3290c99e2cabc52 (patch) | |
tree | 19ee0e065473adc54da008444da30c8075b03a27 /frontend | |
parent | b848109e8c70ee00b433ff8f5fde3657c85e7487 (diff) |
add todos
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/Player.cpp | 16 | ||||
-rw-r--r-- | frontend/Player.h | 5 | ||||
-rw-r--r-- | frontend/cmd/cheat.cpp | 3 | ||||
-rw-r--r-- | frontend/cmd/equip.cpp | 1 | ||||
-rw-r--r-- | frontend/cmd/get.cpp | 1 | ||||
-rw-r--r-- | frontend/cmd/hit.cpp | 1 | ||||
-rw-r--r-- | frontend/cmd/put.cpp | 1 | ||||
-rw-r--r-- | frontend/cmd/search.cpp | 1 | ||||
-rw-r--r-- | frontend/cmd/use.cpp | 1 | ||||
-rw-r--r-- | frontend/load_dungeon.cpp | 2 | ||||
-rw-r--r-- | frontend/main.cpp | 2 | ||||
-rw-r--r-- | frontend/rl.cpp | 2 |
12 files changed, 33 insertions, 3 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(); + } +} + diff --git a/frontend/Player.h b/frontend/Player.h index 40d47ad..c590aa9 100644 --- a/frontend/Player.h +++ b/frontend/Player.h @@ -26,6 +26,7 @@ private: // TODO: GoldObject[] // TODO: ArmorObject[] Location & location; + bool cheating = false; public: Player(Dungeon & dungeon); @@ -34,6 +35,10 @@ public: public: FollowupAction cmd(Argv argv); +public: + void take_damage(unsigned int dmg); + float get_attack(); + private: void cmdset_default(); void cmdset_death(); diff --git a/frontend/cmd/cheat.cpp b/frontend/cmd/cheat.cpp index ed4e452..6f1c163 100644 --- a/frontend/cmd/cheat.cpp +++ b/frontend/cmd/cheat.cpp @@ -1,6 +1,9 @@ #include "../Player.h" +#include "../print.h" FollowupAction Player::cmd_cheat(Argv argv) { + this->cheating = !this->cheating; + lprtf("Cheats staan nu %s.\n", this->cheating ? "aan" : "uit"); return FollowupAction::NONE; } diff --git a/frontend/cmd/equip.cpp b/frontend/cmd/equip.cpp index a713bd2..bcb261f 100644 --- a/frontend/cmd/equip.cpp +++ b/frontend/cmd/equip.cpp @@ -1,6 +1,7 @@ #include "../Player.h" FollowupAction Player::cmd_equip(Argv argv) { + // TODO return FollowupAction::UPDATE; } diff --git a/frontend/cmd/get.cpp b/frontend/cmd/get.cpp index 8c8194b..b703a0e 100644 --- a/frontend/cmd/get.cpp +++ b/frontend/cmd/get.cpp @@ -1,6 +1,7 @@ #include "../Player.h" FollowupAction Player::cmd_get(Argv argv) { + // TODO return FollowupAction::NONE; } diff --git a/frontend/cmd/hit.cpp b/frontend/cmd/hit.cpp index 740c348..17f9099 100644 --- a/frontend/cmd/hit.cpp +++ b/frontend/cmd/hit.cpp @@ -1,6 +1,7 @@ #include "../Player.h" FollowupAction Player::cmd_hit(Argv argv) { + // TODO return FollowupAction::UPDATE; } diff --git a/frontend/cmd/put.cpp b/frontend/cmd/put.cpp index ebf30da..8a6c828 100644 --- a/frontend/cmd/put.cpp +++ b/frontend/cmd/put.cpp @@ -1,6 +1,7 @@ #include "../Player.h" FollowupAction Player::cmd_put(Argv argv) { + // TODO return FollowupAction::NONE; } diff --git a/frontend/cmd/search.cpp b/frontend/cmd/search.cpp index 334c997..af22ca2 100644 --- a/frontend/cmd/search.cpp +++ b/frontend/cmd/search.cpp @@ -1,6 +1,7 @@ #include "../Player.h" FollowupAction Player::cmd_search(Argv argv) { + // TODO return FollowupAction::UPDATE; } diff --git a/frontend/cmd/use.cpp b/frontend/cmd/use.cpp index fca40c3..a7955eb 100644 --- a/frontend/cmd/use.cpp +++ b/frontend/cmd/use.cpp @@ -1,6 +1,7 @@ #include "../Player.h" FollowupAction Player::cmd_use(Argv argv) { + // TODO return FollowupAction::NONE; } diff --git a/frontend/load_dungeon.cpp b/frontend/load_dungeon.cpp index b60a7b9..ff68109 100644 --- a/frontend/load_dungeon.cpp +++ b/frontend/load_dungeon.cpp @@ -10,7 +10,7 @@ #include "load_dungeon.h" #include "Exception.h" -#include "frontend/strings.h" +#include "strings.h" using namespace std; using namespace pugi; diff --git a/frontend/main.cpp b/frontend/main.cpp index c421d9e..a5514bd 100644 --- a/frontend/main.cpp +++ b/frontend/main.cpp @@ -6,7 +6,7 @@ #include "Player.h" #include "Exception.h" -#include "frontend/print.h" +#include "print.h" #include "load_dungeon.h" #include "generate_dungeon.h" #include "rl.h" diff --git a/frontend/rl.cpp b/frontend/rl.cpp index 3e1cc37..1c0df0e 100644 --- a/frontend/rl.cpp +++ b/frontend/rl.cpp @@ -5,7 +5,7 @@ #include <readline/history.h> #include "rl.h" -#include "frontend/print.h" +#include "print.h" using namespace std; |