RecruitHero.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * RecruitHero.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.h"
  12. #include "../VCAI.h"
  13. #include "../AIUtility.h"
  14. #include "../AIhelper.h"
  15. #include "../FuzzyHelper.h"
  16. #include "../ResourceManager.h"
  17. #include "../BuildingManager.h"
  18. #include "../../../lib/mapping/CMap.h" //for victory conditions
  19. #include "../../../lib/CPathfinder.h"
  20. #include "../../../lib/StringConstants.h"
  21. extern boost::thread_specific_ptr<CCallback> cb;
  22. extern boost::thread_specific_ptr<VCAI> ai;
  23. extern FuzzyHelper * fh;
  24. using namespace Goals;
  25. TSubgoal RecruitHero::whatToDoToAchieve()
  26. {
  27. const CGTownInstance * t = ai->findTownWithTavern();
  28. if(!t)
  29. return sptr(BuildThis(BuildingID::TAVERN).setpriority(2));
  30. TResources res;
  31. res[Res::GOLD] = GameConstants::HERO_GOLD_COST;
  32. return ai->ah->whatToDo(res, iAmElementar()); //either buy immediately, or collect res
  33. }