mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
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
@ -812,7 +812,6 @@ AI wonder cost modifier =
|
|||||||
AI building maintenance modifier =
|
AI building maintenance modifier =
|
||||||
AI unit maintenance modifier =
|
AI unit maintenance modifier =
|
||||||
AI unhappiness modifier =
|
AI unhappiness modifier =
|
||||||
AIs exchange techs =
|
|
||||||
|
|
||||||
Turns until barbarians enter player tiles =
|
Turns until barbarians enter player tiles =
|
||||||
Gold reward for clearing barbarian camps =
|
Gold reward for clearing barbarian camps =
|
||||||
|
@ -31,7 +31,6 @@ object NextTurnAutomation{
|
|||||||
// offerDeclarationOfFriendship(civInfo)
|
// offerDeclarationOfFriendship(civInfo)
|
||||||
offerPeaceTreaty(civInfo)
|
offerPeaceTreaty(civInfo)
|
||||||
offerResearchAgreement(civInfo)
|
offerResearchAgreement(civInfo)
|
||||||
exchangeTechs(civInfo)
|
|
||||||
exchangeLuxuries(civInfo)
|
exchangeLuxuries(civInfo)
|
||||||
issueRequests(civInfo)
|
issueRequests(civInfo)
|
||||||
adoptPolicy(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) {
|
private fun getFreeTechForCityStates(civInfo: CivilizationInfo) {
|
||||||
//City-States automatically get all invented techs
|
//City-States automatically get all invented techs
|
||||||
for (otherCiv in civInfo.getKnownCivs().filterNot { it.isCityState() }) {
|
for (otherCiv in civInfo.getKnownCivs().filterNot { it.isCityState() }) {
|
||||||
|
@ -35,13 +35,6 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci
|
|||||||
else TradeType.Strategic_Resource
|
else TradeType.Strategic_Resource
|
||||||
offers.add(TradeOffer(entry.resource.name, resourceTradeType, entry.amount))
|
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".tr(), TradeType.Gold, civInfo.gold))
|
||||||
offers.add(TradeOffer("Gold per turn".tr(), TradeType.Gold_Per_Turn, civInfo.statsForNextTurn.gold.toInt()))
|
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 aiFreeTechs = ArrayList<String>()
|
||||||
var aiFreeUnits = ArrayList<String>()
|
var aiFreeUnits = ArrayList<String>()
|
||||||
var aiUnhappinessModifier = 1f
|
var aiUnhappinessModifier = 1f
|
||||||
var aisExchangeTechs = false
|
|
||||||
var turnBarbariansCanEnterPlayerTiles = 0
|
var turnBarbariansCanEnterPlayerTiles = 0
|
||||||
var clearBarbarianCampReward = 25
|
var clearBarbarianCampReward = 25
|
||||||
|
|
||||||
@ -52,7 +51,6 @@ class Difficulty: INamed {
|
|||||||
// lines += " - {AI free techs}: $aiFreeTechs"
|
// lines += " - {AI free techs}: $aiFreeTechs"
|
||||||
// lines += " - {AI free units}: $aiFreeUnits"
|
// lines += " - {AI free units}: $aiFreeUnits"
|
||||||
lines += " - {AI unhappiness modifier}: $aiUnhappinessModifier"
|
lines += " - {AI unhappiness modifier}: $aiUnhappinessModifier"
|
||||||
lines += " - {AIs exchange techs}: $aisExchangeTechs"
|
|
||||||
lines += ""
|
lines += ""
|
||||||
lines += "{Turns until barbarians enter player tiles}: $turnBarbariansCanEnterPlayerTiles"
|
lines += "{Turns until barbarians enter player tiles}: $turnBarbariansCanEnterPlayerTiles"
|
||||||
lines += "{Gold reward for clearing barbarian camps}: $clearBarbarianCampReward"
|
lines += "{Gold reward for clearing barbarian camps}: $clearBarbarianCampReward"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user