Browse Source

Banned arts and skills cannot be randomly rewarded

nordsoft 2 năm trước cách đây
mục cha
commit
b40a3a1b14
1 tập tin đã thay đổi với 8 bổ sung0 xóa
  1. 8 0
      lib/mapObjects/JsonRandom.cpp

+ 8 - 0
lib/mapObjects/JsonRandom.cpp

@@ -21,6 +21,8 @@
 #include "../CCreatureSet.h"
 #include "../spells/CSpellHandler.h"
 #include "../CSkillHandler.h"
+#include "../mapObjects/CObjectHandler.h"
+#include "../IGameCallback.h"
 
 VCMI_LIB_NAMESPACE_BEGIN
 
@@ -132,7 +134,10 @@ namespace JsonRandom
 		{
 			std::set<std::string> defaultSkills;
 			for(const auto & skill : VLC->skillh->objects)
+			{
+				IObjectInterface::cb->isAllowed(2, skill->getIndex());
 				defaultSkills.insert(skill->getNameTextID());
+			}
 			
 			for(const auto & element : value.Vector())
 			{
@@ -177,6 +182,9 @@ namespace JsonRandom
 
 			if(!allowedClasses.empty() && !allowedClasses.count(art->aClass))
 				return false;
+			
+			if(!IObjectInterface::cb->isAllowed(1, art->getIndex()))
+				return false;
 
 			if(!allowedPositions.empty())
 			{