diff --git a/config/spell_info.json b/config/spell_info.json index 0e6201c2b..9df5071ed 100644 --- a/config/spell_info.json +++ b/config/spell_info.json @@ -760,12 +760,12 @@ { "type": "NOT_ACTIVE", "subtype": 62, - "duration": "UNITL_BEING_ATTACKED N_TURNS", + "duration": ["UNITL_BEING_ATTACKED","N_TURNS"], "values":[0,0,0,0] }, { "type": "GENERAL_ATTACK_REDUCTION", - "duration": "UNITL_BEING_ATTACKED N_TURNS" + "duration": ["UNITL_BEING_ATTACKED","N_TURNS"] }, { "type": "NO_RETALIATION", @@ -836,7 +836,7 @@ { "type": "NOT_ACTIVE", "subtype": 62, - "duration": "UNITL_BEING_ATTACKED N_TURNS", + "duration": ["UNITL_BEING_ATTACKED","N_TURNS"], "values":[0,0,0,0] }, { @@ -918,7 +918,7 @@ { "type": "NOT_ACTIVE", "subtype": 74, - "duration": "UNITL_BEING_ATTACKED N_TURNS", + "duration": ["UNITL_BEING_ATTACKED","N_TURNS"], "values":[0,0,0,0] }, { diff --git a/lib/JsonNode.cpp b/lib/JsonNode.cpp index 040202141..80ba9261d 100644 --- a/lib/JsonNode.cpp +++ b/lib/JsonNode.cpp @@ -943,7 +943,7 @@ void JsonUtils::resolveIdentifier (si32 &var, const JsonNode &node, std::string }); break; default: - tlog2 << "Error! Wrong indentifier used for value of " << name; + tlog2 << "Error! Wrong indentifier used for value of " << name; } } } @@ -962,7 +962,7 @@ void JsonUtils::resolveIdentifier (const JsonNode &node, si32 &var) }); break; default: - tlog2 << "Error! Wrong indentifier used for identifier!"; + tlog2 << "Error! Wrong indentifier used for identifier!"; } } @@ -1009,20 +1009,41 @@ Bonus * JsonUtils::parseBonus (const JsonNode &ability) value = &ability["effectRange"]; if (!value->isNull()) - b->valType = parseByMap(bonusLimitEffect, value, "effect range "); + b->effectRange = parseByMap(bonusLimitEffect, value, "effect range "); + value = &ability["duration"]; if (!value->isNull()) - b->valType = parseByMap(bonusDurationMap, value, "duration type "); + { + switch (value->getType()) + { + case JsonNode::DATA_STRING: + b->duration = parseByMap(bonusDurationMap, value, "duration type "); + break; + case JsonNode::DATA_VECTOR: + { + ui16 dur = 0; + BOOST_FOREACH (const JsonNode & d, value->Vector()) + { + dur |= parseByMap(bonusDurationMap, &d, "duration type "); + } + b->duration = dur; + } + break; + default: + tlog2 << "Error! Wrong bonus duration format."; + } + } + value = &ability["source"]; if (!value->isNull()) - b->valType = parseByMap(bonusSourceMap, value, "source type "); + b->source = parseByMap(bonusSourceMap, value, "source type "); value = &ability["limiters"]; if (!value->isNull()) { BOOST_FOREACH (const JsonNode & limiter, value->Vector()) { - switch (limiter.getType()) + switch (limiter.getType()) { case JsonNode::DATA_STRING: //pre-defined limiters b->limiter = parseByMap(bonusLimiterMap, &limiter, "limiter type ");