From 10fbe7b11ed7e4f36d83a9bbaf84de41da0e9a51 Mon Sep 17 00:00:00 2001 From: mateuszb Date: Mon, 25 Feb 2013 09:48:26 +0000 Subject: [PATCH] primary skill identifiers for bonuses --- config/artifacts.json | 158 ++++++++++++++++++++--------------------- config/commanders.json | 6 +- config/spell_info.json | 20 +++--- lib/CModHandler.cpp | 8 +++ 4 files changed, 100 insertions(+), 92 deletions(-) diff --git a/config/artifacts.json b/config/artifacts.json index c3bf0c15b..26ac62244 100644 --- a/config/artifacts.json +++ b/config/artifacts.json @@ -40,7 +40,7 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" @@ -53,7 +53,7 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" @@ -66,7 +66,7 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" @@ -79,7 +79,7 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 5, "valueType" : "BASE_NUMBER" @@ -92,7 +92,7 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" @@ -105,13 +105,13 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 12, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : -3, "valueType" : "BASE_NUMBER" @@ -124,7 +124,7 @@ { "bonuses" : [ { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" @@ -137,7 +137,7 @@ { "bonuses" : [ { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" @@ -150,7 +150,7 @@ { "bonuses" : [ { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" @@ -163,7 +163,7 @@ { "bonuses" : [ { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 5, "valueType" : "BASE_NUMBER" @@ -176,7 +176,7 @@ { "bonuses" : [ { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" @@ -189,7 +189,7 @@ { "bonuses" : [ { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 12, "valueType" : "BASE_NUMBER" @@ -208,7 +208,7 @@ { "bonuses" : [ { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 1, "valueType" : "BASE_NUMBER" @@ -221,7 +221,7 @@ { "bonuses" : [ { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" @@ -234,7 +234,7 @@ { "bonuses" : [ { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" @@ -247,7 +247,7 @@ { "bonuses" : [ { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" @@ -260,7 +260,7 @@ { "bonuses" : [ { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 5, "valueType" : "BASE_NUMBER" @@ -273,13 +273,13 @@ { "bonuses" : [ { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 10, "valueType" : "BASE_NUMBER" }, { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : -2, "valueType" : "BASE_NUMBER" @@ -292,7 +292,7 @@ { "bonuses" : [ { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 1, "valueType" : "BASE_NUMBER" @@ -305,7 +305,7 @@ { "bonuses" : [ { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" @@ -318,7 +318,7 @@ { "bonuses" : [ { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" @@ -331,7 +331,7 @@ { "bonuses" : [ { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" @@ -344,7 +344,7 @@ { "bonuses" : [ { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 5, "valueType" : "BASE_NUMBER" @@ -357,13 +357,13 @@ { "bonuses" : [ { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 10, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : -2, "valueType" : "BASE_NUMBER" @@ -376,25 +376,25 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 1, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 1, "valueType" : "BASE_NUMBER" }, { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 1, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 1, "valueType" : "BASE_NUMBER" @@ -407,25 +407,25 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" }, { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" @@ -438,25 +438,25 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" }, { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" @@ -469,25 +469,25 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" }, { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" @@ -500,25 +500,25 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 5, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 5, "valueType" : "BASE_NUMBER" }, { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 5, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 5, "valueType" : "BASE_NUMBER" @@ -531,25 +531,25 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" }, { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" @@ -562,13 +562,13 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 1, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 1, "valueType" : "BASE_NUMBER" @@ -581,13 +581,13 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" @@ -600,13 +600,13 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" @@ -619,13 +619,13 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" @@ -638,13 +638,13 @@ { "bonuses" : [ { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 1, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 1, "valueType" : "BASE_NUMBER" @@ -657,13 +657,13 @@ { "bonuses" : [ { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 2, "valueType" : "BASE_NUMBER" @@ -676,13 +676,13 @@ { "bonuses" : [ { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" @@ -695,13 +695,13 @@ { "bonuses" : [ { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 4, "valueType" : "BASE_NUMBER" @@ -1784,14 +1784,14 @@ "bonuses" : [ { "limiters" : ["DRAGON_NATURE"], - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 5, "valueType" : "BASE_NUMBER" }, { "limiters" : ["DRAGON_NATURE"], - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 5, "valueType" : "BASE_NUMBER" @@ -1816,25 +1816,25 @@ "valueType" : "BASE_NUMBER" }, { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" }, { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 3, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" @@ -1980,25 +1980,25 @@ "valueType" : "INDEPENDENT_MAX" }, { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" }, { - "subtype" : 1, + "subtype" : "primSkill.defence", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" }, { - "subtype" : 2, + "subtype" : "primSkill.spellpower", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" }, { - "subtype" : 3, + "subtype" : "primSkill.knowledge", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" @@ -2349,7 +2349,7 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" @@ -2426,7 +2426,7 @@ { "bonuses" : [ { - "subtype" : 0, + "subtype" : "primSkill.attack", "type" : "PRIMARY_SKILL", "val" : 6, "valueType" : "BASE_NUMBER" diff --git a/config/commanders.json b/config/commanders.json index 9706137e2..c0ce282fd 100644 --- a/config/commanders.json +++ b/config/commanders.json @@ -33,7 +33,7 @@ {"ability": ["FIRE_SHIELD", 1, 1, 0 ], "skills": [1, 5]}, {"ability": ["ADDITIONAL_ATTACK", 1, 0, 0 ], "skills": [2, 3]}, {"ability": ["HP_REGENERATION", 50, 0, 0 ], "skills": [2, 4]}, - {"ability": ["SPELL_AFTER_ATTACK", 30, 74, 0 ], "skills": [2, 5]}, + {"ability": ["SPELL_AFTER_ATTACK", 30, "spell.paralyze", 0 ], "skills": [2, 5]}, {"ability": ["JOUSTING", 0, 0, 0 ], "skills": [3, 4]}, {"ability": ["DEATH_STARE", 1, 1, 0 ], "skills": [3,5]}, {"ability": ["FLYING", 0, 0, 0 ], "skills": [4,5]} @@ -46,7 +46,7 @@ [ { "level": 6, - "bonus": ["PRIMARY_SKILL", 1, 0, 0] + "bonus": ["PRIMARY_SKILL", 1, "primSkill.attack", 0] } ] }, @@ -114,7 +114,7 @@ [ { "level": 6, - "bonus": ["PRIMARY_SKILL", 1, 1, 0] + "bonus": ["PRIMARY_SKILL", 1, "primSkill.defence", 0] } ] } diff --git a/config/spell_info.json b/config/spell_info.json index 198267a67..8ce13a934 100644 --- a/config/spell_info.json +++ b/config/spell_info.json @@ -485,7 +485,7 @@ [ { "type": "PRIMARY_SKILL", - "subtype": 0, //ATTACK + "subtype": "primSkill.attack", "effectRange" : "ONLY_MELEE_FIGHT", "duration": "N_TURNS" } @@ -501,7 +501,7 @@ [ { "type": "PRIMARY_SKILL", - "subtype": 0, //ATTACK + "subtype": "primSkill.attack", "effectRange" : "ONLY_DISTANCE_FIGHT", "duration": "N_TURNS" } @@ -518,7 +518,7 @@ [ { "type": "PRIMARY_SKILL", - "subtype": 0, //ATTACK + "subtype": "primSkill.attack", "duration": "N_TURNS", "values":[-3,-3,-6,-6] } @@ -534,7 +534,7 @@ [ { "type": "PRIMARY_SKILL", - "subtype": 1, //DEFENSE + "subtype": "primSkill.defence", "duration": "N_TURNS" } ] @@ -549,7 +549,7 @@ [ { "type": "PRIMARY_SKILL", - "subtype": 1, //DEFENSE + "subtype": "primSkill.defence", "valueType": "ADDITIVE_VALUE", "duration": "N_TURNS", "values":[-3,-3,-4,-5] @@ -566,12 +566,12 @@ [ { "type": "PRIMARY_SKILL", - "subtype": 0, //ATTACK + "subtype": "primSkill.attack", "duration": "N_TURNS" }, { "type": "PRIMARY_SKILL", - "subtype": 1, //DEFENSE + "subtype": "primSkill.defence", "duration": "N_TURNS" }, { @@ -935,13 +935,13 @@ [ { "type": "PRIMARY_SKILL", - "subtype": 0, + "subtype": "primSkill.attack", "duration": "N_TURNS", "values":[-2,-2,-2,-2] }, { "type": "PRIMARY_SKILL", - "subtype": 1, + "subtype": "primSkill.defence", "duration": "N_TURNS", "values":[-2,-2,-2,-2] } @@ -1026,7 +1026,7 @@ [ { "type": "PRIMARY_SKILL", - "subtype": 1, + "subtype": "primSkill.attack", "duration" : "PERMANENT", "valueType": "ADDITIVE_VALUE", "values":[-3,-3,-3,-3] diff --git a/lib/CModHandler.cpp b/lib/CModHandler.cpp index 1ff353846..fffd74936 100644 --- a/lib/CModHandler.cpp +++ b/lib/CModHandler.cpp @@ -51,7 +51,12 @@ void CIdentifierStorage::requestIdentifier(std::string name, const boost::functi if (iter != registeredObjects.end()) callback(iter->second); //already registered - trigger callback immediately else + { + if(boost::algorithm::starts_with(name, "primSkill.")) + tlog2 << "incorrect primSkill name requested\n"; + missingObjects[name].push_back(callback); // queue callback + } } void CIdentifierStorage::registerObject(std::string name, si32 identifier) @@ -93,6 +98,9 @@ CModHandler::CModHandler() identifiers.registerObject("resource." + GameConstants::RESOURCE_NAMES[i], i); } + for(int i=0; i