aboutsummaryrefslogtreecommitdiff
path: root/backend/Dungeon.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 21:33:27 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 21:33:27 +0100
commitaf76b9a0ae58dc8c87548053a5bc310ad6be25ce (patch)
treeb2aa5927ed19855c101120593b59a9c3224804ad /backend/Dungeon.cpp
parentbdf6ac149ec260dab767663419731b302679f458 (diff)
more small tweaks
Diffstat (limited to 'backend/Dungeon.cpp')
-rw-r--r--backend/Dungeon.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/backend/Dungeon.cpp b/backend/Dungeon.cpp
index fed955b..e1fae39 100644
--- a/backend/Dungeon.cpp
+++ b/backend/Dungeon.cpp
@@ -17,15 +17,19 @@ void Dungeon::update() {
}
void Dungeon::update_attacks(ListRange<Enemy *> & enemies) {
- lprtf(":: De vijand%s in je locatie vallen aan! ::\n", enemies.size() == 1 ? "" : "en");
+ bool plural = enemies.size() != 1;
RNG & rng = RNG::get();
+ bool first = true;
for (Enemy * enemy : enemies) {
if (enemy->is_dead()) continue;
if (rng.rand_double() < enemy->get_attack()) continue;
+ if (!first)
+ lprtf(":: De %s in je locatie %s aan! ::\n", plural ? "vijanden" : "vijand", plural ? "vallen" : "valt");
- unsigned damage = rng.rand_int(enemy->get_damage_min(), enemy->get_damage_max() + 1);
+ unsigned damage = rng.rand_int(enemy->get_damage());
lprtf("%s raakt en doet %d punt schade.\n", enemy->get_displayname().c_str(), damage);
this->player.take_damage(damage);
+ first = false;
}
}