CCommanderInstance.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 {return 0;};
  31. int getExpRank() const override;
  32. int getLevel() const override;
  33. ArtBearer bearerType() const override; //from CArtifactSet
  34. template <typename Handler> void serialize(Handler &h)
  35. {
  36. h & static_cast<CStackInstance&>(*this);
  37. h & alive;
  38. h & level;
  39. h & name;
  40. h & secondarySkills;
  41. h & specialSkills;
  42. }
  43. };
  44. VCMI_LIB_NAMESPACE_END