diff --git a/android/assets/jsons/translationsByLanguage/Czech.properties b/android/assets/jsons/translationsByLanguage/Czech.properties index e8ebf06868db6..3b20a2894ba34 100644 --- a/android/assets/jsons/translationsByLanguage/Czech.properties +++ b/android/assets/jsons/translationsByLanguage/Czech.properties @@ -686,6 +686,10 @@ We have lost alliance with [nation]. = Ztratili jsme alianci s civilizací [nati We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Dutch.properties b/android/assets/jsons/translationsByLanguage/Dutch.properties index e43c15236eaba..df9c4fa837475 100644 --- a/android/assets/jsons/translationsByLanguage/Dutch.properties +++ b/android/assets/jsons/translationsByLanguage/Dutch.properties @@ -1149,6 +1149,10 @@ We have lost alliance with [nation]. = We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/English.properties b/android/assets/jsons/translationsByLanguage/English.properties index a11803a46bcaf..1a0970b48f65c 100644 --- a/android/assets/jsons/translationsByLanguage/English.properties +++ b/android/assets/jsons/translationsByLanguage/English.properties @@ -1224,6 +1224,10 @@ We have lost alliance with [nation]. = We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/French.properties b/android/assets/jsons/translationsByLanguage/French.properties index 625a8f1318913..23b6e482430c5 100644 --- a/android/assets/jsons/translationsByLanguage/French.properties +++ b/android/assets/jsons/translationsByLanguage/French.properties @@ -685,6 +685,10 @@ We have lost alliance with [nation]. = Notre alliance est terminée avec le/la/l We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/German.properties b/android/assets/jsons/translationsByLanguage/German.properties index 84faeeef5f619..e1df5d7d49157 100644 --- a/android/assets/jsons/translationsByLanguage/German.properties +++ b/android/assets/jsons/translationsByLanguage/German.properties @@ -691,6 +691,10 @@ We have lost alliance with [nation]. = Wir haben die Alianz mit [nation] verlore We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Italian.properties b/android/assets/jsons/translationsByLanguage/Italian.properties index 33879b468b4a5..b7c1652b1606e 100644 --- a/android/assets/jsons/translationsByLanguage/Italian.properties +++ b/android/assets/jsons/translationsByLanguage/Italian.properties @@ -681,6 +681,10 @@ We have lost alliance with [nation]. = Non siamo più alleati di [nation]. We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Korean.properties b/android/assets/jsons/translationsByLanguage/Korean.properties index bd54060ae2216..492560c9ebdc5 100644 --- a/android/assets/jsons/translationsByLanguage/Korean.properties +++ b/android/assets/jsons/translationsByLanguage/Korean.properties @@ -709,6 +709,10 @@ We have lost alliance with [nation]. = [nation]와(과)의 동맹 관계가 끝 We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Malay.properties b/android/assets/jsons/translationsByLanguage/Malay.properties index 46d286b627704..0d8460d3183fb 100644 --- a/android/assets/jsons/translationsByLanguage/Malay.properties +++ b/android/assets/jsons/translationsByLanguage/Malay.properties @@ -1113,6 +1113,10 @@ We have lost alliance with [nation]. = We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Polish.properties b/android/assets/jsons/translationsByLanguage/Polish.properties index efad22da715a4..53d9413b8da8f 100644 --- a/android/assets/jsons/translationsByLanguage/Polish.properties +++ b/android/assets/jsons/translationsByLanguage/Polish.properties @@ -680,6 +680,10 @@ We have allied with [nation]. = Jesteśmy sojusznikami z [nation]. We have lost alliance with [nation]. = Nie jesteśmy już w sojuszu z [nation]. We have discovered [naturalWonder]! = Odkryliśmy [naturlWonder]! We have received [goldAmount] Gold for discovering [naturalWonder] = Otrzymaliśmy [goldAmount] Złota za odkrycie [naturalWonder] + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Portuguese.properties b/android/assets/jsons/translationsByLanguage/Portuguese.properties index 7cc517f84e793..6a751aa3a99d6 100644 --- a/android/assets/jsons/translationsByLanguage/Portuguese.properties +++ b/android/assets/jsons/translationsByLanguage/Portuguese.properties @@ -804,6 +804,10 @@ We have lost alliance with [nation]. = We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Romanian.properties b/android/assets/jsons/translationsByLanguage/Romanian.properties index 2029c02a80238..6ac7b613f026e 100644 --- a/android/assets/jsons/translationsByLanguage/Romanian.properties +++ b/android/assets/jsons/translationsByLanguage/Romanian.properties @@ -1007,6 +1007,10 @@ We have lost alliance with [nation]. = We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Russian.properties b/android/assets/jsons/translationsByLanguage/Russian.properties index 489c57e80008b..e7448a3efcb7d 100644 --- a/android/assets/jsons/translationsByLanguage/Russian.properties +++ b/android/assets/jsons/translationsByLanguage/Russian.properties @@ -689,6 +689,10 @@ We have lost alliance with [nation]. = Наш альянс с [nation] был р We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Simplified_Chinese.properties b/android/assets/jsons/translationsByLanguage/Simplified_Chinese.properties index 19780e12dcdc3..c80d37edbaf8c 100644 --- a/android/assets/jsons/translationsByLanguage/Simplified_Chinese.properties +++ b/android/assets/jsons/translationsByLanguage/Simplified_Chinese.properties @@ -687,6 +687,10 @@ We have lost alliance with [nation]. = 我们和[nation]不再是同盟关系 We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Spanish.properties b/android/assets/jsons/translationsByLanguage/Spanish.properties index b8a77b893a138..40cbab540e1a0 100644 --- a/android/assets/jsons/translationsByLanguage/Spanish.properties +++ b/android/assets/jsons/translationsByLanguage/Spanish.properties @@ -692,6 +692,10 @@ We have lost alliance with [nation]. = Ya no estamos aliados con [nation]. We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Traditional_Chinese.properties b/android/assets/jsons/translationsByLanguage/Traditional_Chinese.properties index 973368848f118..d0e33d06928f9 100644 --- a/android/assets/jsons/translationsByLanguage/Traditional_Chinese.properties +++ b/android/assets/jsons/translationsByLanguage/Traditional_Chinese.properties @@ -687,6 +687,10 @@ We have lost alliance with [nation]. = 我們和[nation]不再是同盟關係 We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/Ukrainian.properties b/android/assets/jsons/translationsByLanguage/Ukrainian.properties index 4d9ca57b6e089..157dcef891fc0 100644 --- a/android/assets/jsons/translationsByLanguage/Ukrainian.properties +++ b/android/assets/jsons/translationsByLanguage/Ukrainian.properties @@ -749,6 +749,10 @@ We have lost alliance with [nation]. = Тепер ми не союзники з We have discovered [naturalWonder]! = # Requires translation! We have received [goldAmount] Gold for discovering [naturalWonder] = + # Requires translation! +Your relationship with [cityStateName] is about to degrade = + # Requires translation! +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/android/assets/jsons/translationsByLanguage/completionPercentages.properties b/android/assets/jsons/translationsByLanguage/completionPercentages.properties index 38eba1070a845..1ec834ef23d7c 100644 --- a/android/assets/jsons/translationsByLanguage/completionPercentages.properties +++ b/android/assets/jsons/translationsByLanguage/completionPercentages.properties @@ -1,16 +1,16 @@ Traditional_Chinese = 97 Italian = 98 -Polish = 99 Russian = 97 +Polish = 99 Romanian = 49 Korean = 95 Simplified_Chinese = 97 -German = 97 +German = 96 English = 0 Ukrainian = 85 -French = 98 +French = 97 Portuguese = 77 -Czech = 97 -Malay = 13 Spanish = 92 +Malay = 13 +Czech = 97 Dutch = 22 diff --git a/android/assets/jsons/translationsByLanguage/template.properties b/android/assets/jsons/translationsByLanguage/template.properties index e69e6d4d834fe..2c2e56f01ae8e 100644 --- a/android/assets/jsons/translationsByLanguage/template.properties +++ b/android/assets/jsons/translationsByLanguage/template.properties @@ -679,6 +679,8 @@ We have allied with [nation]. = We have lost alliance with [nation]. = We have discovered [naturalWonder]! = We have received [goldAmount] Gold for discovering [naturalWonder] = +Your relationship with [cityStateName] is about to degrade = +Your relationship with [cityStateName] degraded = # World Screen UI diff --git a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt index e8ed584cb55d2..b2f4deab181dc 100644 --- a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt +++ b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt @@ -9,6 +9,9 @@ import com.unciv.logic.civilization.PopupAlert import com.unciv.logic.trade.Trade import com.unciv.logic.trade.TradeType import com.unciv.models.ruleset.tile.ResourceSupplyList +import kotlin.math.max +import kotlin.math.min +import kotlin.math.ceil enum class RelationshipLevel{ Unforgivable, @@ -78,12 +81,16 @@ class DiplomacyManager() { /** For city-states. Influence is saved in the CITY STATE -> major civ Diplomacy, NOT in the major civ -> cty state diplomacy. */ var influence = 0f + /** For city-states. Resting point is the value of Influence at which it ceases changing by itself */ + var restingPoint = 0f + fun clone(): DiplomacyManager { val toReturn = DiplomacyManager() toReturn.otherCivName=otherCivName toReturn.diplomaticStatus=diplomaticStatus toReturn.trades.addAll(trades.map { it.clone() }) toReturn.influence = influence + toReturn.restingPoint = restingPoint toReturn.flagsCountdown.putAll(flagsCountdown) toReturn.diplomaticModifiers.putAll(diplomaticModifiers) return toReturn @@ -146,6 +153,26 @@ class DiplomacyManager() { return RelationshipLevel.Neutral } + /** Returns the number of turns to degrade from Ally or from Friend */ + fun getTurnsToRelationshipChange(): Int { + if (otherCiv().isCityState()) + return otherCivDiplomacy().getTurnsToRelationshipChange() + + if (civInfo.isCityState() && !otherCiv().isCityState()) { + val hasCityStateInfluenceBonus = + otherCiv().nation.unique == "City-State Influence degrades at half and recovers at twice the normal rate" + val dropPerTurn = if(hasCityStateInfluenceBonus) .5f else 1f + + if (relationshipLevel() >= RelationshipLevel.Ally) + return ceil((influence - 60f) / dropPerTurn).toInt() + 1 + else if (relationshipLevel() >= RelationshipLevel.Friend) + return ceil((influence - 30f) / dropPerTurn).toInt() + 1 + else + return 0 + } + return 0 + } + fun canDeclareWar() = (turnsToPeaceTreaty()==0 && diplomaticStatus != DiplomaticStatus.War) fun goldPerTurn():Int{ @@ -214,19 +241,29 @@ class DiplomacyManager() { updateHasOpenBorders() nextTurnDiplomaticModifiers() nextTurnFlags() - nextTurnCityStateInfluence() + if (civInfo.isCityState() && !otherCiv().isCityState()) + nextTurnCityStateInfluence() } private fun nextTurnCityStateInfluence() { + val initialRelationshipLevel = relationshipLevel() + val hasCityStateInfluenceBonus = - civInfo.nation.unique == "City-State Influence degrades at half and recovers at twice the normal rate" - if (influence > 1) { - if (hasCityStateInfluenceBonus) influence -= 0.5f - else influence -= 1 - } else if (influence < 1) { - if (hasCityStateInfluenceBonus) influence += 2 - else influence += 1 - } else influence = 0f + otherCiv().nation.unique == "City-State Influence degrades at half and recovers at twice the normal rate" + val increment = if (hasCityStateInfluenceBonus) 2f else 1f + val decrement = if (hasCityStateInfluenceBonus) .5f else 1f + + if (influence > restingPoint) + influence = max(restingPoint, influence - decrement) + else if (influence < restingPoint) + influence = min(restingPoint, influence + increment) + else influence = restingPoint + + if (getTurnsToRelationshipChange() == 1) + otherCiv().addNotification("Your relationship with [${civInfo.civName}] is about to degrade", null, Color.GOLD) + + if (initialRelationshipLevel >= RelationshipLevel.Friend && initialRelationshipLevel != relationshipLevel()) + otherCiv().addNotification("Your relationship with [${civInfo.civName}] degraded", null, Color.GOLD) } private fun nextTurnFlags() { diff --git a/core/src/com/unciv/ui/trade/DiplomacyScreen.kt b/core/src/com/unciv/ui/trade/DiplomacyScreen.kt index 11e50fd53144d..908965c104df9 100644 --- a/core/src/com/unciv/ui/trade/DiplomacyScreen.kt +++ b/core/src/com/unciv/ui/trade/DiplomacyScreen.kt @@ -125,7 +125,8 @@ class DiplomacyScreen(val viewingCiv:CivilizationInfo):CameraStageBaseScreen() { val friendBonusLabelColor:Color if (otherCivDiplomacyManager.relationshipLevel() >= RelationshipLevel.Friend) { friendBonusLabelColor = Color.GREEN - val turnsToRelationshipChange = otherCivDiplomacyManager.influence.toInt() - 30 + 1 + // RelationshipChange = Ally -> Friend or Friend -> Favorable + val turnsToRelationshipChange = otherCivDiplomacyManager.getTurnsToRelationshipChange() diplomacyTable.add("Relationship changes in another [$turnsToRelationshipChange] turns".toLabel()).row() } else friendBonusLabelColor = Color.GRAY