瀏覽代碼

Update DefenceBehavior.cpp

Heroes will no longer rush to defend towns that have a standing garrison that they can't merge their armies with.
Xilmi 1 年之前
父節點
當前提交
cfe4d7592a
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      AI/Nullkiller/Behaviors/DefenceBehavior.cpp

+ 10 - 0
AI/Nullkiller/Behaviors/DefenceBehavior.cpp

@@ -249,6 +249,16 @@ void DefenceBehavior::evaluateDefence(Goals::TGoalVec & tasks, const CGTownInsta
 				continue;
 			}
 
+			if (!path.targetHero->canBeMergedWith(*town))
+			{
+#if NKAI_TRACE_LEVEL >= 1
+				logAi->trace("Can't merge armies of hero %s and town %s",
+					path.targetHero->getObjectName(),
+					town->getObjectName());
+#endif
+				continue;
+			}
+
 			if(path.targetHero == town->visitingHero.get() && path.exchangeCount == 1)
 			{
 #if NKAI_TRACE_LEVEL >= 1