mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-04 15:27:50 +07:00
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:
@ -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)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user