mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 15:01:09 -04:00
Fixed errors caused by AI civs not having any non-researched techs to choose from, when all techs are researched - now choose future tech again
This commit is contained in:
parent
653cb556cf
commit
5a78c612ab
@ -1,6 +1,5 @@
|
|||||||
package com.unciv.logic.automation
|
package com.unciv.logic.automation
|
||||||
|
|
||||||
import com.unciv.logic.city.CityInfo
|
|
||||||
import com.unciv.logic.civilization.CivilizationInfo
|
import com.unciv.logic.civilization.CivilizationInfo
|
||||||
import com.unciv.logic.civilization.PlayerType
|
import com.unciv.logic.civilization.PlayerType
|
||||||
import com.unciv.logic.map.MapUnit
|
import com.unciv.logic.map.MapUnit
|
||||||
@ -85,6 +84,11 @@ class NextTurnAutomation{
|
|||||||
val costs = techsGroups.keys.sorted()
|
val costs = techsGroups.keys.sorted()
|
||||||
|
|
||||||
val tech: Technology
|
val tech: Technology
|
||||||
|
if (researchableTechs.isEmpty()) { // no non-researched techs available, go for future tech
|
||||||
|
civInfo.tech.techsToResearch.add("Future Tech")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val techsCheapest = techsGroups[costs[0]]!!
|
val techsCheapest = techsGroups[costs[0]]!!
|
||||||
//Do not consider advanced techs if only one tech left in cheapest groupe
|
//Do not consider advanced techs if only one tech left in cheapest groupe
|
||||||
if (techsCheapest.size == 1 || costs.size == 1) {
|
if (techsCheapest.size == 1 || costs.size == 1) {
|
||||||
@ -94,6 +98,7 @@ class NextTurnAutomation{
|
|||||||
val techsAdvanced = techsGroups[costs[1]]!!
|
val techsAdvanced = techsGroups[costs[1]]!!
|
||||||
tech = (techsCheapest + techsAdvanced).getRandom()
|
tech = (techsCheapest + techsAdvanced).getRandom()
|
||||||
}
|
}
|
||||||
|
|
||||||
civInfo.tech.techsToResearch.add(tech.name)
|
civInfo.tech.techsToResearch.add(tech.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user