CHeroClass.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * CHeroClass.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/HeroClass.h>
  12. #include "../../constants/EntityIdentifiers.h"
  13. #include "../../constants/Enumerations.h"
  14. #include "../../filesystem/ResourcePath.h"
  15. VCMI_LIB_NAMESPACE_BEGIN
  16. namespace vstd
  17. {
  18. class RNG;
  19. }
  20. class DLL_LINKAGE CHeroClass : public HeroClass
  21. {
  22. friend class CHeroClassHandler;
  23. HeroClassID id; // use getId instead
  24. std::string modScope;
  25. std::string identifier; // use getJsonKey instead
  26. public:
  27. enum EClassAffinity
  28. {
  29. MIGHT,
  30. MAGIC
  31. };
  32. //double aggression; // not used in vcmi.
  33. FactionID faction;
  34. ui8 affinity; // affinity, using EClassAffinity enum
  35. // default chance for hero of specific class to appear in tavern, if field "tavern" was not set
  36. // resulting chance = sqrt(town.chance * heroClass.chance)
  37. ui32 defaultTavernChance;
  38. CreatureID commander;
  39. std::vector<int> primarySkillInitial; // initial primary skills
  40. std::vector<int> primarySkillLowLevel; // probability (%) of getting point of primary skill when getting level
  41. std::vector<int> primarySkillHighLevel; // same for high levels (> 10)
  42. std::map<SecondarySkill, int> secSkillProbability; //probabilities of gaining secondary skills (out of 112), in id order
  43. std::map<FactionID, int> selectionProbability; //probability of selection in towns
  44. AnimationPath imageBattleMale;
  45. AnimationPath imageBattleFemale;
  46. std::string imageMapMale;
  47. std::string imageMapFemale;
  48. CHeroClass();
  49. int32_t getIndex() const override;
  50. int32_t getIconIndex() const override;
  51. std::string getJsonKey() const override;
  52. std::string getModScope() const override;
  53. HeroClassID getId() const override;
  54. void registerIcons(const IconRegistar & cb) const override;
  55. std::string getNameTranslated() const override;
  56. std::string getNameTextID() const override;
  57. bool isMagicHero() const;
  58. void updateFrom(const JsonNode & data);
  59. void serializeJson(JsonSerializeFormat & handler);
  60. EAlignment getAlignment() const;
  61. int tavernProbability(FactionID faction) const;
  62. };
  63. VCMI_LIB_NAMESPACE_END