RemoveObstacle.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. bool applicable(Problem & problem, const Mechanics * m) const override;
  24. bool applicable(Problem & problem, const Mechanics * m, const EffectTarget & target) const override;
  25. void apply(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const override;
  26. protected:
  27. void serializeJsonEffect(JsonSerializeFormat & handler) override;
  28. private:
  29. bool removeAbsolute = false;
  30. bool removeUsual = false;
  31. bool removeAllSpells = false;
  32. std::set<SpellID> removeSpells;
  33. bool canRemove(const CObstacleInstance * obstacle) const;
  34. std::set<const CObstacleInstance *> getTargets(const Mechanics * m, const EffectTarget & target, bool alwaysMassive) const;
  35. };
  36. }
  37. }
  38. VCMI_LIB_NAMESPACE_END