CHeroHandler.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 low1stack, high1stack, low2stack, high2stack, low3stack, high3stack; //amount of units; described below
  20. std::string refType1stack, refType2stack, refType3stack; //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. int proAttack[2]; //probability of gaining attack point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
  37. int proDefence[2]; //probability of gaining defence point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
  38. int proPower[2]; //probability of gaining power point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
  39. int proKnowledge[2]; //probability of gaining knowledge point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
  40. std::vector<int> proSec; //probabilities of gaining secondary skills (out of 112), in id order
  41. int selectionProbability[9]; //probability of selection in towns
  42. 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
  43. CDefHandler * moveAnim; //added group 10: up - left, 11 - left and 12 - left down // 13 - up-left standing; 14 - left standing; 15 - left down standing
  44. };
  45. class CHeroHandler
  46. {
  47. public:
  48. std::vector<CGHeroInstance *> heroInstances;
  49. std::vector<CHero*> heroes; //by³o nodrze
  50. std::vector<CHeroClass *> heroClasses;
  51. std::vector<CDefHandler *> flags1, flags2, flags3, flags4; //flags blitted on heroes when ,
  52. CDefHandler * pskillsb, *resources; //82x93
  53. CDefHandler * un44; //many things
  54. std::vector<std::string> pskillsn;
  55. 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
  56. unsigned int level(unsigned int experience);
  57. unsigned int reqExp(unsigned int level);
  58. void loadHeroes();
  59. void loadSpecialAbilities();
  60. void loadBiographies();
  61. void loadHeroClasses();
  62. void loadPortraits(); //loads also imgs and names of primary skills
  63. void initHeroClasses();
  64. ~CHeroHandler();
  65. void initTerrainCosts();
  66. friend void CAmbarCendamo::deh3m();
  67. friend void initGameState(CGameInfo * cgi);
  68. //friend class CConsoleHandler;
  69. //friend void CPlayerInterface::heroMoved(const HeroMoveDetails & details); //TODO: wywalic, wstretne!!!
  70. };
  71. #endif //CHEROHANDLER_H