From 362184e51547b4dbf0cc3fa80cc59d54bfda39b9 Mon Sep 17 00:00:00 2001 From: Duan Tao Date: Thu, 10 Oct 2019 17:10:54 +0800 Subject: [PATCH] City states now get free techs from major civs. (#1175) --- .../logic/automation/NextTurnAutomation.kt | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt index dd61547433..5f63bcb04d 100644 --- a/core/src/com/unciv/logic/automation/NextTurnAutomation.kt +++ b/core/src/com/unciv/logic/automation/NextTurnAutomation.kt @@ -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) }