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