CHero.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * CHero.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include <vcmi/HeroType.h>
  12. #include "EHeroGender.h"
  13. #include "../../bonuses/BonusList.h"
  14. #include "../../constants/EntityIdentifiers.h"
  15. #include "../../filesystem/ResourcePath.h"
  16. VCMI_LIB_NAMESPACE_BEGIN
  17. class DLL_LINKAGE CHero : public HeroType
  18. {
  19. friend class CHeroHandler;
  20. HeroTypeID ID;
  21. std::string identifier;
  22. std::string modScope;
  23. public:
  24. struct InitialArmyStack
  25. {
  26. ui32 minAmount;
  27. ui32 maxAmount;
  28. CreatureID creature;
  29. };
  30. si32 imageIndex = 0;
  31. std::vector<InitialArmyStack> initialArmy;
  32. const CHeroClass * heroClass = nullptr;
  33. //initial secondary skills; first - ID of skill, second - level of skill (1 - basic, 2 - adv., 3 - expert)
  34. std::vector<std::pair<SecondarySkill, ui8>> secSkillsInit;
  35. BonusList specialty;
  36. std::set<SpellID> spells;
  37. bool haveSpellBook = false;
  38. bool special = false; // hero is special and won't be placed in game (unless preset on map), e.g. campaign heroes
  39. bool onlyOnWaterMap; // hero will be placed only if the map contains water
  40. bool onlyOnMapWithoutWater; // hero will be placed only if the map does not contain water
  41. EHeroGender gender = EHeroGender::MALE; // default sex: 0=male, 1=female
  42. /// Graphics
  43. std::string iconSpecSmall;
  44. std::string iconSpecLarge;
  45. std::string portraitSmall;
  46. std::string portraitLarge;
  47. AnimationPath battleImage;
  48. CHero();
  49. virtual ~CHero();
  50. int32_t getIndex() const override;
  51. int32_t getIconIndex() const override;
  52. std::string getJsonKey() const override;
  53. std::string getModScope() const override;
  54. HeroTypeID getId() const override;
  55. void registerIcons(const IconRegistar & cb) const override;
  56. std::string getNameTranslated() const override;
  57. std::string getBiographyTranslated() const override;
  58. std::string getSpecialtyNameTranslated() const override;
  59. std::string getSpecialtyDescriptionTranslated() const override;
  60. std::string getSpecialtyTooltipTranslated() const override;
  61. std::string getNameTextID() const override;
  62. std::string getBiographyTextID() const override;
  63. std::string getSpecialtyNameTextID() const override;
  64. std::string getSpecialtyDescriptionTextID() const override;
  65. std::string getSpecialtyTooltipTextID() const override;
  66. void updateFrom(const JsonNode & data);
  67. void serializeJson(JsonSerializeFormat & handler);
  68. };
  69. VCMI_LIB_NAMESPACE_END