AIhelper.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * AIhelper.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. /*
  12. !!! Note: Include THIS file at the end of include list to avoid "undefined base class" error
  13. */
  14. #include "ArmyManager.h"
  15. #include "HeroManager.h"
  16. #include "Pathfinding/PathfindingManager.h"
  17. class ResourceManager;
  18. class BuildingManager;
  19. //TODO: remove class, put managers to engine
  20. class DLL_EXPORT AIhelper : public IPathfindingManager, public IArmyManager, public IHeroManager
  21. {
  22. //std::shared_ptr<ResourceManager> resourceManager;
  23. //std::shared_ptr<BuildingManager> buildingManager;
  24. std::shared_ptr<PathfindingManager> pathfindingManager;
  25. std::shared_ptr<ArmyManager> armyManager;
  26. std::shared_ptr<HeroManager> heroManager;
  27. //TODO: vector<IAbstractManager>
  28. public:
  29. AIhelper();
  30. ~AIhelper();
  31. std::vector<AIPath> getPathsToTile(const HeroPtr & hero, const int3 & tile) const override;
  32. std::vector<AIPath> getPathsToTile(const int3 & tile) const override;
  33. void updatePaths(std::vector<HeroPtr> heroes, bool useHeroChain = false) override;
  34. STRONG_INLINE
  35. bool isTileAccessible(const HeroPtr & hero, const int3 & tile) const
  36. {
  37. return pathfindingManager->isTileAccessible(hero, tile);
  38. }
  39. bool canGetArmy(const CArmedInstance * target, const CArmedInstance * source) const override;
  40. ui64 howManyReinforcementsCanBuy(const CCreatureSet * target, const CGDwelling * source) const override;
  41. ui64 howManyReinforcementsCanGet(const CCreatureSet * target, const CCreatureSet * source) const override;
  42. std::vector<SlotInfo> getBestArmy(const CCreatureSet * target, const CCreatureSet * source) const override;
  43. std::vector<SlotInfo>::iterator getWeakestCreature(std::vector<SlotInfo> & army) const override;
  44. std::vector<SlotInfo> getSortedSlots(const CCreatureSet * target, const CCreatureSet * source) const override;
  45. std::vector<creInfo> getArmyAvailableToBuy(const CCreatureSet * hero, const CGDwelling * dwelling) const override;
  46. uint64_t evaluateStackPower(const CCreature * creature, int count) const override;
  47. SlotInfo getTotalCreaturesAvailable(CreatureID creatureID) const override;
  48. ArmyUpgradeInfo calculateCreateresUpgrade(
  49. const CCreatureSet * army,
  50. const CGObjectInstance * upgrader,
  51. const TResources & availableResources) const override;
  52. const std::map<HeroPtr, HeroRole> & getHeroRoles() const override;
  53. HeroRole getHeroRole(const HeroPtr & hero) const override;
  54. int selectBestSkill(const HeroPtr & hero, const std::vector<SecondarySkill> & skills) const override;
  55. float evaluateSecSkill(SecondarySkill skill, const CGHeroInstance * hero) const override;
  56. float evaluateHero(const CGHeroInstance * hero) const override;
  57. void update() override;
  58. void init(CPlayerSpecificInfoCallback * CB) override;
  59. void setAI(VCAI * AI) override;
  60. };