RemoveObstacle.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * RemoveObstacle.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 "LocationEffect.h"
  12. #include "../../GameConstants.h"
  13. struct CObstacleInstance;
  14. struct BattleObstaclesChanged;
  15. namespace spells
  16. {
  17. namespace effects
  18. {
  19. class RemoveObstacle : public LocationEffect
  20. {
  21. public:
  22. RemoveObstacle();
  23. virtual ~RemoveObstacle();
  24. bool applicable(Problem & problem, const Mechanics * m) const override;
  25. bool applicable(Problem & problem, const Mechanics * m, const EffectTarget & target) const override;
  26. void apply(BattleStateProxy * battleState, RNG & rng, const Mechanics * m, const EffectTarget & target) const override;
  27. protected:
  28. void serializeJsonEffect(JsonSerializeFormat & handler) override;
  29. private:
  30. bool removeAbsolute;
  31. bool removeUsual;
  32. bool removeAllSpells;
  33. std::set<SpellID> removeSpells;
  34. bool canRemove(const CObstacleInstance * obstacle) const;
  35. std::set<const CObstacleInstance *> getTargets(const Mechanics * m, const EffectTarget & target, bool alwaysMassive) const;
  36. };
  37. }
  38. }