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 /frontend/cmd | |
parent | 798948dbe6f012e194f053c4e862cf697f30b793 (diff) |
small cleanup + checks
Diffstat (limited to 'frontend/cmd')
-rw-r--r-- | frontend/cmd/query.cpp | 2 | ||||
-rw-r--r-- | frontend/cmd/view.cpp | 15 |
2 files changed, 12 insertions, 5 deletions
diff --git a/frontend/cmd/query.cpp b/frontend/cmd/query.cpp index f04e053..2a62b45 100644 --- a/frontend/cmd/query.cpp +++ b/frontend/cmd/query.cpp @@ -49,7 +49,7 @@ FollowupAction GameController::cmd_query(string &) { size_t enemies = 0; for (Enemy * enemy : location.get_enemies()) { if (enemies > 0) lprtf(", "); - lprtf("%s", enemy->get_name().c_str()); + lprtf("%s", enemy->get_displayname().c_str()); enemies++; } if (enemies == 0) diff --git a/frontend/cmd/view.cpp b/frontend/cmd/view.cpp index 69eb96e..04ad6aa 100644 --- a/frontend/cmd/view.cpp +++ b/frontend/cmd/view.cpp @@ -33,7 +33,7 @@ FollowupAction GameController::cmd_view(string & target) { lprtf("Je hebt %u goundstuk%s.\n", this->player.gold, this->player.gold == 1 ? "" : "ken"); size_t items = this->player.inventory.size(); - lprtf("Je hebt %d overige object%s%s\n", items, items == 1 ? "" : "en", items > 0 ? ":" : "."); + lprtf("Je hebt %d %s%s\n", items, items == 1 ? "overig object" : "overige objecten", items > 0 ? ":" : "."); for (auto & object : this->player.inventory) { lprtf("- %s\n", object->get_displayname().c_str()); } @@ -64,9 +64,16 @@ FollowupAction GameController::cmd_view(string & target) { lprtf("%s\n", enemy->get_description().c_str()); unsigned enemy_health = enemy->get_health(); lprtf("%s heeft %s levenspunten.\n", enemy->get_name().c_str(), enemy_health); - // IF enemy_health == 0: - // TODO: show enemy hidden objects - // TODO: move enemy hidden objects to location visible objects + + if (!enemy->is_dead()) return FollowupAction::NONE; + bool snatched = false; + for (Object * object : enemy->get_hidden_objects()) { + if (!snatched) lprtf("%s had de volgende voorwerpen:\n", enemy->get_displayname().c_str()); + lprtf("- %s\n", object->get_displayname().c_str()); + enemy->remove_hidden_object(object); + location.add_visible_object(object); + snatched = true; + } return FollowupAction::NONE; } |