From a7e84b60366c78b131d43157980fbe4c2df655e6 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 1 Nov 2024 16:03:53 +0100 Subject: small cleanup + checks --- frontend/cmd/view.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'frontend/cmd/view.cpp') 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; } -- cgit v1.2.3