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 /backend/Dungeon.cpp | |
parent | 798948dbe6f012e194f053c4e862cf697f30b793 (diff) |
small cleanup + checks
Diffstat (limited to 'backend/Dungeon.cpp')
-rw-r--r-- | backend/Dungeon.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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<Enemy *> & 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) |