Heal.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. void apply(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const override;
  24. protected:
  25. void apply(int64_t value, ServerCallback * server, const Mechanics * m, const EffectTarget & target) const;
  26. bool isValidTarget(const Mechanics * m, const battle::Unit * unit) const override;
  27. void serializeJsonUnitEffect(JsonSerializeFormat & handler) override final;
  28. private:
  29. EHealLevel healLevel = EHealLevel::HEAL;
  30. EHealPower healPower = EHealPower::PERMANENT;
  31. int32_t minFullUnits = 0;
  32. void prepareHealEffect(int64_t value, BattleUnitsChanged & pack, BattleLogMessage & logMessage, RNG & rng, const Mechanics * m, const EffectTarget & target) const;
  33. };
  34. }
  35. }
  36. VCMI_LIB_NAMESPACE_END