CHeroHandler.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. class CHeroClass;
  9. class CHero
  10. {
  11. public:
  12. std::string name;
  13. int ID;
  14. int low1stack, high1stack, low2stack, high2stack, low3stack, high3stack; //amount of units; described below
  15. std::string refType1stack, refType2stack, refType3stack; //reference names of units appearing in hero's army if he is recruited in tavern
  16. std::string bonusName, shortBonus, longBonus; //for special abilities
  17. std::string biography; //biography, of course
  18. bool isAllowed; //true if we can play with this hero (depends on map)
  19. CHeroClass * heroClass;
  20. EHeroClasses heroType; //hero class
  21. //bool operator<(CHero& drugi){if (ID < drugi.ID) return true; else return false;}
  22. SDL_Surface * portraitSmall; //48x32 p
  23. };
  24. class CHeroClass
  25. {
  26. public:
  27. std::string name;
  28. float aggression;
  29. int initialAttack, initialDefence, initialPower, initialKnowledge;
  30. int proAttack[2]; //probability of gaining attack point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
  31. int proDefence[2]; //probability of gaining defence point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
  32. int proPower[2]; //probability of gaining power point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
  33. int proKnowledge[2]; //probability of gaining knowledge point on levels [0]: 2 - 9; [1]: 10+ (out of 100)
  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. };
  38. class CHeroInstance
  39. {
  40. public:
  41. int owner;
  42. CHero * type;
  43. int exp; //experience point
  44. int level; //current level of hero
  45. std::string name; //may be custom
  46. std::string biography; //may be custom
  47. int portrait; //may be custom
  48. int3 pos; //position on adventure map
  49. CCreatureSet army; //army
  50. int mana; // remaining spell points
  51. int movement; //remaining movement points
  52. unsigned int getTileCost(EterrainType & ttype, Eroad & rdtype, Eriver & rvtype);
  53. unsigned int getLowestCreatureSpeed();
  54. unsigned int getAdditiveMoveBonus();
  55. unsigned float getMultiplicativeMoveBonus();
  56. //TODO: artifacts, primary and secondary skills, known spells, commander, blessings, curses, morale/luck special modifiers
  57. };
  58. class CHeroHandler
  59. {
  60. public:
  61. std::vector<CHero*> heroes; //by³o nodrze
  62. std::vector<CHeroClass *> heroClasses;
  63. std::vector<CHeroInstance *> heroInstances;
  64. unsigned int level(unsigned int experience);
  65. void loadHeroes();
  66. void loadSpecialAbilities();
  67. void loadBiographies();
  68. void loadHeroClasses();
  69. void loadPortraits();
  70. void initHeroClasses();
  71. ~CHeroHandler();
  72. void initTerrainCosts();
  73. };
  74. #endif //CHEROHANDLER_H