1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Created spell_info.json from spell_info.txt.

This commit is contained in:
Frank Zago 2011-09-04 02:26:56 +00:00
parent 35350aeeff
commit 76268fac46
3 changed files with 106 additions and 113 deletions

87
config/spell_info.json Normal file
View File

@ -0,0 +1,87 @@
{
//additional spell info, not included in original heroes III files
//[spellID - -1 is the end of data in file] [-1 -> spell is negative for influenced creatures; 0 - spell is indifferent for them; 1 - spell is poitive for them] [main effect animation (AC format), -1 - none] [spell range description in SRSL, none magic] [basic] [advanced] [expert]
"spells": [
{ "id": 0, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 1, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 2, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 3, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 4, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 5, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 6, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 7, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 8, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 9, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 10, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 11, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 12, "effect": 0, "anim": -1, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 13, "effect": 0, "anim": -1, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 14, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 15, "effect": -1, "anim": 64, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 16, "effect": -1, "anim": 46, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 17, "effect": -1, "anim": 38, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 18, "effect": -1, "anim": 10, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 19, "effect": -1, "anim": -1, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 20, "effect": -1, "anim": 45, "ranges": [ "1", "1", "1", "1" ] },
{ "id": 21, "effect": -1, "anim": 53, "ranges": [ "0,1", "0,1", "0,1", "0,1" ] },
{ "id": 22, "effect": -1, "anim": 9, "ranges": [ "0-2", "0-2", "0-2", "0-2" ] },
{ "id": 23, "effect": -1, "anim": 16, "ranges": [ "0,1", "0,1", "0,1", "0,1" ] },
{ "id": 24, "effect": -1, "anim": 8, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 25, "effect": -1, "anim": 29, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 26, "effect": -1, "anim": 12, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 27, "effect": 1, "anim": 27, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 28, "effect": 1, "anim": 2, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 29, "effect": 1, "anim": 11, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 30, "effect": 1, "anim": 22, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 31, "effect": 1, "anim": 24, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 32, "effect": 1, "anim": 23, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 33, "effect": 1, "anim": 26, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 34, "effect": 1, "anim": 5, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 35, "effect": 0, "anim": 41, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 36, "effect": 1, "anim": 3, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 37, "effect": 1, "anim": 39, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 38, "effect": 1, "anim": 79, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 39, "effect": 1, "anim": 79, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 40, "effect": 1, "anim": -1, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 41, "effect": 1, "anim": 36, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 42, "effect": -1, "anim": 40, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 43, "effect": 1, "anim": 4, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 44, "effect": 1, "anim": 25, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 45, "effect": -1, "anim": 56, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 46, "effect": 1, "anim": 54, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 47, "effect": -1, "anim": 14, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 48, "effect": 1, "anim": 0, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 49, "effect": 1, "anim": 20, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 50, "effect": -1, "anim": 30, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 51, "effect": 1, "anim": 18, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 52, "effect": -1, "anim": 48, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 53, "effect": 1, "anim": 31, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 54, "effect": -1, "anim": 19, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 55, "effect": 1, "anim": 28, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 56, "effect": 1, "anim": 17, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 57, "effect": -1, "anim": 38, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 58, "effect": 1, "anim": 7, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 59, "effect": -1, "anim": 35, "ranges": [ "0", "0", "0-1", "0-2" ] },
{ "id": 60, "effect": -1, "anim": 21, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 61, "effect": -1, "anim": 42, "ranges": [ "0", "0", "0", "X" ] },
{ "id": 62, "effect": -1, "anim": 6, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 63, "effect": 1, "anim": -1, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 64, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 65, "effect": 1, "anim": -1, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 66, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 67, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 68, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 69, "effect": 0, "anim": -1, "ranges": [ "X", "X", "X", "X" ] },
{ "id": 70, "effect": 0, "anim": 70, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 71, "effect": -1, "anim": 67, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 72, "effect": 0, "anim": 68, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 73, "effect": -1, "anim": 69, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 74, "effect": -1, "anim": 70, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 75, "effect": -1, "anim": 71, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 76, "effect": 0, "anim": 72, "ranges": [ "0-1", "0-1", "0-1", "0-1" ] },
{ "id": 77, "effect": -1, "anim": 38, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 78, "effect": -1, "anim": 41, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 79, "effect": 0, "anim": 80, "ranges": [ "0", "0", "0", "0" ] },
{ "id": 80, "effect": 0, "anim": 81, "ranges": [ "0", "0", "0", "0" ] }
]
}

View File

@ -1,84 +0,0 @@
//additional spell info, not included in original heroes III files
//[spellID - -1 is the end of data in file] [-1 -> spell is negative for influenced creatures; 0 - spell is indifferent for them; 1 - spell is poitive for them] [main effect animation (AC format), -1 - none] [spell range description in SRSL, none magic] [basic] [advanced] [expert]
0 0 -1 X X X X
1 0 -1 X X X X
2 0 -1 X X X X
3 0 -1 X X X X
4 0 -1 X X X X
5 0 -1 X X X X
6 0 -1 X X X X
7 0 -1 X X X X
8 0 -1 X X X X
9 0 -1 X X X X
10 0 -1 X X X X
11 0 -1 X X X X
12 0 -1 0 0 0 0
13 0 -1 0 0 0 0
14 0 -1 X X X X
15 -1 64 0 0 0 0
16 -1 46 0 0 0 0
17 -1 38 0 0 0 0
18 -1 10 0 0 0 0
19 -1 -1 0 0 0 0
20 -1 45 1 1 1 1
21 -1 53 0,1 0,1 0,1 0,1
22 -1 9 0-2 0-2 0-2 0-2
23 -1 16 0,1 0,1 0,1 0,1
24 -1 8 X X X X
25 -1 29 X X X X
26 -1 12 X X X X
27 1 27 0 0 0 X
28 1 2 0 0 0 X
29 1 11 0 0 0 X
30 1 22 0 0 0 X
31 1 24 0 0 0 X
32 1 23 0 0 0 X
33 1 26 0 0 0 X
34 1 5 0 0 0 X
35 0 41 0 0 0 X
36 1 3 0 0 0 0
37 1 39 0 0 0 0
38 1 79 0 0 0 0
39 1 79 0 0 0 0
40 1 -1 0 0 0 0
41 1 36 0 0 0 X
42 -1 40 0 0 0 X
43 1 4 0 0 0 X
44 1 25 0 0 0 X
45 -1 56 0 0 0 X
46 1 54 0 0 0 X
47 -1 14 0 0 0 0
48 1 0 0 0 0 X
49 1 20 0 0 0 X
50 -1 30 0 0 0 X
51 1 18 0 0 0 X
52 -1 48 0 0 0 X
53 1 31 0 0 0 X
54 -1 19 0 0 0 X
55 1 28 0 0 0 0
56 1 17 0 0 0 0
57 -1 38 0 0 0 0
58 1 7 0 0 0 X
59 -1 35 0 0 0-1 0-2
60 -1 21 0 0 0 0
61 -1 42 0 0 0 X
62 -1 6 0 0 0 0
63 1 -1 0 0 0 0
64 0 -1 X X X X
65 1 -1 0 0 0 0
66 0 -1 X X X X
67 0 -1 X X X X
68 0 -1 X X X X
69 0 -1 X X X X
70 0 70 0 0 0 0
71 -1 67 0 0 0 0
72 0 68 0 0 0 0
73 -1 69 0 0 0 0
74 -1 70 0 0 0 0
75 -1 71 0 0 0 0
76 0 72 0-1 0-1 0-1 0-1
77 -1 38 0 0 0 0
78 -1 41 0 0 0 0
79 0 80 0 0 0 0
80 0 81 0 0 0 0
-1

View File

@ -3,8 +3,10 @@
#include "CSpellHandler.h"
#include "CLodHandler.h"
#include "../lib/VCMI_Lib.h"
#include "../lib/JsonNode.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/assign/std/set.hpp>
#include <boost/foreach.hpp>
#include <cctype>
@ -294,38 +296,26 @@ void CSpellHandler::loadSpells()
spells.push_back(nsp);
}
boost::replace_first (spells[47]->attributes, "2", ""); // disrupting ray will now affect single creature
//loading of additional spell traits
std::ifstream ast;
ast.open(DATA_DIR "/config/spell_info.txt", std::ios::binary);
if(!ast.is_open())
{
tlog1<<"lack of config/spell_info.txt file!"<<std::endl;
}
else
{
//reading header
std::string dump;
for(int i=0; i<60; ++i) ast>>dump;
//reading exact info
int spellID;
ast>>spellID;
while(spellID != -1)
{
int buf;
ast >> buf;
spells[spellID]->positiveness = buf;
ast >> buf;
spells[spellID]->mainEffectAnim = buf;
spells[spellID]->range.resize(4);
for(int g=0; g<4; ++g)
ast>>spells[spellID]->range[g];
ast>>spellID;
}
//loading of additional spell traits
const JsonNode config(DATA_DIR "/config/spell_info.json");
BOOST_FOREACH(const JsonNode &spell, config["spells"].Vector())
{
//reading exact info
int spellID = spell["id"].Float();
spells[spellID]->positiveness = spell["effect"].Float();
spells[spellID]->mainEffectAnim = spell["anim"].Float();
spells[spellID]->range.resize(4);
int idx = 0;
BOOST_FOREACH(const JsonNode &range, spell["ranges"].Vector())
spells[spellID]->range[idx] = range.String();
}
ast.close();
spells.push_back(spells[80]); //clone Acid Breath attributes for Acid Breath damage effect
//forgetfulness needs to get targets automaticlaly on expert level
//forgetfulness needs to get targets automatically on expert level
boost::replace_first(spells[61]->attributes, "CREATURE_TARGET", "CREATURE_TARGET_2"); //TODO: use flags instead?
damageSpells += 11, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 57, 77;