CHeroHandler.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. //bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}
  24. };
  25. class DLL_EXPORT CHeroClass
  26. {
  27. public:
  28. ui32 skillLimit; //how many secondary skills can hero learn
  29. std::string name;
  30. float aggression;
  31. int initialAttack, initialDefence, initialPower, initialKnowledge;
  32. 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
  33. std::vector<int> proSec; //probabilities of gaining secondary skills (out of 112), in id order
  34. int selectionProbability[9]; //probability of selection in towns
  35. 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
  36. CDefHandler * moveAnim; //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
  37. int chooseSecSkill(std::set<int> possibles); //picks secondary skill out from given possibilities
  38. CHeroClass();
  39. ~CHeroClass();
  40. };
  41. class DLL_EXPORT CHeroHandler
  42. {
  43. public:
  44. std::vector<CHero*> heroes; //by³o nodrze
  45. std::vector<CHeroClass *> heroClasses;
  46. std::vector<std::string> pskillsn;
  47. 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
  48. unsigned int level(unsigned int experience);
  49. unsigned int reqExp(unsigned int level);
  50. void loadHeroes();
  51. void loadSpecialAbilities();
  52. void loadBiographies();
  53. void loadHeroClasses();
  54. void loadPortraits(); //loads names of primary skills
  55. void initHeroClasses();
  56. ~CHeroHandler();
  57. void initTerrainCosts();
  58. };
  59. #endif //CHEROHANDLER_H