Removed tech exchange, as per Civ V - some of the logic is still there, to allow a gradual phase-out for games that have existing tech trades
This commit is contained in:
parent
950c761e44
commit
665404db4d
4 changed files with 0 additions and 49 deletions
|
@ -812,7 +812,6 @@ AI wonder cost modifier =
|
|||
AI building maintenance modifier =
|
||||
AI unit maintenance modifier =
|
||||
AI unhappiness modifier =
|
||||
AIs exchange techs =
|
||||
|
||||
Turns until barbarians enter player tiles =
|
||||
Gold reward for clearing barbarian camps =
|
||||
|
|
|
@ -31,7 +31,6 @@ object NextTurnAutomation{
|
|||
// offerDeclarationOfFriendship(civInfo)
|
||||
offerPeaceTreaty(civInfo)
|
||||
offerResearchAgreement(civInfo)
|
||||
exchangeTechs(civInfo)
|
||||
exchangeLuxuries(civInfo)
|
||||
issueRequests(civInfo)
|
||||
adoptPolicy(civInfo)
|
||||
|
@ -133,44 +132,6 @@ object NextTurnAutomation{
|
|||
}
|
||||
}
|
||||
|
||||
private fun exchangeTechs(civInfo: CivilizationInfo) {
|
||||
if (!civInfo.gameInfo.getDifficulty().aisExchangeTechs) return
|
||||
val otherCivList = civInfo.getKnownCivs()
|
||||
.filter { it.playerType == PlayerType.AI && it.isMajorCiv() && !civInfo.isAtWarWith(it) }
|
||||
.sortedBy { it.tech.techsResearched.size }
|
||||
|
||||
for (otherCiv in otherCivList) {
|
||||
val tradeLogic = TradeLogic(civInfo, otherCiv)
|
||||
var ourGold = tradeLogic.ourAvailableOffers.first { it.type == TradeType.Gold }.amount
|
||||
val ourTradableTechs = tradeLogic.ourAvailableOffers
|
||||
.filter { it.type == TradeType.Technology }
|
||||
val theirTradableTechs = tradeLogic.theirAvailableOffers
|
||||
.filter { it.type == TradeType.Technology }
|
||||
|
||||
for (theirOffer in theirTradableTechs) {
|
||||
val theirValue = TradeEvaluation().evaluateBuyCost(theirOffer, civInfo, otherCiv)
|
||||
val ourOfferList = ourTradableTechs.filter {
|
||||
TradeEvaluation().evaluateBuyCost(it, otherCiv, civInfo) == theirValue
|
||||
&& !tradeLogic.currentTrade.ourOffers.contains(it) }
|
||||
|
||||
if (ourOfferList.isNotEmpty()) {
|
||||
tradeLogic.currentTrade.ourOffers.add(ourOfferList.random())
|
||||
tradeLogic.currentTrade.theirOffers.add(theirOffer)
|
||||
} else if (ourGold / 2 >= theirValue) {
|
||||
//try to buy tech with money, not spending more than 1/3 of treasury
|
||||
tradeLogic.currentTrade.ourOffers.add(TradeOffer("Gold".tr(), TradeType.Gold, theirValue))
|
||||
tradeLogic.currentTrade.theirOffers.add(theirOffer)
|
||||
ourGold -= theirValue
|
||||
}
|
||||
}
|
||||
|
||||
if (tradeLogic.currentTrade.theirOffers.isNotEmpty()) {
|
||||
val tradeRequest = TradeRequest(civInfo.civName, tradeLogic.currentTrade.reverse())
|
||||
otherCiv.tradeRequests.add(tradeRequest)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getFreeTechForCityStates(civInfo: CivilizationInfo) {
|
||||
//City-States automatically get all invented techs
|
||||
for (otherCiv in civInfo.getKnownCivs().filterNot { it.isCityState() }) {
|
||||
|
|
|
@ -35,13 +35,6 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
|
|||
else TradeType.Strategic_Resource
|
||||
offers.add(TradeOffer(entry.resource.name, resourceTradeType, entry.amount))
|
||||
}
|
||||
if (!civInfo.isCityState() && !otherCivilization.isCityState()) {
|
||||
for (entry in civInfo.tech.techsResearched
|
||||
.filterNot { otherCivilization.tech.isResearched(it) }
|
||||
.filter { otherCivilization.tech.canBeResearched(it) }) {
|
||||
offers.add(TradeOffer(entry, TradeType.Technology))
|
||||
}
|
||||
}
|
||||
|
||||
offers.add(TradeOffer("Gold".tr(), TradeType.Gold, civInfo.gold))
|
||||
offers.add(TradeOffer("Gold per turn".tr(), TradeType.Gold_Per_Turn, civInfo.statsForNextTurn.gold.toInt()))
|
||||
|
|
|
@ -25,7 +25,6 @@ class Difficulty: INamed {
|
|||
var aiFreeTechs = ArrayList<String>()
|
||||
var aiFreeUnits = ArrayList<String>()
|
||||
var aiUnhappinessModifier = 1f
|
||||
var aisExchangeTechs = false
|
||||
var turnBarbariansCanEnterPlayerTiles = 0
|
||||
var clearBarbarianCampReward = 25
|
||||
|
||||
|
@ -52,7 +51,6 @@ class Difficulty: INamed {
|
|||
// lines += " - {AI free techs}: $aiFreeTechs"
|
||||
// lines += " - {AI free units}: $aiFreeUnits"
|
||||
lines += " - {AI unhappiness modifier}: $aiUnhappinessModifier"
|
||||
lines += " - {AIs exchange techs}: $aisExchangeTechs"
|
||||
lines += ""
|
||||
lines += "{Turns until barbarians enter player tiles}: $turnBarbariansCanEnterPlayerTiles"
|
||||
lines += "{Gold reward for clearing barbarian camps}: $clearBarbarianCampReward"
|
||||
|
|
Loading…
Reference in a new issue