Browse Source

nullkiller2: add scroll count to reward size calculation in priority evaluator to mirror PR from NK1

Mircea TheHonestCTO 1 month ago
parent
commit
6888cf0f5f
1 changed files with 4 additions and 1 deletions
  1. 4 1
      AI/Nullkiller2/Engine/PriorityEvaluator.cpp

+ 4 - 1
AI/Nullkiller2/Engine/PriorityEvaluator.cpp

@@ -280,7 +280,10 @@ uint64_t RewardEvaluator::getArmyReward(
 			for(const auto & stackInfo : info.reward.creatures)
 				rewardValue += stackInfo.getType()->getAIValue() * stackInfo.getCount();
 
-			totalValue += rewardValue > 0 ? rewardValue / (info.reward.grantedArtifacts.size() + info.reward.creatures.size()) : 0;
+			const auto combined_size = std::min(static_cast<size_t>(1),
+			                                    info.reward.grantedArtifacts.size() + info.reward.creatures.size() +
+			                                    info.reward.grantedScrolls.size());
+			totalValue += rewardValue > 0 ? rewardValue / combined_size : 0;
 		}
 
 		return totalValue;