diff options
Diffstat (limited to 'frontend/GameData.cpp')
-rw-r--r-- | frontend/GameData.cpp | 7 |
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) }); |