浏览代码

Fixed AI not taking hero-strength into account when hero is garrisoned.

When evaluating their fighting-chance against towns with a garrisoned hero the AI didn't consider the attribute-boosts of the defending hero.
Now it does.
Xilmi 1 年之前
父节点
当前提交
5907aae057
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      AI/Nullkiller/Engine/FuzzyHelper.cpp

+ 8 - 0
AI/Nullkiller/Engine/FuzzyHelper.cpp

@@ -73,6 +73,14 @@ ui64 FuzzyHelper::evaluateDanger(const int3 & tile, const CGHeroInstance * visit
 			}
 			objectDanger *= ai->heroManager->getFightingStrengthCached(hero);
 		}
+		if (objWithID<Obj::TOWN>(dangerousObject))
+		{
+			auto town = dynamic_cast<const CGTownInstance*>(dangerousObject);
+			auto hero = town->garrisonHero;
+
+			if (hero)
+				objectDanger *= ai->heroManager->getFightingStrengthCached(hero);
+		}
 
 		if(objectDanger)
 		{