From a00a7762b5fcfce745e2649db525711bda5914b0 Mon Sep 17 00:00:00 2001 From: Dydzio Date: Mon, 15 Oct 2018 21:17:14 +0200 Subject: [PATCH 1/2] Fix for new pathfinder code - generate proper goals --- AI/VCAI/Pathfinding/PathfindingManager.cpp | 25 ++++------------------ AI/VCAI/Pathfinding/PathfindingManager.h | 2 -- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/AI/VCAI/Pathfinding/PathfindingManager.cpp b/AI/VCAI/Pathfinding/PathfindingManager.cpp index 510756603..e4bda806c 100644 --- a/AI/VCAI/Pathfinding/PathfindingManager.cpp +++ b/AI/VCAI/Pathfinding/PathfindingManager.cpp @@ -77,7 +77,10 @@ Goals::TGoalVec PathfindingManager::howToVisitObj(HeroPtr hero, ObjectIdRef obj, return findPath(hero, dest, allowGatherArmy, [&](int3 firstTileToGet) -> Goals::TSubgoal { - return selectVisitingGoal(hero, obj); + if(obj->ID.num == Obj::HERO && obj->getOwner() == hero->getOwner()) + return sptr(Goals::VisitHero(obj->id.getNum()).sethero(hero).setisAbstract(true)); + else + return sptr(Goals::VisitObj(obj->id.getNum()).sethero(hero).setisAbstract(true)); }); } @@ -141,26 +144,6 @@ Goals::TGoalVec PathfindingManager::findPath( return result; } -Goals::TSubgoal PathfindingManager::selectVisitingGoal(HeroPtr hero, ObjectIdRef obj) const -{ - int3 dest = obj->visitablePos(); - - if(obj->ID.num == Obj::HERO) //enemy hero may move to other position - { - return sptr(Goals::VisitHero(obj->id.getNum()).sethero(hero).setisAbstract(true)); - } - else //just visit that tile - { - //if target is town, fuzzy system will use additional "estimatedReward" variable to increase priority a bit - //TODO: change to getObj eventually and and move appropiate logic there - return obj->ID.num == Obj::TOWN - ? sptr(Goals::VisitTile(dest).sethero(hero).setobjid(obj->ID.num).setisAbstract(true)) - : sptr(Goals::VisitTile(dest).sethero(hero).setisAbstract(true)); - } - - return sptr(Goals::VisitTile(dest).sethero(hero).setisAbstract(true)); -} - Goals::TSubgoal PathfindingManager::clearWayTo(HeroPtr hero, int3 firstTileToGet) { if(isBlockedBorderGate(firstTileToGet)) diff --git a/AI/VCAI/Pathfinding/PathfindingManager.h b/AI/VCAI/Pathfinding/PathfindingManager.h index cf7f3d34f..f8626aeef 100644 --- a/AI/VCAI/Pathfinding/PathfindingManager.h +++ b/AI/VCAI/Pathfinding/PathfindingManager.h @@ -59,6 +59,4 @@ private: const std::function goalFactory); Goals::TSubgoal clearWayTo(HeroPtr hero, int3 firstTileToGet); - - Goals::TSubgoal selectVisitingGoal(HeroPtr hero, ObjectIdRef obj) const; }; \ No newline at end of file From 7ed4abd12d9f99dd0efb37b3b4e7de517bb6998b Mon Sep 17 00:00:00 2001 From: Dydzio Date: Mon, 15 Oct 2018 21:18:44 +0200 Subject: [PATCH 2/2] Default hero AI value seems low - tweak it --- config/objects/moddables.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/objects/moddables.json b/config/objects/moddables.json index c8fcb2144..69ccf20bf 100644 --- a/config/objects/moddables.json +++ b/config/objects/moddables.json @@ -23,7 +23,7 @@ "hero" : { "index" :34, "handler": "hero", - "defaultAiValue" : 5000, + "defaultAiValue" : 7500, "base" : { "base" : { "visitableFrom" : [ "+++", "+-+", "+++" ],