Damage.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Damage.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. VCMI_LIB_NAMESPACE_BEGIN
  13. struct StacksInjured;
  14. namespace spells
  15. {
  16. namespace effects
  17. {
  18. class Damage : public UnitEffect
  19. {
  20. public:
  21. void apply(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const override;
  22. protected:
  23. bool isReceptive(const Mechanics * m, const battle::Unit * unit) const override;
  24. void serializeJsonUnitEffect(JsonSerializeFormat & handler) override final;
  25. int64_t damageForTarget(size_t targetIndex, const Mechanics * m, const battle::Unit * target) const;
  26. virtual void describeEffect(std::vector<MetaString> & log, const Mechanics * m, const battle::Unit * firstTarget, uint32_t kills, int64_t damage, bool multiple) const;
  27. private:
  28. bool killByPercentage = false;
  29. bool killByCount = false;
  30. };
  31. }
  32. }
  33. VCMI_LIB_NAMESPACE_END