From dc7132d8b7f3074b5829cd3f17fe06bba6fc0221 Mon Sep 17 00:00:00 2001 From: Henning Koehler Date: Sun, 17 Sep 2017 10:02:04 +1200 Subject: [PATCH] converted castle.json; fixed bugs in Bonus::toJsonNode() --- config/heroes/castle.json | 324 +++++++++++++++++++++++++++++++------- lib/HeroBonus.cpp | 4 +- 2 files changed, 265 insertions(+), 63 deletions(-) diff --git a/config/heroes/castle.json b/config/heroes/castle.json index 99f4064a3..eae56d3bc 100644 --- a/config/heroes/castle.json +++ b/config/heroes/castle.json @@ -12,13 +12,13 @@ "specialty" : { "bonuses" : { "archery" : { - "type" : "SECONDARY_SKILL_PREMY", "subtype" : "skill.archery", - "valueType" : "PERCENT_TO_BASE", + "type" : "SECONDARY_SKILL_PREMY", "updater" : { - "type" : "GROWS_WITH_LEVEL", - "parameters" : [ 100 ] - } + "parameters" : [ 100 ], + "type" : "GROWS_WITH_LEVEL" + }, + "valueType" : "PERCENT_TO_BASE" } } } @@ -76,10 +76,38 @@ { "skill" : "leadership", "level": "basic" }, { "skill" : "armorer", "level": "basic" } ], - "specialties": - [ - { "type":1, "val": 0, "subtype": 0, "info": 4 } - ] + "specialty" : { + "base" : { + "limiters" : [ + { + "parameters" : [ "griffin", true ], + "type" : "CREATURE_TYPE_LIMITER" + } + ] + }, + "bonuses" : { + "attack" : { + "subtype" : "primSkill.attack", + "type" : "PRIMARY_SKILL", + "updater" : { + "parameters" : [ 8, 3 ], + "type" : "GROWS_WITH_LEVEL" + } + }, + "defence" : { + "subtype" : "primSkill.defence", + "type" : "PRIMARY_SKILL", + "updater" : { + "parameters" : [ 8, 3 ], + "type" : "GROWS_WITH_LEVEL" + } + }, + "speed" : { + "type" : "STACKS_SPEED", + "val" : 1 + } + } + } }, "sylvia": { @@ -91,10 +119,19 @@ { "skill" : "leadership", "level": "basic" }, { "skill" : "navigation", "level": "basic" } ], - "specialties": - [ - { "type":2, "val": 2, "subtype": 5, "info": 1 } - ] + "specialty" : { + "bonuses" : { + "navigation" : { + "subtype" : "skill.navigation", + "type" : "SECONDARY_SKILL_PREMY", + "updater" : { + "parameters" : [ 40 ], + "type" : "GROWS_WITH_LEVEL" + }, + "valueType" : "PERCENT_TO_BASE" + } + } + } }, "lordHaart": { @@ -107,10 +144,19 @@ { "skill" : "leadership", "level": "basic" }, { "skill" : "estates", "level": "basic" } ], - "specialties": - [ - { "type":2, "val": 5, "subtype": 13, "info": 0 } - ] + "specialty" : { + "bonuses" : { + "estates" : { + "subtype" : "skill.estates", + "type" : "SECONDARY_SKILL_PREMY", + "updater" : { + "parameters" : [ 100 ], + "type" : "GROWS_WITH_LEVEL" + }, + "valueType" : "PERCENT_TO_BASE" + } + } + } }, "sorsha": { @@ -122,10 +168,38 @@ { "skill" : "leadership", "level": "basic" }, { "skill" : "offence", "level": "basic" } ], - "specialties": - [ - { "type":1, "val": 0, "subtype": 0, "info": 6 } - ] + "specialty" : { + "base" : { + "limiters" : [ + { + "parameters" : [ "swordsman", true ], + "type" : "CREATURE_TYPE_LIMITER" + } + ] + }, + "bonuses" : { + "attack" : { + "subtype" : "primSkill.attack", + "type" : "PRIMARY_SKILL", + "updater" : { + "parameters" : [ 10, 4 ], + "type" : "GROWS_WITH_LEVEL" + } + }, + "defence" : { + "subtype" : "primSkill.defence", + "type" : "PRIMARY_SKILL", + "updater" : { + "parameters" : [ 12, 4 ], + "type" : "GROWS_WITH_LEVEL" + } + }, + "speed" : { + "type" : "STACKS_SPEED", + "val" : 1 + } + } + } }, "christian": { @@ -137,10 +211,38 @@ { "skill" : "leadership", "level": "basic" }, { "skill" : "artillery", "level": "basic" } ], - "specialties": - [ - { "type":1, "val": 0, "subtype": 0, "info": 146 } - ] + "specialty" : { + "base" : { + "limiters" : [ + { + "parameters" : [ "ballista", true ], + "type" : "CREATURE_TYPE_LIMITER" + } + ] + }, + "bonuses" : { + "attack" : { + "subtype" : "primSkill.attack", + "type" : "PRIMARY_SKILL", + "updater" : { + "parameters" : [ 10, 5 ], + "type" : "GROWS_WITH_LEVEL" + } + }, + "defence" : { + "subtype" : "primSkill.defence", + "type" : "PRIMARY_SKILL", + "updater" : { + "parameters" : [ 10, 5 ], + "type" : "GROWS_WITH_LEVEL" + } + }, + "speed" : { + "type" : "STACKS_SPEED", + "val" : 1 + } + } + } }, "tyris": { @@ -152,10 +254,38 @@ { "skill" : "leadership", "level": "basic" }, { "skill" : "tactics", "level": "basic" } ], - "specialties": - [ - { "type":1, "val": 0, "subtype": 0, "info": 10 } - ] + "specialty" : { + "base" : { + "limiters" : [ + { + "parameters" : [ "cavalier", true ], + "type" : "CREATURE_TYPE_LIMITER" + } + ] + }, + "bonuses" : { + "attack" : { + "subtype" : "primSkill.attack", + "type" : "PRIMARY_SKILL", + "updater" : { + "parameters" : [ 15, 6 ], + "type" : "GROWS_WITH_LEVEL" + } + }, + "defence" : { + "subtype" : "primSkill.defence", + "type" : "PRIMARY_SKILL", + "updater" : { + "parameters" : [ 15, 6 ], + "type" : "GROWS_WITH_LEVEL" + } + }, + "speed" : { + "type" : "STACKS_SPEED", + "val" : 1 + } + } + } }, "rion": { @@ -168,10 +298,19 @@ { "skill" : "wisdom", "level": "basic" }, { "skill" : "firstAid", "level": "basic" } ], - "specialties": - [ - { "type":2, "val": 5, "subtype": 27, "info": 0 } - ] + "specialty" : { + "bonuses" : { + "firstAid" : { + "subtype" : "skill.firstAid", + "type" : "SECONDARY_SKILL_PREMY", + "updater" : { + "parameters" : [ 100 ], + "type" : "GROWS_WITH_LEVEL" + }, + "valueType" : "PERCENT_TO_BASE" + } + } + } }, "adela": { @@ -184,10 +323,16 @@ { "skill" : "wisdom", "level": "basic" }, { "skill" : "diplomacy", "level": "basic" } ], - "specialties": - [ - { "type":6, "val": 3, "subtype": 41, "info": 0 } - ] + "specialty" : { + "bonuses" : { + "bless" : { + "addInfo" : 0, + "subtype" : "spell.bless", + "type" : "SPECIAL_BLESS_DAMAGE", + "val" : 3 + } + } + } }, "cuthbert": { @@ -200,10 +345,15 @@ { "skill" : "wisdom", "level": "basic" }, { "skill" : "estates", "level": "basic" } ], - "specialties": - [ - { "type":8, "val": 0, "subtype": 45, "info": 0 } - ] + "specialty" : { + "bonuses" : { + "weakness" : { + "addInfo" : 0, + "subtype" : "spell.weakness", + "type" : "SPECIAL_PECULIAR_ENCHANT" + } + } + } }, "adelaide": { @@ -215,10 +365,15 @@ [ { "skill" : "wisdom", "level": "advanced" } ], - "specialties": - [ - { "type":3, "val": 3, "subtype": 20, "info": 0 } - ] + "specialty" : { + "bonuses" : { + "frostRing" : { + "subtype" : "spell.frostRing", + "type" : "SPECIAL_SPELL_LEV", + "val" : 3 + } + } + } }, "ingham": { @@ -231,10 +386,38 @@ { "skill" : "wisdom", "level": "basic" }, { "skill" : "mysticism", "level": "basic" } ], - "specialties": - [ - { "type":1, "val": 0, "subtype": 0, "info": 8 } - ] + "specialty" : { + "base" : { + "limiters" : [ + { + "parameters" : [ "monk", true ], + "type" : "CREATURE_TYPE_LIMITER" + } + ] + }, + "bonuses" : { + "attack" : { + "subtype" : "primSkill.attack", + "type" : "PRIMARY_SKILL", + "updater" : { + "parameters" : [ 12, 5 ], + "type" : "GROWS_WITH_LEVEL" + } + }, + "defence" : { + "subtype" : "primSkill.defence", + "type" : "PRIMARY_SKILL", + "updater" : { + "parameters" : [ 7, 5 ], + "type" : "GROWS_WITH_LEVEL" + } + }, + "speed" : { + "type" : "STACKS_SPEED", + "val" : 1 + } + } + } }, "sanya": { @@ -247,10 +430,19 @@ { "skill" : "wisdom", "level": "basic" }, { "skill" : "eagleEye", "level": "basic" } ], - "specialties": - [ - { "type":2, "val": 5, "subtype": 11, "info": 0 } - ] + "specialty" : { + "bonuses" : { + "eagleEye" : { + "subtype" : "skill.eagleEye", + "type" : "SECONDARY_SKILL_PREMY", + "updater" : { + "parameters" : [ 100 ], + "type" : "GROWS_WITH_LEVEL" + }, + "valueType" : "PERCENT_TO_BASE" + } + } + } }, "loynis": { @@ -263,10 +455,15 @@ { "skill" : "wisdom", "level": "basic" }, { "skill" : "learning", "level": "basic" } ], - "specialties": - [ - { "type":8, "val": 0, "subtype": 48, "info": 0 } - ] + "specialty" : { + "bonuses" : { + "prayer" : { + "addInfo" : 0, + "subtype" : "spell.prayer", + "type" : "SPECIAL_PECULIAR_ENCHANT" + } + } + } }, "caitlin": { @@ -279,9 +476,14 @@ { "skill" : "wisdom", "level": "basic" }, { "skill" : "intelligence", "level": "basic" } ], - "specialties": - [ - { "type":10, "val": 350, "subtype": 6, "info": 0 } - ] + "specialty" : { + "bonuses" : { + "gold" : { + "subtype" : "resource.gold", + "type" : "GENERATE_RESOURCE", + "val" : 350 + } + } + } } } diff --git a/lib/HeroBonus.cpp b/lib/HeroBonus.cpp index 327055d3a..3cd66775f 100644 --- a/lib/HeroBonus.cpp +++ b/lib/HeroBonus.cpp @@ -1173,7 +1173,7 @@ JsonNode subtypeToJson(Bonus::BonusType type, int subtype) case Bonus::SPECIAL_UPGRADE: return JsonUtils::stringNode("creature." + CreatureID::encode(subtype)); case Bonus::GENERATE_RESOURCE: - return JsonUtils::stringNode(GameConstants::RESOURCE_NAMES[subtype]); + return JsonUtils::stringNode("resource." + GameConstants::RESOURCE_NAMES[subtype]); default: return JsonUtils::intNode(subtype); } @@ -1202,7 +1202,7 @@ JsonNode Bonus::toJsonNode() const if(val != 0) root["val"].Integer() = val; if(valType != ADDITIVE_VALUE) - root["valType"].String() = vstd::findKey(bonusValueMap, valType); + root["valueType"].String() = vstd::findKey(bonusValueMap, valType); if(limiter) root["limiters"].Vector().push_back(limiter->toJsonNode()); if(updater)