1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Banned arts and skills cannot be randomly rewarded

This commit is contained in:
nordsoft 2023-04-08 01:22:27 +04:00 committed by Nordsoft91
parent 26c3277895
commit b40a3a1b14

View File

@ -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())
{