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

@ -265,8 +265,11 @@ object NextTurnAutomation {
while(civInfo.tech.freeTechs > 0) {
val costs = getGroupedResearchableTechs()
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) }
civInfo.tech.getFreeTechnology(chosenTech.name)
}