mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Heroes start with appropriate spells.
Starting spells list has been prepared by Dru. Thanks!
This commit is contained in:
parent
50a49460bf
commit
38f8745777
105
config/hero_spells.txt
Normal file
105
config/hero_spells.txt
Normal file
@ -0,0 +1,105 @@
|
||||
------------------------------
|
||||
--Starting spells for heroes--
|
||||
-- File format: --
|
||||
-- HERO_ID SPELL_ID --
|
||||
------------------------------
|
||||
----- Death Knights
|
||||
67 15
|
||||
70 15
|
||||
71 27
|
||||
69 15
|
||||
66 54
|
||||
64 53
|
||||
68 15
|
||||
65 46
|
||||
----- Necromancers
|
||||
73 23
|
||||
79 30
|
||||
75 27
|
||||
74 54
|
||||
72 24
|
||||
76 39
|
||||
78 42
|
||||
77 46
|
||||
----- Battle Mages
|
||||
106 46
|
||||
104 43
|
||||
109 54
|
||||
110 30
|
||||
111 43
|
||||
107 53
|
||||
105 15
|
||||
108 44
|
||||
----- Druids
|
||||
31 30
|
||||
30 16
|
||||
25 37
|
||||
24 55
|
||||
26 42
|
||||
27 0
|
||||
28 15
|
||||
29 51
|
||||
----- Alchemists
|
||||
37 53
|
||||
39 15
|
||||
35 27
|
||||
32 27
|
||||
34 53
|
||||
38 15
|
||||
33 15
|
||||
36 15
|
||||
----- Wizards
|
||||
47 42
|
||||
40 60
|
||||
46 53
|
||||
43 51
|
||||
41 46
|
||||
42 35
|
||||
45 19
|
||||
44 27
|
||||
----- Witches
|
||||
126 35
|
||||
124 46
|
||||
120 45
|
||||
121 15
|
||||
125 27
|
||||
127 46
|
||||
123 31
|
||||
122 54
|
||||
----- Clerics
|
||||
9 41
|
||||
10 45
|
||||
15 37
|
||||
11 20
|
||||
12 42
|
||||
14 48
|
||||
8 46
|
||||
13 35
|
||||
----- Warlocks
|
||||
88 38
|
||||
95 46
|
||||
93 23
|
||||
92 54
|
||||
89 27
|
||||
91 38
|
||||
90 43
|
||||
94 30
|
||||
----- Heretics
|
||||
61 43
|
||||
58 30
|
||||
56 3
|
||||
60 53
|
||||
59 45
|
||||
57 22
|
||||
63 21
|
||||
62 46
|
||||
----- Elementalists
|
||||
136 13
|
||||
137 53
|
||||
138 15
|
||||
139 46
|
||||
140 43
|
||||
141 47
|
||||
142 35
|
||||
143 54
|
||||
----- The End;)
|
@ -219,34 +219,53 @@ void CHeroHandler::loadHeroes()
|
||||
heroes.push_back(nher);
|
||||
}
|
||||
//loading initial secondary skills
|
||||
std::ifstream inp;
|
||||
inp.open("config" PATHSEPARATOR "heroes_sec_skills.txt", std::ios_base::in|std::ios_base::binary);
|
||||
if(!inp.is_open())
|
||||
{
|
||||
tlog1<<"missing file: config/heroes_sec_skills.txt"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
inp>>dump;
|
||||
int hid; //ID of currently read hero
|
||||
int secQ; //number of secondary abilities
|
||||
while(true)
|
||||
std::ifstream inp;
|
||||
inp.open("config" PATHSEPARATOR "heroes_sec_skills.txt", std::ios_base::in|std::ios_base::binary);
|
||||
if(!inp.is_open())
|
||||
{
|
||||
inp>>hid;
|
||||
if(hid == -1)
|
||||
break;
|
||||
inp>>secQ;
|
||||
for(int g=0; g<secQ; ++g)
|
||||
{
|
||||
int a, b;
|
||||
inp>>a; inp>>b;
|
||||
heroes[hid]->secSkillsInit.push_back(std::make_pair(a, b));
|
||||
}
|
||||
tlog1<<"missing file: config/heroes_sec_skills.txt"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
inp>>dump;
|
||||
int hid; //ID of currently read hero
|
||||
int secQ; //number of secondary abilities
|
||||
while(true)
|
||||
{
|
||||
inp>>hid;
|
||||
if(hid == -1)
|
||||
break;
|
||||
inp>>secQ;
|
||||
for(int g=0; g<secQ; ++g)
|
||||
{
|
||||
int a, b;
|
||||
inp>>a; inp>>b;
|
||||
heroes[hid]->secSkillsInit.push_back(std::make_pair(a, b));
|
||||
}
|
||||
}
|
||||
inp.close();
|
||||
}
|
||||
inp.close();
|
||||
}
|
||||
//initial skills loaded
|
||||
|
||||
{
|
||||
std::ifstream inp;
|
||||
std::istringstream iss;
|
||||
dump.clear();
|
||||
inp.open("config" PATHSEPARATOR "hero_spells.txt");
|
||||
while(inp)
|
||||
{
|
||||
getline(inp, dump);
|
||||
if(!dump.size() || dump[0] == '-')
|
||||
continue;
|
||||
iss.clear();
|
||||
iss.str(dump);
|
||||
int hid, sid;
|
||||
iss >> hid >> sid;
|
||||
heroes[hid]->startingSpell = sid;
|
||||
}
|
||||
}
|
||||
loadHeroClasses();
|
||||
initHeroClasses();
|
||||
expPerLevel.push_back(0);
|
||||
@ -526,3 +545,13 @@ void CHeroHandler::loadNativeTerrains()
|
||||
}
|
||||
inp.close();
|
||||
}
|
||||
|
||||
CHero::CHero()
|
||||
{
|
||||
startingSpell = -1;
|
||||
}
|
||||
|
||||
CHero::~CHero()
|
||||
{
|
||||
|
||||
}
|
@ -27,17 +27,21 @@ public:
|
||||
BARBARIAN, BATTLEMAGE, BEASTMASTER, WITCH, PLANESWALKER, ELEMENTALIST};
|
||||
|
||||
std::string name; //name of hero
|
||||
int ID;
|
||||
int lowStack[3], highStack[3]; //amount of units; described below
|
||||
ui16 ID;
|
||||
ui32 lowStack[3], highStack[3]; //amount of units; described below
|
||||
std::string refTypeStack[3]; //reference names of units appearing in hero's army if he is recruited in tavern
|
||||
CHeroClass * heroClass;
|
||||
EHeroClasses heroType; //hero class
|
||||
std::vector<std::pair<ui8,ui8> > secSkillsInit; //initial secondary skills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert)
|
||||
si32 startingSpell; //-1 if none
|
||||
//bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}
|
||||
|
||||
CHero();
|
||||
~CHero();
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
h & name & ID & lowStack & highStack & refTypeStack & heroType & ID;
|
||||
h & name & ID & lowStack & highStack & refTypeStack & heroType & ID & startingSpell;
|
||||
//hero class pointer is restored by herohandler
|
||||
}
|
||||
};
|
||||
|
@ -496,9 +496,10 @@ void CGHeroInstance::initHero()
|
||||
if(!type)
|
||||
type = VLC->heroh->heroes[subID];
|
||||
artifWorn[16] = 3;
|
||||
if(type->heroType % 2 == 1) //it's a magical hero
|
||||
if(type->startingSpell >= 0) //hero starts with a spell
|
||||
{
|
||||
artifWorn[17] = 0; //give him spellbook
|
||||
spells.insert(type->startingSpell);
|
||||
}
|
||||
|
||||
if(portrait < 0 || portrait == 255)
|
||||
|
Loading…
Reference in New Issue
Block a user