WhirlpoolAction.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * WhirlpoolAction.cpp, 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. #include "StdInc.h"
  11. #include "../../Goals/AdventureSpellCast.h"
  12. #include "../../../../lib/mapObjects/MapObjects.h"
  13. #include "WhirlpoolAction.h"
  14. #include "../../AIGateway.h"
  15. namespace NKAI
  16. {
  17. using namespace AIPathfinding;
  18. std::shared_ptr<WhirlpoolAction> WhirlpoolAction::instance = std::make_shared<WhirlpoolAction>();
  19. void WhirlpoolAction::execute(AIGateway * ai, const CGHeroInstance * hero) const
  20. {
  21. ai->nullkiller->armyFormation->rearrangeArmyForWhirlpool(hero);
  22. }
  23. std::string WhirlpoolAction::toString() const
  24. {
  25. return "Prepare for whirlpool";
  26. }
  27. /*
  28. bool TownPortalAction::canAct(const CGHeroInstance * hero, const AIPathNode * source) const
  29. {
  30. #ifdef VCMI_TRACE_PATHFINDER
  31. logAi->trace(
  32. "Hero %s has %d mana and needed %d and already spent %d",
  33. hero->name,
  34. hero->mana,
  35. getManaCost(hero),
  36. source->manaCost);
  37. #endif
  38. return hero->mana >= source->manaCost + getManaCost(hero);
  39. }
  40. uint32_t TownPortalAction::getManaCost(const CGHeroInstance * hero) const
  41. {
  42. SpellID summonBoat = SpellID::TOWN_PORTAL;
  43. return hero->getSpellCost(summonBoat.toSpell());
  44. }*/
  45. }