CHeroHandler.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef CHEROHANDLER_H
  2. #define CHEROHANDLER_H
  3. #include <string>
  4. #include <vector>
  5. #include "CCreatureHandler.h"
  6. #include "SDL.h"
  7. #include "../int3.h"
  8. #include "CAmbarCendamo.h"
  9. #include "../CGameInterface.h"
  10. class CHeroClass;
  11. class CDefHandler;
  12. class CGameInfo;
  13. class CGHeroInstance;
  14. class CHero
  15. {
  16. public:
  17. std::string name;
  18. int ID;
  19. int lowStack[3], highStack[3]; //amount of units; described below
  20. std::string refTypeStack[3]; //reference names of units appearing in hero's army if he is recruited in tavern
  21. std::string bonusName, shortBonus, longBonus; //for special abilities
  22. std::string biography; //biography, of course
  23. bool isAllowed; //true if we can play with this hero (depends on map)
  24. CHeroClass * heroClass;
  25. EHeroClasses heroType; //hero class
  26. //bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}
  27. SDL_Surface * portraitSmall; //48x32 px
  28. SDL_Surface * portraitLarge; //58x64 px
  29. };
  30. class CHeroClass
  31. {
  32. public:
  33. std::string name;
  34. float aggression;
  35. int initialAttack, initialDefence, initialPower, initialKnowledge;
  36. 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
  37. std::vector<int> proSec; //probabilities of gaining secondary skills (out of 112), in id order
  38. int selectionProbability[9]; //probability of selection in towns
  39. 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
  40. CDefHandler * moveAnim; //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
  41. };
  42. class CHeroHandler
  43. {
  44. public:
  45. std::vector<CGHeroInstance *> heroInstances;
  46. std::vector<CHero*> heroes; //by³o nodrze
  47. std::vector<CHeroClass *> heroClasses;
  48. std::vector<CDefHandler *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
  49. CDefHandler * pskillsb, *resources; //82x93
  50. CDefHandler * un44; //many things
  51. std::vector<std::string> pskillsn;
  52. 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
  53. unsigned int level(unsigned int experience);
  54. unsigned int reqExp(unsigned int level);
  55. void loadHeroes();
  56. void loadSpecialAbilities();
  57. void loadBiographies();
  58. void loadHeroClasses();
  59. void loadPortraits(); //loads also imgs and names of primary skills
  60. void initHeroClasses();
  61. ~CHeroHandler();
  62. void initTerrainCosts();
  63. friend void CAmbarCendamo::deh3m();
  64. friend void initGameState(CGameInfo * cgi);
  65. //friend class CConsoleHandler;
  66. //friend void CPlayerInterface::heroMoved(const HeroMoveDetails & details); //TODO: wywalic, wstretne!!!
  67. };
  68. #endif //CHEROHANDLER_H