mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Revert @24efb9b4
This commit is contained in:
parent
8979de7960
commit
7a429fc38b
@ -703,7 +703,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
||||
});
|
||||
}
|
||||
|
||||
const std::string targetType = json["targetType"].String();
|
||||
auto targetType = json["targetType"].String();
|
||||
|
||||
if(targetType == "NO_TARGET")
|
||||
spell->targetType = CSpell::NO_TARGET;
|
||||
@ -711,16 +711,18 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
||||
spell->targetType = CSpell::CREATURE;
|
||||
else if(targetType == "OBSTACLE")
|
||||
spell->targetType = CSpell::OBSTACLE;
|
||||
else
|
||||
logGlobal->warnStream() << "Spell " << spell->name << ". Target type " << (targetType.empty() ? "empty" : "unknown ("+targetType+")") << ". Assumed NO_TARGET.";
|
||||
|
||||
|
||||
spell->mainEffectAnim = json["anim"].Float();
|
||||
|
||||
for(const auto & counteredSpell: json["counters"].Struct())
|
||||
if (counteredSpell.second.Bool())
|
||||
{
|
||||
VLC->modh->identifiers.requestIdentifier(json.meta, "spell", counteredSpell.first, [=](si32 id)
|
||||
{
|
||||
JsonNode tmp(JsonNode::DATA_STRING);
|
||||
tmp.meta = json.meta;
|
||||
tmp.String() = counteredSpell.first;
|
||||
|
||||
VLC->modh->identifiers.requestIdentifier(tmp,[=](si32 id){
|
||||
spell->counteredSpells.push_back(SpellID(id));
|
||||
});
|
||||
}
|
||||
@ -759,12 +761,12 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
||||
else if(!implicitPositiveness)
|
||||
{
|
||||
spell->positiveness = CSpell::NEUTRAL; //duplicates constructor but, just in case
|
||||
logGlobal->warnStream() << "Spell " << spell->name << ": no positiveness specified, assumed NEUTRAL";
|
||||
logGlobal->errorStream() << "No positiveness specified, assumed NEUTRAL";
|
||||
}
|
||||
|
||||
spell->isSpecial = flags["special"].Bool();
|
||||
|
||||
auto findBonus = [&](const std::string & name, std::vector<Bonus::BonusType> &vec)
|
||||
auto findBonus = [&](std::string name, std::vector<Bonus::BonusType> &vec)
|
||||
{
|
||||
auto it = bonusNameMap.find(name);
|
||||
if(it == bonusNameMap.end())
|
||||
@ -777,7 +779,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
||||
}
|
||||
};
|
||||
|
||||
auto readBonusStruct = [&](const std::string & name, std::vector<Bonus::BonusType> &vec)
|
||||
auto readBonusStruct = [&](std::string name, std::vector<Bonus::BonusType> &vec)
|
||||
{
|
||||
for(auto bonusData: json[name].Struct())
|
||||
{
|
||||
@ -794,6 +796,7 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
||||
readBonusStruct("limit", spell->limiters);
|
||||
readBonusStruct("absoluteLimit", spell->absoluteLimiters);
|
||||
|
||||
|
||||
const JsonNode & graphicsNode = json["graphics"];
|
||||
|
||||
spell->iconImmune = graphicsNode["iconImmune"].String();
|
||||
@ -802,11 +805,15 @@ CSpell * CSpellHandler::loadFromJson(const JsonNode& json)
|
||||
spell->iconScenarioBonus = graphicsNode["iconScenarioBonus"].String();
|
||||
spell->iconScroll = graphicsNode["iconScroll"].String();
|
||||
|
||||
|
||||
|
||||
const JsonNode & soundsNode = json["sounds"];
|
||||
|
||||
spell->castSound = soundsNode["cast"].String();
|
||||
|
||||
|
||||
//load level attributes
|
||||
|
||||
const int levelsCount = GameConstants::SPELL_SCHOOL_LEVELS;
|
||||
|
||||
for(int levelIndex = 0; levelIndex < levelsCount; levelIndex++)
|
||||
@ -870,6 +877,7 @@ void CSpellHandler::beforeValidate(JsonNode & object)
|
||||
inheritNode("basic");
|
||||
inheritNode("advanced");
|
||||
inheritNode("expert");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user