diff --git a/core/src/com/unciv/logic/GameInfo.kt b/core/src/com/unciv/logic/GameInfo.kt index c5fc76da20..7e1a8a2e35 100644 --- a/core/src/com/unciv/logic/GameInfo.kt +++ b/core/src/com/unciv/logic/GameInfo.kt @@ -222,6 +222,15 @@ class GameInfo { // As of 2.16.1, changed Colloseum to Colosseum changeBuildingName(cityConstructions, "Colloseum", "Colosseum") } + + // This doesn't HAVE to go here, but why not. + // As of version 3.1.3, trade offers of "Declare war on X" and "Introduction to X" were changed to X, + // with the extra text being added only on UI display (solved a couple of problems). + for(trade in civInfo.tradeRequests.map { it.trade }) + for(offer in trade.theirOffers.union(trade.ourOffers)){ + offer.name = offer.name.removePrefix("Declare war on ") + offer.name = offer.name.removePrefix("Introduction to ") + } } for (civInfo in civilizations) civInfo.setNationTransient() diff --git a/core/src/com/unciv/logic/trade/TradeEvaluation.kt b/core/src/com/unciv/logic/trade/TradeEvaluation.kt index 1a6d559896..d99702c92f 100644 --- a/core/src/com/unciv/logic/trade/TradeEvaluation.kt +++ b/core/src/com/unciv/logic/trade/TradeEvaluation.kt @@ -122,8 +122,7 @@ class TradeEvaluation{ * civInfo.gameInfo.gameParameters.gameSpeed.getModifier()).toInt()*20 TradeType.Introduction -> return 250 TradeType.WarDeclaration -> { - val nameOfCivToDeclareWarOn = offer.name.removePrefix("Declare war on ") - val civToDeclareWarOn = civInfo.gameInfo.getCivilization(nameOfCivToDeclareWarOn) + val civToDeclareWarOn = civInfo.gameInfo.getCivilization(offer.name) val threatToThem = Automation().threatAssessment(civInfo,civToDeclareWarOn) if(civInfo.isAtWarWith(civToDeclareWarOn)){ @@ -193,8 +192,7 @@ class TradeEvaluation{ TradeType.Technology -> return sqrt(GameBasics.Technologies[offer.name]!!.cost.toDouble()).toInt()*20 TradeType.Introduction -> return 250 TradeType.WarDeclaration -> { - val nameOfCivToDeclareWarOn = offer.name.removePrefix("Declare war on ") - val civToDeclareWarOn = civInfo.gameInfo.getCivilization(nameOfCivToDeclareWarOn) + val civToDeclareWarOn = civInfo.gameInfo.getCivilization(offer.name) val threatToUs = Automation().threatAssessment(civInfo, civToDeclareWarOn) when (threatToUs) { diff --git a/core/src/com/unciv/logic/trade/TradeLogic.kt b/core/src/com/unciv/logic/trade/TradeLogic.kt index 5be376d185..64ebeae9a1 100644 --- a/core/src/com/unciv/logic/trade/TradeLogic.kt +++ b/core/src/com/unciv/logic/trade/TradeLogic.kt @@ -55,7 +55,7 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci .filter { !otherCivilization.diplomacy.containsKey(it.civName) && !it.isDefeated() } for (thirdCiv in civsWeKnowAndTheyDont) { - offers.add(TradeOffer("Introduction to " + thirdCiv.civName, TradeType.Introduction, 0)) + offers.add(TradeOffer(thirdCiv.civName, TradeType.Introduction, 0)) } if (!civInfo.isCityState() && !otherCivilization.isCityState()) { @@ -64,7 +64,7 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci val civsWeArentAtWarWith = civsWeBothKnow .filter { civInfo.getDiplomacyManager(it).diplomaticStatus == DiplomaticStatus.Peace } for (thirdCiv in civsWeArentAtWarWith) { - offers.add(TradeOffer("Declare war on " + thirdCiv.civName, TradeType.WarDeclaration, 0)) + offers.add(TradeOffer(thirdCiv.civName, TradeType.WarDeclaration, 0)) } } @@ -91,21 +91,21 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci if (offer.type == TradeType.Technology) { to.tech.addTechnology(offer.name) } - if(offer.type== TradeType.City){ - val city = from.cities.first { it.name==offer.name } + if (offer.type == TradeType.City) { + val city = from.cities.first { it.name == offer.name } city.moveToCiv(to) city.getCenterTile().getUnits().forEach { it.movement.teleportToClosestMoveableTile() } to.updateViewableTiles() from.updateViewableTiles() } - if(offer.type== TradeType.Treaty){ - if(offer.name==Constants.peaceTreaty) to.getDiplomacyManager(from).makePeace() + if (offer.type == TradeType.Treaty) { + if (offer.name == Constants.peaceTreaty) to.getDiplomacyManager(from).makePeace() } - if(offer.type==TradeType.Introduction) - to.meetCivilization(to.gameInfo.getCivilization(offer.name.removePrefix("Introduction to " ))) + if (offer.type == TradeType.Introduction) + to.meetCivilization(to.gameInfo.getCivilization(offer.name)) - if(offer.type==TradeType.WarDeclaration){ - val nameOfCivToDeclareWarOn = offer.name.removePrefix("Declare war on ") + if (offer.type == TradeType.WarDeclaration) { + val nameOfCivToDeclareWarOn = offer.name from.getDiplomacyManager(nameOfCivToDeclareWarOn).declareWar() } } @@ -113,8 +113,8 @@ class TradeLogic(val ourCivilization:CivilizationInfo, val otherCivilization: Ci to.updateDetailedCivResources() } - transferTrade(ourCivilization,otherCivilization,currentTrade) - transferTrade(otherCivilization,ourCivilization,currentTrade.reverse()) + transferTrade(ourCivilization, otherCivilization, currentTrade) + transferTrade(otherCivilization, ourCivilization, currentTrade.reverse()) } } diff --git a/core/src/com/unciv/logic/trade/TradeOffer.kt b/core/src/com/unciv/logic/trade/TradeOffer.kt index 8ee4d98601..9ad9320d28 100644 --- a/core/src/com/unciv/logic/trade/TradeOffer.kt +++ b/core/src/com/unciv/logic/trade/TradeOffer.kt @@ -15,8 +15,12 @@ data class TradeOffer(var name:String, var type: TradeType, fun getOfferText(): String { - var offerText = name.tr() - if (type !in tradesToNotHaveNumbers) offerText += " (" + amount + ")" + var offerText = when(type){ + TradeType.WarDeclaration -> "Declare war on [$name]" + TradeType.Introduction -> "Introduction to [$name]" + else -> name + }.tr() + if (type !in tradesToNotHaveNumbers) offerText += " ($amount)" if (duration > 0) offerText += "\n" + duration + " {turns}".tr() return offerText } diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index d704740593..c926b74cd2 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -39,8 +39,6 @@ class Building : NamedStats(), IConstruction{ var replaces:String?=null var uniqueTo:String?=null var quote:String="" - - // Uniques private var providesFreeBuilding: String? = null var uniques = ArrayList()