BoatActions.h 1.5 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 "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. SpellID usedSpell;
  32. public:
  33. SummonBoatAction(SpellID usedSpell)
  34. :VirtualBoatAction(AINodeStorage::CAST_CHAIN)
  35. ,usedSpell(usedSpell)
  36. {
  37. }
  38. Goals::TSubgoal whatToDo(const HeroPtr & hero) const override;
  39. virtual void applyOnDestination(
  40. const CGHeroInstance * hero,
  41. CDestinationNodeInfo & destination,
  42. const PathNodeInfo & source,
  43. AIPathNode * dstMode,
  44. const AIPathNode * srcNode) const override;
  45. bool isAffordableBy(const CGHeroInstance * hero, const AIPathNode * source) const;
  46. private:
  47. uint32_t getManaCost(const CGHeroInstance * hero) const;
  48. };
  49. class BuildBoatAction : public VirtualBoatAction
  50. {
  51. private:
  52. const IShipyard * shipyard;
  53. public:
  54. BuildBoatAction(const IShipyard * shipyard)
  55. :VirtualBoatAction(AINodeStorage::RESOURCE_CHAIN), shipyard(shipyard)
  56. {
  57. }
  58. Goals::TSubgoal whatToDo(const HeroPtr & hero) const override;
  59. };
  60. }