aboutsummaryrefslogtreecommitdiff
path: root/frontend/GameData.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 23:42:57 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-01 23:42:57 +0100
commit671a25463419691bc6c8d11bd57d932bdea9632b (patch)
tree8898e076bfd4b3d702c7c765bcb9d6d41947198d /frontend/GameData.cpp
parentf4d71aa6e241ae59ed7d305e8aadddf9d90b2b46 (diff)
more cleanup
Diffstat (limited to 'frontend/GameData.cpp')
-rw-r--r--frontend/GameData.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/frontend/GameData.cpp b/frontend/GameData.cpp
index 30816c8..3b9046d 100644
--- a/frontend/GameData.cpp
+++ b/frontend/GameData.cpp
@@ -6,6 +6,8 @@
#include "backend/LocationFactory.h"
#include "backend/Object.h"
#include "backend/ObjectFactory.h"
+#include "backend/RNG.h"
+#include "backend/Range.h"
#include "backend/print.h"
#include "GameData.h"
@@ -39,7 +41,10 @@ Enemy * GameData::create_enemy(const string & name) const {
try {
auto row = query.row();
auto enemy = unique_ptr<Enemy>{ EnemyFactory::create_enemy(row.col<const char *>(0), row.col<const char *>(1)) };
- // TODO: min/max objects(?)
+ int object_count = RNG::get().rand_int(Range<int> { row.col<int>(2), row.col<int>(3) });
+ vector<string> object_names = this->random_objects(object_count);
+ for (const string & name : object_names)
+ enemy->add_hidden_object(this->create_object(name));
enemy->set_health(row.col<int>(4));
enemy->set_attack(static_cast<float>(row.col<int>(5)) / 100);
enemy->set_damage({ row.col<int>(6), row.col<int>(7) });