diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-01 10:18:22 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-01 10:18:22 +0100 |
commit | 798948dbe6f012e194f053c4e862cf697f30b793 (patch) | |
tree | 32c71420d1188f98cfb41b6f0d9536c5fa4bf5a7 /frontend/cmd/hit.cpp | |
parent | d7012045bb61f117fb7b9c51ddd03e4c54f25fe6 (diff) |
more WIP (move some Player things to backend)
Diffstat (limited to 'frontend/cmd/hit.cpp')
-rw-r--r-- | frontend/cmd/hit.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/frontend/cmd/hit.cpp b/frontend/cmd/hit.cpp index d3cb683..2f39e8a 100644 --- a/frontend/cmd/hit.cpp +++ b/frontend/cmd/hit.cpp @@ -3,20 +3,20 @@ #include "backend/RNG.h" #include "backend/print.h" -#include "../Player.h" +#include "../GameController.h" #include "../strings.h" using namespace std; -FollowupAction Player::cmd_hit(string & target_name) { +FollowupAction GameController::cmd_hit(string & target_name) { RNG & rng = RNG::get(); - for (Enemy * enemy : this->location.get_enemies()) { + for (Enemy * enemy : this->player.get_location().get_enemies()) { if (str_lower(enemy->get_name().c_str()) != str_lower(target_name)) continue; - if (rng.rand_double() > this->get_attack()) { + if (rng.rand_double() > this->player.get_attack()) { lprtf("Je hebt gemist!\n"); } else { - unsigned damage = rng.rand_int(this->weapon->get_damage_min(), this->weapon->get_damage_max() + 1); + unsigned damage = rng.rand_int(this->player.weapon->get_damage_min(), this->player.weapon->get_damage_max() + 1); enemy->take_damage(damage); lprtf("Je hebt %s geraakt en %d schade aangericht!\n", enemy->get_displayname().c_str(), damage); } |