From 90708fe138d160a0fd9a610deeef984e3671ea53 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 19 Feb 2023 11:13:25 +0200 Subject: [PATCH] chore: diplomatic modifier text as part of class --- .../diplomacy/DiplomacyManager.kt | 57 ++++++++++--------- .../diplomacyscreen/DiplomacyScreen.kt | 38 ++----------- 2 files changed, 35 insertions(+), 60 deletions(-) diff --git a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt index 71fff776b5..93e6751cd8 100644 --- a/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt +++ b/core/src/com/unciv/logic/civilization/diplomacy/DiplomacyManager.kt @@ -59,34 +59,37 @@ enum class DiplomacyFlags { RecentlyAttacked, } -enum class DiplomaticModifiers { - DeclaredWarOnUs, - WarMongerer, - CapturedOurCities, - DeclaredFriendshipWithOurEnemies, - BetrayedDeclarationOfFriendship, - Denunciation, - DenouncedOurAllies, - RefusedToNotSettleCitiesNearUs, - BetrayedPromiseToNotSettleCitiesNearUs, - UnacceptableDemands, - UsedNuclearWeapons, - StealingTerritory, +enum class DiplomaticModifiers(val text:String) { + // Negative + DeclaredWarOnUs("You declared war on us!"), + WarMongerer("Your warmongering ways are unacceptable to us."), + CapturedOurCities("You have captured our cities!"), + DeclaredFriendshipWithOurEnemies("You have declared friendship with our enemies!"), + BetrayedDeclarationOfFriendship("Your so-called 'friendship' is worth nothing."), + Denunciation("You have publicly denounced us!"), + DenouncedOurAllies("You have denounced our allies"), + RefusedToNotSettleCitiesNearUs("You refused to stop settling cities near us"), + BetrayedPromiseToNotSettleCitiesNearUs("You betrayed your promise to not settle cities near us"), + UnacceptableDemands("Your arrogant demands are in bad taste"), + UsedNuclearWeapons("Your use of nuclear weapons is disgusting!"), + StealingTerritory("You have stolen our lands!"), + DestroyedProtectedMinor("You destroyed City-States that were under our protection!"), + AttackedProtectedMinor("You attacked City-States that were under our protection!"), + BulliedProtectedMinor("You demanded tribute from City-States that were under our protection!"), + SidedWithProtectedMinor("You sided with a City-State over us"), + + // Positive + YearsOfPeace("Years of peace have strengthened our relations."), + SharedEnemy("Our mutual military struggle brings us closer together."), + LiberatedCity("We applaud your liberation of conquered cities!"), + DeclarationOfFriendship("We have signed a public declaration of friendship"), + DeclaredFriendshipWithOurAllies("You have declared friendship with our allies"), + DenouncedOurEnemies("You have denounced our enemies"), + OpenBorders("Our open borders have brought us closer together."), + FulfilledPromiseToNotSettleCitiesNearUs("You fulfilled your promise to stop settling cities near us!"), + GaveUsUnits("You gave us units!"), + ReturnedCapturedUnits("You returned captured units to us"), - YearsOfPeace, - SharedEnemy, - LiberatedCity, - DeclarationOfFriendship, - DeclaredFriendshipWithOurAllies, - DenouncedOurEnemies, - OpenBorders, - FulfilledPromiseToNotSettleCitiesNearUs, - GaveUsUnits, - DestroyedProtectedMinor, - AttackedProtectedMinor, - BulliedProtectedMinor, - SidedWithProtectedMinor, - ReturnedCapturedUnits, } class DiplomacyManager() : IsPartOfGameInfoSerialization { diff --git a/core/src/com/unciv/ui/screens/diplomacyscreen/DiplomacyScreen.kt b/core/src/com/unciv/ui/screens/diplomacyscreen/DiplomacyScreen.kt index 037dbbf0c7..e831eec336 100644 --- a/core/src/com/unciv/ui/screens/diplomacyscreen/DiplomacyScreen.kt +++ b/core/src/com/unciv/ui/screens/diplomacyscreen/DiplomacyScreen.kt @@ -28,10 +28,6 @@ import com.unciv.models.ruleset.unique.UniqueType import com.unciv.models.translations.tr import com.unciv.ui.audio.MusicMood import com.unciv.ui.audio.MusicTrackChooserFlags -import com.unciv.ui.screens.civilopediascreen.CivilopediaScreen -import com.unciv.ui.images.ImageGetter -import com.unciv.ui.popups.ConfirmPopup -import com.unciv.ui.components.tilegroups.InfluenceTable import com.unciv.ui.components.BaseScreen import com.unciv.ui.components.Fonts import com.unciv.ui.components.KeyCharAndCode @@ -46,6 +42,10 @@ import com.unciv.ui.components.extensions.setFontSize import com.unciv.ui.components.extensions.surroundWithCircle import com.unciv.ui.components.extensions.toLabel import com.unciv.ui.components.extensions.toTextButton +import com.unciv.ui.components.tilegroups.InfluenceTable +import com.unciv.ui.images.ImageGetter +import com.unciv.ui.popups.ConfirmPopup +import com.unciv.ui.screens.civilopediascreen.CivilopediaScreen import kotlin.math.floor import kotlin.math.roundToInt import com.unciv.ui.components.AutoScrollPane as ScrollPane @@ -826,35 +826,7 @@ class DiplomacyScreen( && otherCivDiplomacyManager.hasModifier(DestroyedProtectedMinor)) continue - var text = when (DiplomaticModifiers.valueOf(modifier.key)) { - DeclaredWarOnUs -> "You declared war on us!" - WarMongerer -> "Your warmongering ways are unacceptable to us." - LiberatedCity -> "We applaud your liberation of conquered cities!" - CapturedOurCities -> "You have captured our cities!" - YearsOfPeace -> "Years of peace have strengthened our relations." - SharedEnemy -> "Our mutual military struggle brings us closer together." - DeclarationOfFriendship -> "We have signed a public declaration of friendship" - DeclaredFriendshipWithOurEnemies -> "You have declared friendship with our enemies!" - DeclaredFriendshipWithOurAllies -> "You have declared friendship with our allies" - OpenBorders -> "Our open borders have brought us closer together." - BetrayedDeclarationOfFriendship -> "Your so-called 'friendship' is worth nothing." - Denunciation -> "You have publicly denounced us!" - DenouncedOurAllies -> "You have denounced our allies" - DenouncedOurEnemies -> "You have denounced our enemies" - BetrayedPromiseToNotSettleCitiesNearUs -> "You betrayed your promise to not settle cities near us" - RefusedToNotSettleCitiesNearUs -> "You refused to stop settling cities near us" - FulfilledPromiseToNotSettleCitiesNearUs -> "You fulfilled your promise to stop settling cities near us!" - UnacceptableDemands -> "Your arrogant demands are in bad taste" - UsedNuclearWeapons -> "Your use of nuclear weapons is disgusting!" - StealingTerritory -> "You have stolen our lands!" - GaveUsUnits -> "You gave us units!" - DestroyedProtectedMinor -> "You destroyed City-States that were under our protection!" - AttackedProtectedMinor -> "You attacked City-States that were under our protection!" - BulliedProtectedMinor -> "You demanded tribute from City-States that were under our protection!" - SidedWithProtectedMinor -> "You sided with a City-State over us" - ReturnedCapturedUnits -> "You returned captured units to us" - } - text = text.tr() + " " + var text = DiplomaticModifiers.valueOf(modifier.key).text.tr() + " " if (modifier.value > 0) text += "+" text += modifier.value.roundToInt() val color = if (modifier.value < 0) Color.RED else Color.GREEN