ExecuteHeroChain.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * ExecuteHeroChain.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 "CGoal.h"
  12. #include "../Pathfinding/AIPathfinder.h"
  13. namespace NKAI
  14. {
  15. namespace Goals
  16. {
  17. class DLL_EXPORT ExecuteHeroChain : public ElementarGoal<ExecuteHeroChain>
  18. {
  19. private:
  20. AIPath chainPath;
  21. std::string targetName;
  22. public:
  23. float closestWayRatio;
  24. ExecuteHeroChain(const AIPath & path, const CGObjectInstance * obj = nullptr);
  25. void accept(AIGateway * ai) override;
  26. std::string toString() const override;
  27. bool operator==(const ExecuteHeroChain & other) const override;
  28. const AIPath & getPath() const { return chainPath; }
  29. int getHeroExchangeCount() const override { return chainPath.exchangeCount; }
  30. std::vector<ObjectInstanceID> getAffectedObjects() const override;
  31. bool isObjectAffected(ObjectInstanceID id) const override;
  32. private:
  33. bool moveHeroToTile(AIGateway * ai, const CGHeroInstance * hero, const int3 & tile);
  34. };
  35. }
  36. }