Damage.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. struct StacksInjured;
  13. namespace spells
  14. {
  15. namespace effects
  16. {
  17. class Damage : public UnitEffect
  18. {
  19. public:
  20. Damage();
  21. virtual ~Damage();
  22. void apply(BattleStateProxy * battleState, RNG & rng, const Mechanics * m, const EffectTarget & target) const override;
  23. protected:
  24. bool isReceptive(const Mechanics * m, const battle::Unit * unit) const override;
  25. void serializeJsonUnitEffect(JsonSerializeFormat & handler) override final;
  26. int64_t damageForTarget(size_t targetIndex, const Mechanics * m, const battle::Unit * target) const;
  27. virtual void describeEffect(std::vector<MetaString> & log, const Mechanics * m, const battle::Unit * firstTarget, uint32_t kills, int64_t damage, bool multiple) const;
  28. private:
  29. int32_t customEffectId;
  30. bool killByPercentage;
  31. bool killByCount;
  32. void prepareEffects(StacksInjured & stacksInjured, RNG & rng, const Mechanics * m, const EffectTarget & target, bool describe) const;
  33. };
  34. }
  35. }