Heal.h 1.1 KB

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