CHeroHandler.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef CHEROHANDLER_H
  2. #define CHEROHANDLER_H
  3. #include "../global.h"
  4. #include <string>
  5. #include <vector>
  6. #include <set>
  7. class CHeroClass;
  8. class CDefHandler;
  9. class CGameInfo;
  10. class CGHeroInstance;
  11. class DLL_EXPORT CHero
  12. {
  13. public:
  14. std::string name;
  15. int ID;
  16. int lowStack[3], highStack[3]; //amount of units; described below
  17. std::string refTypeStack[3]; //reference names of units appearing in hero's army if he is recruited in tavern
  18. std::string bonusName, shortBonus, longBonus; //for special abilities
  19. std::string biography; //biography, of course
  20. bool isAllowed; //true if we can play with this hero (depends on map)
  21. CHeroClass * heroClass;
  22. EHeroClasses heroType; //hero class
  23. std::vector<std::pair<int,int> > secSkillsInit; //initial secondaryskills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert)
  24. //bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}
  25. };
  26. class DLL_EXPORT CHeroClass
  27. {
  28. public:
  29. ui32 skillLimit; //how many secondary skills can hero learn
  30. std::string name;
  31. float aggression;
  32. int initialAttack, initialDefence, initialPower, initialKnowledge;
  33. 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
  34. std::vector<int> proSec; //probabilities of gaining secondary skills (out of 112), in id order
  35. int selectionProbability[9]; //probability of selection in towns
  36. 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
  37. CDefHandler * moveAnim; //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
  38. int chooseSecSkill(const std::set<int> & possibles) const; //picks secondary skill out from given possibilities
  39. CHeroClass();
  40. ~CHeroClass();
  41. };
  42. class DLL_EXPORT CHeroHandler
  43. {
  44. public:
  45. std::vector<CHero*> heroes; //by³o nodrze
  46. std::vector<CHeroClass *> heroClasses;
  47. std::vector<std::string> pskillsn;
  48. 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
  49. unsigned int level(unsigned int experience);
  50. unsigned int reqExp(unsigned int level);
  51. void loadHeroes();
  52. void loadSpecialAbilities();
  53. void loadBiographies();
  54. void loadHeroClasses();
  55. void loadPortraits(); //loads names of primary skills
  56. void initHeroClasses();
  57. ~CHeroHandler();
  58. void initTerrainCosts();
  59. };
  60. #endif //CHEROHANDLER_H