Dispel.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Dispel.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 Bonus;
  13. class CSelector;
  14. class BonusList;
  15. struct SetStackEffect;
  16. namespace spells
  17. {
  18. namespace effects
  19. {
  20. class Dispel : public UnitEffect
  21. {
  22. public:
  23. Dispel();
  24. virtual ~Dispel();
  25. void apply(BattleStateProxy * battleState, RNG & rng, const Mechanics * m, const EffectTarget & target) const override;
  26. protected:
  27. bool isValidTarget(const Mechanics * m, const battle::Unit * unit) const override;
  28. void serializeJsonUnitEffect(JsonSerializeFormat & handler) override final;
  29. private:
  30. bool positive = false;
  31. bool negative = false;
  32. bool neutral = false;
  33. std::shared_ptr<const BonusList> getBonuses(const Mechanics * m, const battle::Unit * unit) const;
  34. static bool mainSelector(const Bonus * bonus);
  35. void prepareEffects(SetStackEffect & pack, RNG & rng, const Mechanics * m, const EffectTarget & target, bool describe) const;
  36. };
  37. }
  38. }