2007-06-08 17:58:04 +03:00
|
|
|
#ifndef CHEROHANDLER_H
|
|
|
|
#define CHEROHANDLER_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2007-06-11 20:21:27 +03:00
|
|
|
#include "CCreatureHandler.h"
|
2007-07-17 23:51:49 +03:00
|
|
|
#include "SDL.h"
|
2007-08-30 13:11:53 +03:00
|
|
|
#include "../int3.h"
|
2007-09-30 19:16:00 +03:00
|
|
|
#include "CAmbarCendamo.h"
|
|
|
|
#include "CGameInterface.h"
|
2007-06-08 17:58:04 +03:00
|
|
|
|
2007-06-18 15:48:29 +03:00
|
|
|
class CHeroClass;
|
2007-09-13 16:34:59 +03:00
|
|
|
class CObjectInstance;
|
2007-09-15 21:04:12 +03:00
|
|
|
class CDefHandler;
|
2007-09-30 19:16:00 +03:00
|
|
|
class CGameInfo;
|
2007-07-16 13:03:54 +03:00
|
|
|
|
2007-06-08 17:58:04 +03:00
|
|
|
class CHero
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string name;
|
2007-06-16 16:33:58 +03:00
|
|
|
int ID;
|
2007-06-08 17:58:04 +03:00
|
|
|
int low1stack, high1stack, low2stack, high2stack, low3stack, high3stack; //amount of units; described below
|
|
|
|
std::string refType1stack, refType2stack, refType3stack; //reference names of units appearing in hero's army if he is recruited in tavern
|
2007-06-09 16:28:03 +03:00
|
|
|
std::string bonusName, shortBonus, longBonus; //for special abilities
|
2007-06-11 20:21:27 +03:00
|
|
|
std::string biography; //biography, of course
|
2007-06-09 21:14:41 +03:00
|
|
|
bool isAllowed; //true if we can play with this hero (depends on map)
|
2007-06-18 15:48:29 +03:00
|
|
|
CHeroClass * heroClass;
|
2007-07-16 13:03:54 +03:00
|
|
|
EHeroClasses heroType; //hero class
|
|
|
|
//bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}
|
2007-10-17 01:39:11 +03:00
|
|
|
SDL_Surface * portraitSmall; //48x32 px
|
|
|
|
SDL_Surface * portraitLarge; //58x64 px
|
2007-06-08 17:58:04 +03:00
|
|
|
};
|
|
|
|
|
2007-06-18 13:49:06 +03:00
|
|
|
class CHeroClass
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string name;
|
|
|
|
float aggression;
|
|
|
|
int initialAttack, initialDefence, initialPower, initialKnowledge;
|
|
|
|
int proAttack[2]; //probability of gaining attack point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
|
|
|
|
int proDefence[2]; //probability of gaining defence point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
|
|
|
|
int proPower[2]; //probability of gaining power point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
|
|
|
|
int proKnowledge[2]; //probability of gaining knowledge point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
|
|
|
|
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 18:13:11 +03: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 21:47:23 +03: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
|
2007-06-18 13:49:06 +03:00
|
|
|
};
|
|
|
|
|
2007-06-08 17:58:04 +03:00
|
|
|
class CHeroInstance
|
|
|
|
{
|
|
|
|
public:
|
2007-07-29 02:01:25 +03:00
|
|
|
int owner;
|
2007-08-12 20:48:05 +03:00
|
|
|
CHero * type;
|
2007-09-13 16:34:59 +03:00
|
|
|
CObjectInstance * ourObject;
|
2007-07-29 02:01:25 +03:00
|
|
|
int exp; //experience point
|
|
|
|
int level; //current level of hero
|
|
|
|
std::string name; //may be custom
|
|
|
|
std::string biography; //may be custom
|
|
|
|
int portrait; //may be custom
|
2007-10-05 21:16:22 +03:00
|
|
|
int3 pos; //position of object (hero pic is on the left)
|
2007-06-11 20:21:27 +03:00
|
|
|
CCreatureSet army; //army
|
2007-07-29 02:01:25 +03:00
|
|
|
int mana; // remaining spell points
|
2007-09-14 16:11:10 +03:00
|
|
|
std::vector<int> primSkills; //0-attack, 1-defence, 2-spell power, 3-knowledge
|
|
|
|
std::vector<std::pair<int,int> > secSkills; //first - ID of skill, second - level of skill (0 - basic, 1 - adv., 2 - expert)
|
2007-07-29 02:01:25 +03:00
|
|
|
int movement; //remaining movement points
|
2007-09-14 16:11:10 +03:00
|
|
|
bool inTownGarrison; // if hero is in town garrison
|
|
|
|
|
2007-08-12 20:48:05 +03:00
|
|
|
unsigned int getTileCost(EterrainType & ttype, Eroad & rdtype, Eriver & rvtype);
|
|
|
|
unsigned int getLowestCreatureSpeed();
|
|
|
|
unsigned int getAdditiveMoveBonus();
|
|
|
|
unsigned float getMultiplicativeMoveBonus();
|
2007-10-05 21:16:22 +03:00
|
|
|
static int3 convertPosition(int3 src, bool toh3m); //toh3m=true: manifest->h3m; toh3m=false: h3m->manifest
|
|
|
|
int3 getPosition(bool h3m) const; //h3m=true - returns position of hero object; h3m=false - returns position of hero 'manifestation'
|
|
|
|
void setPosition(int3 Pos, bool h3m); //as above, but sets position
|
|
|
|
|
|
|
|
bool canWalkOnSea() const;
|
2007-10-17 01:39:11 +03:00
|
|
|
int getCurrentLuck() const;
|
|
|
|
int getCurrentMorale() const;
|
2007-09-14 16:11:10 +03:00
|
|
|
|
|
|
|
//TODO: artifacts, known spells, commander, blessings, curses, morale/luck special modifiers
|
2007-06-08 17:58:04 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class CHeroHandler
|
|
|
|
{
|
|
|
|
public:
|
2007-09-30 19:16:00 +03:00
|
|
|
std::vector<CHeroInstance *> heroInstances;
|
2007-07-16 13:03:54 +03:00
|
|
|
std::vector<CHero*> heroes; //by�o nodrze
|
2007-06-18 15:48:29 +03:00
|
|
|
std::vector<CHeroClass *> heroClasses;
|
2007-10-08 21:47:23 +03:00
|
|
|
std::vector<CDefHandler *> flags1, flags2, flags3, flags4; //flags blitted on heroes when
|
2007-08-12 20:48:05 +03:00
|
|
|
unsigned int level(unsigned int experience);
|
2007-06-08 17:58:04 +03:00
|
|
|
void loadHeroes();
|
2007-06-09 16:28:03 +03:00
|
|
|
void loadSpecialAbilities();
|
2007-06-11 20:21:27 +03:00
|
|
|
void loadBiographies();
|
2007-06-18 13:49:06 +03:00
|
|
|
void loadHeroClasses();
|
2007-07-20 02:38:11 +03:00
|
|
|
void loadPortraits();
|
2007-07-16 13:03:54 +03:00
|
|
|
void initHeroClasses();
|
2007-07-20 02:38:11 +03:00
|
|
|
~CHeroHandler();
|
2007-08-15 18:13:11 +03:00
|
|
|
void initTerrainCosts();
|
2007-09-30 19:16:00 +03:00
|
|
|
|
|
|
|
friend void CAmbarCendamo::deh3m();
|
|
|
|
friend void initGameState(CGameInfo * cgi);
|
|
|
|
friend class CConsoleHandler;
|
|
|
|
|
|
|
|
//friend void CPlayerInterface::heroMoved(const HeroMoveDetails & details); //TODO: wywalic, wstretne!!!
|
2007-06-08 17:58:04 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //CHEROHANDLER_H
|