AI: Don't pick most expensive tech as free tech, if it's marked as "0 weight for AI decisions"

This commit is contained in:
yairm210
2024-12-09 18:10:23 +02:00
parent ab2c848f9a
commit f2aefd0061

View File

@ -266,7 +266,10 @@ object NextTurnAutomation {
val costs = getGroupedResearchableTechs() val costs = getGroupedResearchableTechs()
if (costs.isEmpty()) return if (costs.isEmpty()) return
val mostExpensiveTechs = costs[costs.size - 1] val mostExpensiveTechs = costs.lastOrNull{
// Ignore rows where all techs have 0 weight
it.any { it.getWeightForAiDecision(stateForConditionals) > 0 }
} ?: costs.last()
val chosenTech = mostExpensiveTechs.randomWeighted { it.getWeightForAiDecision(stateForConditionals) } val chosenTech = mostExpensiveTechs.randomWeighted { it.getWeightForAiDecision(stateForConditionals) }
civInfo.tech.getFreeTechnology(chosenTech.name) civInfo.tech.getFreeTechnology(chosenTech.name)
} }