mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
skills.json uses base and struct for effects
This commit is contained in:
@@ -18,17 +18,20 @@
|
|||||||
"description": "localizable description"
|
"description": "localizable description"
|
||||||
},
|
},
|
||||||
"effects": {
|
"effects": {
|
||||||
"type": "array",
|
"type": "object",
|
||||||
"items": {
|
"additionalProperties" : {
|
||||||
"$ref" : "vcmi:bonus"
|
"$ref" : "vcmi:bonus"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"required" : ["basic", "advanced", "expert"],
|
"required" : ["base", "basic", "advanced", "expert"],
|
||||||
|
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"base":{
|
||||||
|
"$ref" : "#/definitions/skillBonus"
|
||||||
|
},
|
||||||
"basic":{
|
"basic":{
|
||||||
"$ref" : "#/definitions/skillBonus"
|
"$ref" : "#/definitions/skillBonus"
|
||||||
},
|
},
|
||||||
|
|||||||
1109
config/skills.json
1109
config/skills.json
File diff suppressed because it is too large
Load Diff
@@ -147,9 +147,9 @@ CSkill * CSkillHandler::loadFromJson(const JsonNode & json, const std::string &
|
|||||||
const std::string & levelName = NSecondarySkill::levels[level]; // basic, advanced, expert
|
const std::string & levelName = NSecondarySkill::levels[level]; // basic, advanced, expert
|
||||||
const JsonNode & levelNode = json[levelName];
|
const JsonNode & levelNode = json[levelName];
|
||||||
// parse bonus effects
|
// parse bonus effects
|
||||||
for(auto b : levelNode["effects"].Vector())
|
for(auto b : levelNode["effects"].Struct())
|
||||||
{
|
{
|
||||||
auto bonus = JsonUtils::parseBonus(b);
|
auto bonus = JsonUtils::parseBonus(b.second);
|
||||||
bonus->sid = skill->id;
|
bonus->sid = skill->id;
|
||||||
skill->addNewBonus(bonus, level);
|
skill->addNewBonus(bonus, level);
|
||||||
}
|
}
|
||||||
@@ -198,6 +198,16 @@ void CSkillHandler::afterLoadFinalization()
|
|||||||
|
|
||||||
void CSkillHandler::beforeValidate(JsonNode & object)
|
void CSkillHandler::beforeValidate(JsonNode & object)
|
||||||
{
|
{
|
||||||
|
//handle "base" level info
|
||||||
|
JsonNode & base = object["base"];
|
||||||
|
|
||||||
|
auto inheritNode = [&](const std::string & name){
|
||||||
|
JsonUtils::inherit(object[name], base);
|
||||||
|
};
|
||||||
|
|
||||||
|
inheritNode("basic");
|
||||||
|
inheritNode("advanced");
|
||||||
|
inheritNode("expert");
|
||||||
}
|
}
|
||||||
|
|
||||||
CSkillHandler::~CSkillHandler()
|
CSkillHandler::~CSkillHandler()
|
||||||
|
|||||||
Reference in New Issue
Block a user