BoatActions.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 "ISpecialAction.h"
  12. #include "../../../lib/mapping/CMap.h"
  13. #include "../../../lib/mapObjects/MapObjects.h"
  14. namespace AIPathfinding
  15. {
  16. class VirtualBoatAction : public ISpecialAction
  17. {
  18. private:
  19. uint64_t specialChain;
  20. public:
  21. VirtualBoatAction(uint64_t specialChain)
  22. :specialChain(specialChain)
  23. {
  24. }
  25. uint64_t getSpecialChain() const
  26. {
  27. return specialChain;
  28. }
  29. };
  30. class SummonBoatAction : public VirtualBoatAction
  31. {
  32. public:
  33. SummonBoatAction()
  34. :VirtualBoatAction(AINodeStorage::CAST_CHAIN)
  35. {
  36. }
  37. virtual Goals::TSubgoal whatToDo(const HeroPtr & hero) const override;
  38. virtual void applyOnDestination(
  39. const HeroPtr & hero,
  40. CDestinationNodeInfo & destination,
  41. const PathNodeInfo & source,
  42. AIPathNode * dstMode,
  43. const AIPathNode * srcNode) const override;
  44. bool isAffordableBy(const HeroPtr & hero, const AIPathNode * source) const;
  45. private:
  46. uint32_t getManaCost(const HeroPtr & hero) const;
  47. };
  48. class BuildBoatAction : public VirtualBoatAction
  49. {
  50. private:
  51. const IShipyard * shipyard;
  52. public:
  53. BuildBoatAction(const IShipyard * shipyard)
  54. :VirtualBoatAction(AINodeStorage::RESOURCE_CHAIN), shipyard(shipyard)
  55. {
  56. }
  57. virtual Goals::TSubgoal whatToDo(const HeroPtr & hero) const override;
  58. };
  59. }