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 --- backend/Dungeon.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'backend/Dungeon.cpp') diff --git a/backend/Dungeon.cpp b/backend/Dungeon.cpp index ad721b4..84f9c79 100644 --- a/backend/Dungeon.cpp +++ b/backend/Dungeon.cpp @@ -20,6 +20,7 @@ void Dungeon::update_attacks(ListRange & enemies) { lprtf(":: De vijand%s in je locatie vallen aan! ::\n", enemies.size() == 1 ? "" : "en"); RNG & rng = RNG::get(); for (Enemy * enemy : enemies) { + if (enemy->is_dead()) continue; if (rng.rand_double() < enemy->get_attack()) continue; unsigned damage = rng.rand_int(enemy->get_damage_min(), enemy->get_damage_max() + 1); @@ -32,6 +33,7 @@ void Dungeon::update_movement() { bool moved = false; for (Location * location : this->locations) { for (Enemy * enemy : location->get_enemies()) { + if (enemy->is_dead()) continue; if (RNG::get().rand_double() < 0.5) continue; if (!moved) -- cgit v1.2.3