CHeroHandler.h 2.3 KB

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