BoatActions.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * BoatActions.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 "SpecialAction.h"
  12. #include "../../../../lib/mapObjects/MapObjects.h"
  13. namespace NKAI
  14. {
  15. namespace AIPathfinding
  16. {
  17. class VirtualBoatAction : public SpecialAction
  18. {
  19. };
  20. class SummonBoatAction : public VirtualBoatAction
  21. {
  22. public:
  23. void execute(const CGHeroInstance * hero) const override;
  24. virtual void applyOnDestination(
  25. const CGHeroInstance * hero,
  26. CDestinationNodeInfo & destination,
  27. const PathNodeInfo & source,
  28. AIPathNode * dstMode,
  29. const AIPathNode * srcNode) const override;
  30. bool canAct(const AIPathNode * source) const override;
  31. const ChainActor * getActor(const ChainActor * sourceActor) const override;
  32. virtual std::string toString() const override;
  33. private:
  34. int32_t getManaCost(const CGHeroInstance * hero) const;
  35. };
  36. class BuildBoatAction : public VirtualBoatAction
  37. {
  38. private:
  39. const IShipyard * shipyard;
  40. const CPlayerSpecificInfoCallback * cb;
  41. public:
  42. BuildBoatAction(const CPlayerSpecificInfoCallback * cb, const IShipyard * shipyard)
  43. : cb(cb), shipyard(shipyard)
  44. {
  45. }
  46. bool canAct(const AIPathNode * source) const override;
  47. void execute(const CGHeroInstance * hero) const override;
  48. virtual Goals::TSubgoal decompose(const CGHeroInstance * hero) const override;
  49. const ChainActor * getActor(const ChainActor * sourceActor) const override;
  50. virtual std::string toString() const override;
  51. const CGObjectInstance * targetObject() const override;
  52. };
  53. }
  54. }