浏览代码

BattleAI: fix waited attack calculation

Andrii Danylchenko 1 年之前
父节点
当前提交
4e83deca92
共有 2 个文件被更改,包括 6 次插入0 次删除
  1. 1 0
      AI/BattleAI/BattleExchangeVariant.cpp
  2. 5 0
      AI/BattleAI/StackWithBonuses.h

+ 1 - 0
AI/BattleAI/BattleExchangeVariant.cpp

@@ -230,6 +230,7 @@ EvaluationResult BattleExchangeEvaluator::findBestTarget(
 
 		auto hbWaited = std::make_shared<HypotheticBattle>(env.get(), hb);
 
+		hbWaited->resetActiveUnit();
 		hbWaited->getForUpdate(activeStack->unitId())->waiting = true;
 		hbWaited->getForUpdate(activeStack->unitId())->waitedThisTurn = true;
 

+ 5 - 0
AI/BattleAI/StackWithBonuses.h

@@ -164,6 +164,11 @@ public:
 
 	int64_t getTreeVersion() const;
 
+	void resetActiveUnit()
+	{
+		activeUnitId = -1;
+	}
+
 #if SCRIPTING_ENABLED
 	scripting::Pool * getContextPool() const override;
 #endif