mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-26 03:52:01 +02:00
Revert "Random selection for secondary skills"
This reverts commit 6e538dab30bcdb472c4fd3fb155794c63c83b9ba.
This commit is contained in:
parent
6c5f3f21a5
commit
b7ccc4d649
@ -20,7 +20,6 @@
|
||||
#include "../CCreatureHandler.h"
|
||||
#include "../CCreatureSet.h"
|
||||
#include "../spells/CSpellHandler.h"
|
||||
#include "../CSkillHandler.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
@ -118,40 +117,11 @@ namespace JsonRandom
|
||||
std::map<SecondarySkill, si32> loadSecondary(const JsonNode & value, CRandomGenerator & rng)
|
||||
{
|
||||
std::map<SecondarySkill, si32> ret;
|
||||
std::vector<SecondarySkill> except;
|
||||
|
||||
for(const auto & pair : value.Struct())
|
||||
{
|
||||
std::string skillName = pair.first;
|
||||
|
||||
if(skillName == "random")
|
||||
{
|
||||
if(pair.second.isNumber())
|
||||
skillName = RandomGeneratorUtil::nextItem(VLC->skillh->objects, rng)->get()->getNameTextID();
|
||||
else
|
||||
{
|
||||
auto skill = *RandomGeneratorUtil::nextItem(loadSecondary(pair.second, rng), rng);
|
||||
ret[skill.first] = skill.second;
|
||||
}
|
||||
}
|
||||
else if(skillName == "except")
|
||||
{
|
||||
for(auto & i : pair.second.Vector())
|
||||
{
|
||||
SecondarySkill id(VLC->modh->identifiers.getIdentifier(pair.second.meta, "skill", i.String()).get());
|
||||
except.push_back(id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SecondarySkill id(VLC->modh->identifiers.getIdentifier(pair.second.meta, "skill", pair.first).get());
|
||||
ret[id] = loadValue(pair.second, rng);
|
||||
}
|
||||
SecondarySkill id(VLC->modh->identifiers.getIdentifier(pair.second.meta, "skill", pair.first).get());
|
||||
ret[id] = loadValue(pair.second, rng);
|
||||
}
|
||||
|
||||
for(auto & i : except)
|
||||
ret.erase(i);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user