diff --git a/core/src/com/unciv/logic/civilization/diplomacy/Demand.kt b/core/src/com/unciv/logic/civilization/diplomacy/Demand.kt index 975ca29ea0..7c63aa644a 100644 --- a/core/src/com/unciv/logic/civilization/diplomacy/Demand.kt +++ b/core/src/com/unciv/logic/civilization/diplomacy/Demand.kt @@ -3,7 +3,7 @@ package com.unciv.logic.civilization.diplomacy import com.unciv.logic.civilization.AlertType /** After creating the required flags, modifiers, and alert type, the only remaining work should be - * - Adding the new alerts in AlertPopup.kt + * - Adding the new alerts in the when() of AlertPopup.kt * - Triggering the violation (adding the violationOccurred flag) from somewhere in the code */ @@ -18,6 +18,9 @@ enum class Demand( val demandAlert: AlertType, val violationDiscoveredAlert: AlertType, val demandText: String, + val acceptDemandText: String, + val refuseDemandText: String, + val violationNoticedText: String, /** Must contain 1 parameter, to be replaced with civ name */ val agreedToDemandText: String, /** Must contain 1 parameter, to be replaced with civ name */ @@ -36,8 +39,11 @@ enum class Demand( demandAlert = AlertType.DemandToStopSpyingOnUs, violationDiscoveredAlert = AlertType.SpyingOnUsDespiteOurPromise, demandText = "Stop spying on us.", + acceptDemandText = "We see our people are not welcome in your lands... we will take our attention elsewhere.", + refuseDemandText = "I'll do what's necessary for my empire to survive.", agreedToDemandText = "[civName] agreed to stop spying on us!", refusedDemandText = "[civName] refused to stop spying on us!", + violationNoticedText = "Take back your spy and your broken promises.", wePromisedText = "We promised not to send spies to them ([turns] turns remaining)", theyPromisedText = "They promised not to send spies to us ([turns] turns remaining)" ), @@ -51,8 +57,11 @@ enum class Demand( demandAlert = AlertType.DemandToStopSpreadingReligion, violationDiscoveredAlert = AlertType.ReligionSpreadDespiteOurPromise, demandText = "Please don't spread your religion to us.", + acceptDemandText = "Very well, we shall spread our faith elsewhere.", + refuseDemandText = "We shall do as we please.", agreedToDemandText = "[civName] agreed to stop spreading religion to us!", refusedDemandText = "[civName] refused to stop spreading religion to us!", + violationNoticedText = "We noticed you have continued spreading your faith, despite your promise. This will have....consequences.", wePromisedText = "We promised not to spread religion to them ([turns] turns remaining)", theyPromisedText = "They promised not to spread religion to us ([turns] turns remaining)", ), @@ -66,8 +75,11 @@ enum class Demand( demandAlert = AlertType.DemandToStopSettlingCitiesNear, violationDiscoveredAlert = AlertType.CitySettledNearOtherCivDespiteOurPromise, demandText = "Please don't settle new cities near us.", + acceptDemandText = "Very well, we shall look for new lands to settle.", + refuseDemandText = "We shall do as we please.", agreedToDemandText = "[civName] agreed to stop settling cities near us!", refusedDemandText = "[civName] refused to stop settling cities near us!", + violationNoticedText = "We noticed your new city near our borders, despite your promise. This will have....implications.", wePromisedText = "We promised not to settle near them ([turns] turns remaining)", theyPromisedText = "They promised not to settle near us ([turns] turns remaining)" ) diff --git a/core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt b/core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt index 3d763954b1..9a92bfbd8b 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt @@ -96,12 +96,12 @@ class AlertPopup( AlertType.TilesStolen -> shouldOpen = addTilesStolen() // demands - AlertType.DemandToStopSettlingCitiesNear -> shouldOpen = addDemandToStopSettlingCitiesNear() - AlertType.CitySettledNearOtherCivDespiteOurPromise -> shouldOpen = addCitySettledNearOtherCivDespiteOurPromise() - AlertType.DemandToStopSpreadingReligion -> shouldOpen = addDemandToStopSpreadingReligion() - AlertType.ReligionSpreadDespiteOurPromise -> shouldOpen = addReligionSpreadDespiteOurPromise() - AlertType.DemandToStopSpyingOnUs -> shouldOpen = addDemandToStopSendingSpiesToUs() - AlertType.SpyingOnUsDespiteOurPromise -> shouldOpen = addSpyingOnUsDespiteOurPromise() + AlertType.DemandToStopSettlingCitiesNear -> shouldOpen = addDemand(Demand.DoNotSettleNearUs) + AlertType.CitySettledNearOtherCivDespiteOurPromise -> shouldOpen = addDemandViolationNoticed(Demand.DoNotSettleNearUs) + AlertType.DemandToStopSpreadingReligion -> shouldOpen = addDemand(Demand.DoNotSpreadReligion) + AlertType.ReligionSpreadDespiteOurPromise -> shouldOpen = addDemandViolationNoticed(Demand.DoNotSpreadReligion) + AlertType.DemandToStopSpyingOnUs -> shouldOpen = addDemand(Demand.DontSpyOnUs) + AlertType.SpyingOnUsDespiteOurPromise -> shouldOpen = addDemand(Demand.DontSpyOnUs) AlertType.DeclarationOfFriendship -> shouldOpen = addDeclarationOfFriendship() @@ -217,11 +217,11 @@ class AlertPopup( } } - private fun addCitySettledNearOtherCivDespiteOurPromise(): Boolean { + private fun addDemandViolationNoticed(demand: Demand): Boolean { val otherciv = getCiv(popupAlert.value) if (otherciv.isDefeated()) return false addLeaderName(otherciv) - addGoodSizedLabel("We noticed your new city near our borders, despite your promise. This will have....implications.").row() + addGoodSizedLabel(demand.violationNoticedText).row() addCloseButton("Very well.") return true } @@ -266,68 +266,22 @@ class AlertPopup( music.playVoice("${civInfo.civName}.defeated") } - private fun addDemandToStopSettlingCitiesNear(): Boolean { + private fun addDemand(demand: Demand): Boolean { val otherciv = getCiv(popupAlert.value) if (otherciv.isDefeated()) return false + val playerDiploManager = viewingCiv.getDiplomacyManager(otherciv)!! addLeaderName(otherciv) - addGoodSizedLabel("Please don't settle new cities near us.").row() - addCloseButton("Very well, we shall look for new lands to settle.", KeyboardBinding.Confirm) { - playerDiploManager.agreeToDemand(Demand.DoNotSettleNearUs) + addGoodSizedLabel(demand.demandText).row() + addCloseButton(demand.acceptDemandText, KeyboardBinding.Confirm) { + playerDiploManager.agreeToDemand(demand) }.row() - addCloseButton("We shall do as we please.", KeyboardBinding.Cancel) { - playerDiploManager.refuseDemand(Demand.DoNotSettleNearUs) + addCloseButton(demand.refuseDemandText, KeyboardBinding.Cancel) { + playerDiploManager.refuseDemand(demand) } return true } - private fun addDemandToStopSpreadingReligion(): Boolean { - val otherciv = getCiv(popupAlert.value) - if (otherciv.isDefeated()) return false - val playerDiploManager = viewingCiv.getDiplomacyManager(otherciv)!! - addLeaderName(otherciv) - addGoodSizedLabel("Please don't spread religion to us.").row() - addCloseButton("Very well, we shall spread our faith elsewhere.", KeyboardBinding.Confirm) { - playerDiploManager.agreeToDemand(Demand.DoNotSpreadReligion) - }.row() - addCloseButton("We shall do as we please.", KeyboardBinding.Cancel) { - playerDiploManager.refuseDemand(Demand.DoNotSpreadReligion) - } - return true - } - - private fun addReligionSpreadDespiteOurPromise(): Boolean { - val otherciv = getCiv(popupAlert.value) - if (otherciv.isDefeated()) return false - addLeaderName(otherciv) - addGoodSizedLabel("We noticed you have continued spreading your faith, despite your promise. This will have....consequences.").row() - addCloseButton("Very well.") - return true - } - private fun addDemandToStopSendingSpiesToUs(): Boolean { - val otherciv = getCiv(popupAlert.value) - if (otherciv.isDefeated()) return false - val playerDiploManager = viewingCiv.getDiplomacyManager(otherciv)!! - addLeaderName(otherciv) - addGoodSizedLabel("Stop spying on us.").row() - addCloseButton("We see our people are not welcome in your lands... we will take our attention elsewhere.", KeyboardBinding.Confirm) { - playerDiploManager.agreeToDemand(Demand.DontSpyOnUs) - }.row() - addCloseButton("I'll do what's necessary for my empire to survive.", KeyboardBinding.Cancel) { - playerDiploManager.refuseDemand(Demand.DontSpyOnUs) - } - return true - } - - private fun addSpyingOnUsDespiteOurPromise(): Boolean { - val otherciv = getCiv(popupAlert.value) - if (otherciv.isDefeated()) return false - addGoodSizedLabel("Take back your spy and your broken promises.").row() - addCloseButton("Very well.") - return true - } - - private fun addDiplomaticMarriage() { val city = getCity(popupAlert.value)