BoatActions.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. public:
  20. virtual const ChainActor * getActor(const ChainActor * sourceActor) const = 0;
  21. };
  22. class SummonBoatAction : public VirtualBoatAction
  23. {
  24. public:
  25. virtual void execute(const CGHeroInstance * hero) const override;
  26. virtual void applyOnDestination(
  27. const CGHeroInstance * hero,
  28. CDestinationNodeInfo & destination,
  29. const PathNodeInfo & source,
  30. AIPathNode * dstMode,
  31. const AIPathNode * srcNode) const override;
  32. virtual bool canAct(const AIPathNode * source) const override;
  33. virtual const ChainActor * getActor(const ChainActor * sourceActor) const override;
  34. virtual std::string toString() const override;
  35. private:
  36. uint32_t getManaCost(const CGHeroInstance * hero) const;
  37. };
  38. class BuildBoatAction : public VirtualBoatAction
  39. {
  40. private:
  41. const IShipyard * shipyard;
  42. const CPlayerSpecificInfoCallback * cb;
  43. public:
  44. BuildBoatAction(const CPlayerSpecificInfoCallback * cb, const IShipyard * shipyard)
  45. : cb(cb), shipyard(shipyard)
  46. {
  47. }
  48. virtual bool canAct(const AIPathNode * source) const override;
  49. virtual void execute(const CGHeroInstance * hero) const override;
  50. virtual Goals::TSubgoal decompose(const CGHeroInstance * hero) const override;
  51. virtual const ChainActor * getActor(const ChainActor * sourceActor) const override;
  52. virtual std::string toString() const override;
  53. virtual const CGObjectInstance * targetObject() const override;
  54. };
  55. }
  56. }