mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
skills.json uses base and struct for effects
This commit is contained in:
parent
3fe9bc34b8
commit
899e8403f7
@ -18,17 +18,20 @@
|
||||
"description": "localizable description"
|
||||
},
|
||||
"effects": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties" : {
|
||||
"$ref" : "vcmi:bonus"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"required" : ["basic", "advanced", "expert"],
|
||||
"required" : ["base", "basic", "advanced", "expert"],
|
||||
|
||||
"properties": {
|
||||
"base":{
|
||||
"$ref" : "#/definitions/skillBonus"
|
||||
},
|
||||
"basic":{
|
||||
"$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 JsonNode & levelNode = json[levelName];
|
||||
// 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;
|
||||
skill->addNewBonus(bonus, level);
|
||||
}
|
||||
@ -198,6 +198,16 @@ void CSkillHandler::afterLoadFinalization()
|
||||
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user