mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-22 23:34:24 +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:
parent
ab2c848f9a
commit
f2aefd0061
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user