Moat.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Moat.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 "Obstacle.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. struct Bonus;
  14. namespace spells
  15. {
  16. namespace effects
  17. {
  18. class Moat : public Obstacle
  19. {
  20. private:
  21. ObstacleSideOptions sideOptions; //Defender only
  22. std::vector<BattleHexArray> moatHexes; //Determine number of moat patches and hexes
  23. std::vector<std::shared_ptr<Bonus>> bonus; //For battle-wide bonuses
  24. bool dispellable; //For Tower landmines
  25. int moatDamage; // Minimal moat damage
  26. public:
  27. void apply(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const override;
  28. protected:
  29. void serializeJsonEffect(JsonSerializeFormat & handler) override;
  30. void placeObstacles(ServerCallback * server, const Mechanics * m, const EffectTarget & target) const override;
  31. void convertBonus(const Mechanics * m, std::vector<Bonus> & converted) const;
  32. };
  33. }
  34. }
  35. VCMI_LIB_NAMESPACE_END