diff --git a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp index ce065b4ca..b17f2e026 100644 --- a/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp +++ b/AI/Nullkiller/Analyzers/DangerHitMapAnalyzer.cpp @@ -70,7 +70,7 @@ void DangerHitMapAnalyzer::updateHitMap() auto turn = path.turn(); auto & node = hitMap[pos.x][pos.y][pos.z]; - if(tileDanger > node.maximumDanger.danger + if(tileDanger / (turn + 1) > node.maximumDanger.danger / (node.maximumDanger.turn + 1) || (tileDanger == node.maximumDanger.danger && node.maximumDanger.turn > turn)) { node.maximumDanger.danger = tileDanger; diff --git a/AI/Nullkiller/Behaviors/DefenceBehavior.cpp b/AI/Nullkiller/Behaviors/DefenceBehavior.cpp index 8964e173e..54c3d159c 100644 --- a/AI/Nullkiller/Behaviors/DefenceBehavior.cpp +++ b/AI/Nullkiller/Behaviors/DefenceBehavior.cpp @@ -30,7 +30,7 @@ namespace NKAI extern boost::thread_specific_ptr cb; extern boost::thread_specific_ptr ai; -const double TREAT_IGNORE_RATIO = 0.5; +const float TREAT_IGNORE_RATIO = 2; using namespace Goals; @@ -133,7 +133,7 @@ void DefenceBehavior::evaluateDefence(Goals::TGoalVec & tasks, const CGTownInsta tasks.push_back(Goals::sptr(composition)); } - bool treatIsWeak = path.getHeroStrength() / treat.danger > TREAT_IGNORE_RATIO; + bool treatIsWeak = path.getHeroStrength() / (float)treat.danger > TREAT_IGNORE_RATIO; bool needToSaveGrowth = treat.turn == 0 && dayOfWeek == 7; if(treatIsWeak && !needToSaveGrowth) diff --git a/AI/Nullkiller/Engine/FuzzyHelper.cpp b/AI/Nullkiller/Engine/FuzzyHelper.cpp index d0c5d7108..540e58240 100644 --- a/AI/Nullkiller/Engine/FuzzyHelper.cpp +++ b/AI/Nullkiller/Engine/FuzzyHelper.cpp @@ -130,8 +130,6 @@ ui64 FuzzyHelper::evaluateDanger(const CGObjectInstance * obj) return danger; } - case Obj::PANDORAS_BOX: - return 10000; //Who knows what awaits us there case Obj::ARTIFACT: case Obj::RESOURCE: @@ -148,6 +146,7 @@ ui64 FuzzyHelper::evaluateDanger(const CGObjectInstance * obj) case Obj::CREATURE_GENERATOR4: case Obj::MINE: case Obj::ABANDONED_MINE: + case Obj::PANDORAS_BOX: { const CArmedInstance * a = dynamic_cast(obj); return a->getArmyStrength(); diff --git a/AI/Nullkiller/Engine/PriorityEvaluator.cpp b/AI/Nullkiller/Engine/PriorityEvaluator.cpp index 25f6e0091..e90f14a4b 100644 --- a/AI/Nullkiller/Engine/PriorityEvaluator.cpp +++ b/AI/Nullkiller/Engine/PriorityEvaluator.cpp @@ -781,9 +781,11 @@ public: if(garrisonHero && swapCommand.getLockingReason() == HeroLockedReason::DEFENCE) { auto defenderRole = evaluationContext.evaluator.ai->heroManager->getHeroRole(garrisonHero); + auto mpLeft = garrisonHero->movement / (float)garrisonHero->maxMovePoints(true); - evaluationContext.movementCost += garrisonHero->movement; - evaluationContext.movementCostByRole[defenderRole] += garrisonHero->movement; + evaluationContext.movementCost += mpLeft; + evaluationContext.movementCostByRole[defenderRole] += mpLeft; + evaluationContext.heroRole = defenderRole; } } }; diff --git a/config/ai/object-priorities.txt b/config/ai/object-priorities.txt index 18f2a605d..b90a350f7 100644 --- a/config/ai/object-priorities.txt +++ b/config/ai/object-priorities.txt @@ -191,7 +191,10 @@ RuleBlock: gold reward rule: if armyReward is LOW and heroRole is MAIN and danger is NONE and mainTurnDistance is LOWEST then Value is HIGH rule: if skillReward is LOW and heroRole is MAIN and armyLoss is LOW then Value is BITHIGH rule: if skillReward is MEDIUM and heroRole is MAIN and armyLoss is LOW and fear is not HIGH then Value is BITHIGH + rule: if skillReward is MEDIUM and heroRole is MAIN and rewardType is MIXED and armyLoss is LOW and fear is not HIGH then Value is HIGH with 0.5 rule: if skillReward is HIGH and heroRole is MAIN and armyLoss is LOW and fear is not HIGH then Value is HIGH + rule: if skillReward is MEDIUM and heroRole is SCOUT then Value is LOWEST + rule: if skillReward is HIGH and heroRole is SCOUT then Value is LOWEST rule: if strategicalValue is LOW and heroRole is MAIN and armyLoss is LOW then Value is BITHIGH rule: if strategicalValue is LOWEST and heroRole is MAIN and armyLoss is LOW then Value is LOW rule: if strategicalValue is LOW and heroRole is SCOUT and armyLoss is LOW and fear is not HIGH then Value is HIGH with 0.5