City states now get free techs from major civs. (#1175)

This commit is contained in:
Duan Tao 2019-10-10 17:10:54 +08:00 committed by Yair Morgenstern
parent 222e4ad4b5
commit 362184e515

View file

@ -29,6 +29,8 @@ class NextTurnAutomation{
exchangeLuxuries(civInfo)
issueRequests(civInfo)
adoptPolicy(civInfo)
} else {
getFreeTechForCityStates(civInfo)
}
chooseTechToResearch(civInfo)
@ -117,17 +119,6 @@ class NextTurnAutomation{
private fun exchangeTechs(civInfo: CivilizationInfo) {
if(!civInfo.gameInfo.getDifficulty().aisExchangeTechs) return
if (civInfo.isCityState()) { //City states automatically get all invented techs
for (otherCiv in civInfo.getKnownCivs().filterNot { it.isCityState() }) {
for (entry in otherCiv.tech.techsResearched
.filterNot { civInfo.tech.isResearched(it) }
.filter { civInfo.tech.canBeResearched(it) }) {
civInfo.tech.addTechnology(entry)
}
}
return
}
val otherCivList = civInfo.getKnownCivs()
.filter { it.playerType == PlayerType.AI && it.isMajorCiv() }
.sortedBy { it.tech.techsResearched.size }
@ -166,6 +157,18 @@ class NextTurnAutomation{
}
}
private fun getFreeTechForCityStates(civInfo: CivilizationInfo) {
//City states automatically get all invented techs
for (otherCiv in civInfo.getKnownCivs().filterNot { it.isCityState() }) {
for (entry in otherCiv.tech.techsResearched
.filterNot { civInfo.tech.isResearched(it) }
.filter { civInfo.tech.canBeResearched(it) }) {
civInfo.tech.addTechnology(entry)
}
}
return
}
private fun chooseTechToResearch(civInfo: CivilizationInfo) {
if (civInfo.tech.techsToResearch.isEmpty()) {
val researchableTechs = GameBasics.Technologies.values.filter { !civInfo.tech.isResearched(it.name) && civInfo.tech.canBeResearched(it.name) }