Heal.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Heal.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 "UnitEffect.h"
  12. #include "../../GameConstants.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. struct BattleUnitsChanged;
  15. namespace spells
  16. {
  17. namespace effects
  18. {
  19. class Heal : public UnitEffect
  20. {
  21. public:
  22. Heal();
  23. virtual ~Heal();
  24. void apply(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const override;
  25. protected:
  26. void apply(int64_t value, ServerCallback * server, const Mechanics * m, const EffectTarget & target) const;
  27. bool isValidTarget(const Mechanics * m, const battle::Unit * unit) const override;
  28. void serializeJsonUnitEffect(JsonSerializeFormat & handler) override final;
  29. private:
  30. EHealLevel healLevel;
  31. EHealPower healPower;
  32. int32_t minFullUnits;
  33. void prepareHealEffect(int64_t value, BattleUnitsChanged & pack, RNG & rng, const Mechanics * m, const EffectTarget & target) const;
  34. };
  35. }
  36. }
  37. VCMI_LIB_NAMESPACE_END