BoatActions.h 1.4 KB

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