From aafe23a2f58b2a327804eb9a1699da0aafe287ea Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 4 Oct 2019 16:23:17 +0300 Subject: [PATCH 1/4] freeTechs parameter in buildings replaced with Free Technology unique --- android/assets/jsons/Buildings.json | 4 +- .../assets/jsons/Translations/Buildings.json | 3 ++ .../com/unciv/models/gamebasics/Building.kt | 51 +++++++++---------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/android/assets/jsons/Buildings.json b/android/assets/jsons/Buildings.json index e303b71a..e3c95812 100644 --- a/android/assets/jsons/Buildings.json +++ b/android/assets/jsons/Buildings.json @@ -58,8 +58,8 @@ greatPersonPoints:{science:1}, isWonder:true, providesFreeBuilding: "Library", - freeTechs:1, requiredTech:"Writing" + uniques:["Free Technology"], quote:"'Libraries are as the shrine where all the relics of the ancient saints, full of true virtue, and all that without delusion or imposture are preserved and reposed.' - Sir Francis Bacon" }, { @@ -429,10 +429,10 @@ name:"Oxford University", science:3, culture:1, - freeTechs:1, isNationalWonder:true, percentStatBonus:{science:50}, requiredBuildingInAllCities:"University", + uniques:["Free Technology"], requiredTech:"Education" }, /* diff --git a/android/assets/jsons/Translations/Buildings.json b/android/assets/jsons/Translations/Buildings.json index 14ccf4c0..dcedb9ac 100644 --- a/android/assets/jsons/Translations/Buildings.json +++ b/android/assets/jsons/Translations/Buildings.json @@ -151,6 +151,9 @@ German:"Die Große Bibliothek" Polish:"Wielka Biblioteka" } + + "Free Technology":{ + } "'Libraries are as the shrine where all the relics of the ancient saints, full of true virtue, and all that without delusion or imposture are preserved and reposed.' - Sir Francis Bacon":{ Italian:"'Le biblioteche sono come una cappella in cui sono conservate e protette tutte le reliquie dei santi antichi, colme di vera virtù, e tutto ciò che è privo di illusione e inganno' - Sir Francis Bacon" diff --git a/core/src/com/unciv/models/gamebasics/Building.kt b/core/src/com/unciv/models/gamebasics/Building.kt index 6a1b8531..d7047405 100644 --- a/core/src/com/unciv/models/gamebasics/Building.kt +++ b/core/src/com/unciv/models/gamebasics/Building.kt @@ -42,7 +42,6 @@ class Building : NamedStats(), IConstruction{ // Uniques private var providesFreeBuilding: String? = null - var freeTechs: Int = 0 var uniques = ArrayList() @@ -338,34 +337,32 @@ class Building : NamedStats(), IConstruction{ construction.addBuilding(buildingToAdd) } - when { - "Empire enters golden age" in uniques -> civInfo.goldenAges.enterGoldenAge() - "Free Great Artist Appears" in uniques -> civInfo.addGreatPerson("Great Artist", construction.cityInfo) - "Free great scientist appears" in uniques -> civInfo.addGreatPerson("Great Scientist", construction.cityInfo) - "2 free great scientists appear" in uniques -> { - civInfo.addGreatPerson("Great Scientist", construction.cityInfo) - civInfo.addGreatPerson("Great Scientist", construction.cityInfo) - } - "Provides 2 free workers" in uniques -> { - civInfo.placeUnitNearTile(construction.cityInfo.location, Constants.worker) - civInfo.placeUnitNearTile(construction.cityInfo.location, Constants.worker) - } - "Free Social Policy" in uniques -> civInfo.policies.freePolicies++ - "Free Great Person" in uniques -> { - if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++ - else civInfo.addGreatPerson(GameBasics.Units.keys.filter { it.startsWith("Great") }.random()) - } - "+1 population in each city" in uniques -> { - for(city in civInfo.cities){ - city.population.population += 1 - city.population.autoAssignPopulation() - } - } - "Enemy land units must spend 1 extra movement point when inside your territory (obsolete upon Dynamite)" in uniques -> - civInfo.updateHasActiveGreatWall() + if ("Empire enters golden age" in uniques) civInfo.goldenAges.enterGoldenAge() + if ("Free Great Artist Appears" in uniques) civInfo.addGreatPerson("Great Artist", construction.cityInfo) + if ("Free great scientist appears" in uniques) civInfo.addGreatPerson("Great Scientist", construction.cityInfo) + if ("2 free great scientists appear" in uniques) { + civInfo.addGreatPerson("Great Scientist", construction.cityInfo) + civInfo.addGreatPerson("Great Scientist", construction.cityInfo) } + if ("Provides 2 free workers" in uniques) { + civInfo.placeUnitNearTile(construction.cityInfo.location, Constants.worker) + civInfo.placeUnitNearTile(construction.cityInfo.location, Constants.worker) + } + if ("Free Social Policy" in uniques) civInfo.policies.freePolicies++ + if ("Free Great Person" in uniques) { + if (civInfo.isPlayerCivilization()) civInfo.greatPeople.freeGreatPeople++ + else civInfo.addGreatPerson(GameBasics.Units.keys.filter { it.startsWith("Great") }.random()) + } + if ("+1 population in each city" in uniques) { + for(city in civInfo.cities){ + city.population.population += 1 + city.population.autoAssignPopulation() + } + } + if ("Enemy land units must spend 1 extra movement point when inside your territory (obsolete upon Dynamite)" in uniques) + civInfo.updateHasActiveGreatWall() - if (freeTechs != 0) civInfo.tech.freeTechs += freeTechs + if("Free Technology" in uniques) civInfo.tech.freeTechs += 1 } fun isStatRelated(stat: Stat): Boolean { From 2a00ab27750898668e3c693c76990ea760791ece Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Fri, 4 Oct 2019 16:49:31 +0300 Subject: [PATCH 2/4] "Introduction to X" and "Declare war on X" trade items are now only X, adding the extra text on UI display - this makes them translatable --- core/src/com/unciv/logic/GameInfo.kt | 9 +++++++ .../com/unciv/logic/trade/TradeEvaluation.kt | 6 ++--- core/src/com/unciv/logic/trade/TradeLogic.kt | 24 +++++++++---------- core/src/com/unciv/logic/trade/TradeOffer.kt | 8 +++++-- .../com/unciv/models/gamebasics/Building.kt | 2 -- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/core/src/com/unciv/logic/GameInfo.kt b/core/src/com/unciv/logic/GameInfo.kt index c5fc76da..7e1a8a2e 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 1a6d5598..d99702c9 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 5be376d1..64ebeae9 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 8ee4d986..9ad9320d 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 d7047405..c926b74c 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() From e42cadbf095f9fcd6d5870e4c706fddde1979a67 Mon Sep 17 00:00:00 2001 From: Smashfanful <41149920+Smashfanful@users.noreply.github.com> Date: Thu, 3 Oct 2019 12:43:58 +0200 Subject: [PATCH 3/4] Update Diplomacy,Trade,Nations.json --- .../assets/jsons/Translations/Diplomacy,Trade,Nations.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json b/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json index 8815db08..f3eea0de 100644 --- a/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json +++ b/android/assets/jsons/Translations/Diplomacy,Trade,Nations.json @@ -689,7 +689,7 @@ German:"Der Verhandlungstisch ist leer" } - "Peace treaty":{ + "Peace Treaty":{//Corrected Italian:"Trattato di pace" Russian:"Мирный договор" French:"Traité de paix" @@ -762,6 +762,10 @@ Russian:"Представиться [nation]" } + "Declare war on [nation]":{ + Italian:"Dichiara guerra a [nation]" + } + "Luxury resources":{ Italian:"Risorse di lusso" French:"Ressources de luxes" From 67916f9be25b2a048972eacdcf5b3e1341b78e2c Mon Sep 17 00:00:00 2001 From: Smashfanful <41149920+Smashfanful@users.noreply.github.com> Date: Fri, 4 Oct 2019 15:39:08 +0200 Subject: [PATCH 4/4] Update Policies.json Italian translation corrections --- android/assets/jsons/Translations/Policies.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/android/assets/jsons/Translations/Policies.json b/android/assets/jsons/Translations/Policies.json index fdca45d6..f0f1cc2e 100644 --- a/android/assets/jsons/Translations/Policies.json +++ b/android/assets/jsons/Translations/Policies.json @@ -604,7 +604,7 @@ } "+33% culture in all cities with a world wonder, immediately enter a golden age":{ - Italian:"+33% Cultura in tutte le città con una Meraviglia Mondiale, e avvio di un'Età dell'Oro" + Italian:"+33% Cultura in tutte le città con una Meraviglia Mondiale, e avvio immediato di un'Età dell'Oro" Russian:"+33% культуры во всех городах с чудом света, начинает в державе золотой век" Romanian:"+33% cultură în toate orașele cu minuni, intră imediat în epoca de aur" Spanish:"+33% cultura en todas las ciudades con una Maravilla. Inmediatamente entras en una Edad de Oro" @@ -757,7 +757,7 @@ } "Maintenance on roads & railroads reduced by 33%, +2 gold from all trade routes":{ - Italian:"-33% mantenimento in Oro su strade e ferrovie, +2 oro per ogni rotta commerciale"//you forgot to translate this + Italian:"-33% mantenimento in Oro per strade e ferrovie, +2 oro per ogni rotta commerciale" Russian:"Стоимость содержания дорог и железных дорог уменьшена на 33%, +2 золота от всех торговых маршрутов" Romanian:"Întreținerea drumurilor și a căilor ferate redusă cu 33%, +2 aur din toate rutele comerciale" Spanish:"Mantenimiento de carreteras y líneas de ferrocarril reducido un 33%, +2 oro de todas las rutas comerciales" @@ -823,7 +823,7 @@ } "Cost of purchasing culture buildings reduced by 50%":{ - Italian:"-50% costi di per l'acquisto delle strutture culturali" + Italian:"-50% costi per l'acquisto degli edifici culturali" Russian:"Цена покупки культурных строений уменьшена на 50%" Romanian:"Costul clădirilor de cultură redus cu 50%" Spanish:"Coste de comprar edificios de cultura reducido un 50%" @@ -1001,7 +1001,7 @@ } "Gain 2 free technologies":{ - Italian:"Consente di scoprite due Tecnologie gratuite" + Italian:"Consente di scoprire due Tecnologie gratuite" Russian:"Даёт 2 бесплатные технологии" Romanian:"Obține 2 tehnologii gratuite" Spanish:"Ganas 2 tecnologías gratis" @@ -1270,7 +1270,7 @@ "Quantity of strategic resources produced by the empire increased by 100%":{ Spanish:"El imperio produce un +100% de recursos estrategicos" - Italian:"L'impero incrementa del 100% la quantità delle risorse strategiche possedute, raddoppiandole" + Italian:"L'impero raddoppia la quantità delle risorse strategiche che possiede" Romanian:"Resursele strategice produse de imperiu crescute cu 100%" Simplified_Chinese:"帝国生产的战略资源+100%" Portuguese:"Quantidade de recursos estratégicos produzidos pelo império incrementado em 100%"