diff --git a/config/objects/dwellings.json b/config/objects/dwellings.json index 43e1fc944..799b9ee3e 100644 --- a/config/objects/dwellings.json +++ b/config/objects/dwellings.json @@ -65,6 +65,7 @@ }, "airConflux": { "index": 7, + "bannedForRandomDwelling" : true, "creatures": [["airElemental"]], "sounds": { "ambient": ["LOOPAIR"] @@ -107,6 +108,7 @@ }, "earthConflux": { "index": 13, + "bannedForRandomDwelling" : true, "creatures": [["earthElemental"]], "sounds": { "ambient": ["LOOPEART"] @@ -128,6 +130,7 @@ }, "fireConflux": { "index": 16, + "bannedForRandomDwelling" : true, "creatures": [["fireElemental"]], "sounds": { "ambient": ["LOOPFIRE"] @@ -345,6 +348,7 @@ }, "waterConflux": { "index": 47, + "bannedForRandomDwelling" : true, "creatures": [["waterElemental"]], "sounds": { "ambient": ["LOOPFOUN"] @@ -538,6 +542,7 @@ "types" : { "elementalConflux" : { "index" : 0, + "bannedForRandomDwelling" : true, "creatures" : [ // 4 separate "levels" to give them separate growth [ "airElemental" ], [ "waterElemental" ], diff --git a/lib/mapObjectConstructors/DwellingInstanceConstructor.cpp b/lib/mapObjectConstructors/DwellingInstanceConstructor.cpp index 83f20becf..b6fe21715 100644 --- a/lib/mapObjectConstructors/DwellingInstanceConstructor.cpp +++ b/lib/mapObjectConstructors/DwellingInstanceConstructor.cpp @@ -51,6 +51,12 @@ void DwellingInstanceConstructor::initTypeData(const JsonNode & input) assert(!availableCreatures[currentLevel].empty()); } guards = input["guards"]; + bannedForRandomDwelling = input["bannedForRandomDwelling"].Bool(); +} + +bool DwellingInstanceConstructor::isBannedForRandomDwelling() const +{ + return bannedForRandomDwelling; } bool DwellingInstanceConstructor::objectFilter(const CGObjectInstance * obj, std::shared_ptr tmpl) const diff --git a/lib/mapObjectConstructors/DwellingInstanceConstructor.h b/lib/mapObjectConstructors/DwellingInstanceConstructor.h index bf68fdb26..ac82e2e87 100644 --- a/lib/mapObjectConstructors/DwellingInstanceConstructor.h +++ b/lib/mapObjectConstructors/DwellingInstanceConstructor.h @@ -23,6 +23,7 @@ class DwellingInstanceConstructor : public CDefaultObjectTypeHandler std::vector> availableCreatures; JsonNode guards; + bool bannedForRandomDwelling = false; protected: bool objectFilter(const CGObjectInstance * obj, std::shared_ptr tmpl) const override; @@ -34,6 +35,7 @@ public: void initializeObject(CGDwelling * object) const override; void randomizeObject(CGDwelling * object, CRandomGenerator & rng) const override; + bool isBannedForRandomDwelling() const; bool producesCreature(const CCreature * crea) const; std::vector getProducedCreatures() const; }; diff --git a/lib/mapObjects/CGDwelling.cpp b/lib/mapObjects/CGDwelling.cpp index ce357cba9..5375a39ec 100644 --- a/lib/mapObjects/CGDwelling.cpp +++ b/lib/mapObjects/CGDwelling.cpp @@ -146,7 +146,7 @@ void CGDwelling::pickRandomObject(CRandomGenerator & rand) { const auto * handler = dynamic_cast(VLC->objtypeh->getHandlerFor(primaryID, entry).get()); - if (handler->producesCreature(cid.toCreature())) + if (!handler->isBannedForRandomDwelling() && handler->producesCreature(cid.toCreature())) return MapObjectSubID(entry); } return MapObjectSubID();