RemoveObstacle.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. VCMI_LIB_NAMESPACE_BEGIN
  14. struct CObstacleInstance;
  15. struct BattleObstaclesChanged;
  16. namespace spells
  17. {
  18. namespace effects
  19. {
  20. class RemoveObstacle : public LocationEffect
  21. {
  22. public:
  23. RemoveObstacle();
  24. virtual ~RemoveObstacle();
  25. bool applicable(Problem & problem, const Mechanics * m) const override;
  26. bool applicable(Problem & problem, const Mechanics * m, const EffectTarget & target) const override;
  27. void apply(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const override;
  28. protected:
  29. void serializeJsonEffect(JsonSerializeFormat & handler) override;
  30. private:
  31. bool removeAbsolute;
  32. bool removeUsual;
  33. bool removeAllSpells;
  34. std::set<SpellID> removeSpells;
  35. bool canRemove(const CObstacleInstance * obstacle) const;
  36. std::set<const CObstacleInstance *> getTargets(const Mechanics * m, const EffectTarget & target, bool alwaysMassive) const;
  37. };
  38. }
  39. }
  40. VCMI_LIB_NAMESPACE_END