SpecialAction.h 943 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * SpecialAction.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 "../../AIUtility.h"
  12. #include "../../Goals/AbstractGoal.h"
  13. namespace NKAI
  14. {
  15. struct AIPathNode;
  16. class SpecialAction
  17. {
  18. public:
  19. virtual ~SpecialAction() = default;
  20. virtual bool canAct(const AIPathNode * source) const
  21. {
  22. return true;
  23. }
  24. virtual Goals::TSubgoal decompose(const CGHeroInstance * hero) const;
  25. virtual void execute(const CGHeroInstance * hero) const;
  26. virtual void applyOnDestination(
  27. const CGHeroInstance * hero,
  28. CDestinationNodeInfo & destination,
  29. const PathNodeInfo & source,
  30. AIPathNode * dstMode,
  31. const AIPathNode * srcNode) const
  32. {
  33. }
  34. virtual std::string toString() const = 0;
  35. virtual const CGObjectInstance * targetObject() const { return nullptr; }
  36. };
  37. }