2007-06-08 14:58:04 +00:00
# ifndef CHEROHANDLER_H
# define CHEROHANDLER_H
2008-06-13 08:16:51 +00:00
# include "../global.h"
2007-06-08 14:58:04 +00:00
# include <string>
# include <vector>
2008-08-04 15:56:36 +00:00
# include <set>
2007-06-18 12:48:29 +00:00
class CHeroClass ;
2007-09-15 18:04:12 +00:00
class CDefHandler ;
2007-09-30 16:16:00 +00:00
class CGameInfo ;
2007-10-27 19:38:48 +00:00
class CGHeroInstance ;
2008-06-17 17:48:32 +00:00
class DLL_EXPORT CHero
2007-06-08 14:58:04 +00:00
{
public :
std : : string name ;
2007-06-16 13:33:58 +00:00
int ID ;
2008-05-03 15:30:11 +00:00
int 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
2007-06-09 13:28:03 +00:00
std : : string bonusName , shortBonus , longBonus ; //for special abilities
2007-06-11 17:21:27 +00:00
std : : string biography ; //biography, of course
2007-06-09 18:14:41 +00:00
bool isAllowed ; //true if we can play with this hero (depends on map)
2007-06-18 12:48:29 +00:00
CHeroClass * heroClass ;
2007-07-16 10:03:54 +00:00
EHeroClasses heroType ; //hero class
2008-09-29 11:03:30 +00:00
std : : vector < std : : pair < int , int > > secSkillsInit ; //initial secondaryskills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert)
2007-07-16 10:03:54 +00:00
//bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}
2007-06-08 14:58:04 +00:00
} ;
2008-06-17 17:48:32 +00:00
class DLL_EXPORT CHeroClass
2007-06-18 10:49:06 +00:00
{
public :
2008-08-04 15:56:36 +00:00
ui32 skillLimit ; //how many secondary skills can hero learn
2007-06-18 10:49:06 +00:00
std : : string name ;
float aggression ;
int initialAttack , initialDefence , initialPower , initialKnowledge ;
2008-05-03 15:30:11 +00:00
std : : vector < std : : pair < int , int > > primChance ; //primChance[PRIMARY_SKILL_ID] - first is for levels 2 - 9, second for 10+;;; probability (%) of getting point of primary skill when getting new level
2007-06-18 10:49:06 +00:00
std : : vector < int > proSec ; //probabilities of gaining secondary skills (out of 112), in id order
int selectionProbability [ 9 ] ; //probability of selection in towns
2007-08-15 15:13:11 +00:00
std : : vector < int > terrCosts ; //default costs of going through terrains: dirt, sand, grass, snow, swamp, rough, subterrain, lava, water, rock; -1 means terrain is imapassable
2007-10-08 18:47:23 +00:00
CDefHandler * moveAnim ; //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
2008-09-29 11:03:30 +00:00
int chooseSecSkill ( const std : : set < int > & possibles ) const ; //picks secondary skill out from given possibilities
2008-08-04 15:56:36 +00:00
CHeroClass ( ) ;
~ CHeroClass ( ) ;
2007-06-18 10:49:06 +00:00
} ;
2008-06-14 10:20:18 +00:00
class DLL_EXPORT CHeroHandler
2007-06-08 14:58:04 +00:00
{
public :
2007-07-16 10:03:54 +00:00
std : : vector < CHero * > heroes ; //by�o nodrze
2007-06-18 12:48:29 +00:00
std : : vector < CHeroClass * > heroClasses ;
2007-11-18 22:58:28 +00:00
std : : vector < std : : string > pskillsn ;
2008-01-27 16:07:27 +00:00
std : : vector < int > expPerLevel ; //expPerLEvel[i] is amount of exp needed to reach level i; if it is not in this vector, multiplicate last value by 1,2 to get next value
2007-08-12 17:48:05 +00:00
unsigned int level ( unsigned int experience ) ;
2008-01-27 16:07:27 +00:00
unsigned int reqExp ( unsigned int level ) ;
2007-06-08 14:58:04 +00:00
void loadHeroes ( ) ;
2007-06-09 13:28:03 +00:00
void loadSpecialAbilities ( ) ;
2007-06-11 17:21:27 +00:00
void loadBiographies ( ) ;
2007-06-18 10:49:06 +00:00
void loadHeroClasses ( ) ;
2008-06-13 08:16:51 +00:00
void loadPortraits ( ) ; //loads names of primary skills
2007-07-16 10:03:54 +00:00
void initHeroClasses ( ) ;
2007-07-19 23:38:11 +00:00
~ CHeroHandler ( ) ;
2007-08-15 15:13:11 +00:00
void initTerrainCosts ( ) ;
2007-06-08 14:58:04 +00:00
} ;
2008-08-02 15:08:03 +00:00
# endif //CHEROHANDLER_H