CCommanderInstance.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * CCommanderInstance.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 "CStackInstance.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class DLL_LINKAGE CCommanderInstance : public CStackInstance
  14. {
  15. public:
  16. //TODO: what if Commander is not a part of creature set?
  17. //commander class is determined by its base creature
  18. ui8 alive; //maybe change to bool when breaking save compatibility?
  19. ui8 level; //required only to count callbacks
  20. std::string name; // each Commander has different name
  21. std::vector<ui8> secondarySkills; //ID -> level
  22. std::set<ui8> specialSkills;
  23. //std::vector <CArtifactInstance *> arts;
  24. CCommanderInstance(IGameInfoCallback * cb);
  25. CCommanderInstance(IGameInfoCallback * cb, const CreatureID & id);
  26. void setAlive(bool alive);
  27. void levelUp();
  28. bool canGainExperience() const override;
  29. bool gainsLevel() const; //true if commander has lower level than should upon his experience
  30. ui64 getPower() const override
  31. {
  32. return 0;
  33. };
  34. int getExpRank() const override;
  35. int getLevel() const override;
  36. ArtBearer bearerType() const override; //from CArtifactSet
  37. template<typename Handler>
  38. void serialize(Handler & h)
  39. {
  40. h & static_cast<CStackInstance &>(*this);
  41. h & alive;
  42. h & level;
  43. h & name;
  44. h & secondarySkills;
  45. h & specialSkills;
  46. }
  47. };
  48. VCMI_LIB_NAMESPACE_END