mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 10:54:19 -04:00
chore: Generic'd demand alerts
This commit is contained in:
parent
a0a6fc670d
commit
1ff10700b9
@ -3,7 +3,7 @@ package com.unciv.logic.civilization.diplomacy
|
|||||||
import com.unciv.logic.civilization.AlertType
|
import com.unciv.logic.civilization.AlertType
|
||||||
|
|
||||||
/** After creating the required flags, modifiers, and alert type, the only remaining work should be
|
/** 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
|
* - Triggering the violation (adding the violationOccurred flag) from somewhere in the code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -18,6 +18,9 @@ enum class Demand(
|
|||||||
val demandAlert: AlertType,
|
val demandAlert: AlertType,
|
||||||
val violationDiscoveredAlert: AlertType,
|
val violationDiscoveredAlert: AlertType,
|
||||||
val demandText: String,
|
val demandText: String,
|
||||||
|
val acceptDemandText: String,
|
||||||
|
val refuseDemandText: String,
|
||||||
|
val violationNoticedText: String,
|
||||||
/** Must contain 1 parameter, to be replaced with civ name */
|
/** Must contain 1 parameter, to be replaced with civ name */
|
||||||
val agreedToDemandText: String,
|
val agreedToDemandText: String,
|
||||||
/** Must contain 1 parameter, to be replaced with civ name */
|
/** Must contain 1 parameter, to be replaced with civ name */
|
||||||
@ -36,8 +39,11 @@ enum class Demand(
|
|||||||
demandAlert = AlertType.DemandToStopSpyingOnUs,
|
demandAlert = AlertType.DemandToStopSpyingOnUs,
|
||||||
violationDiscoveredAlert = AlertType.SpyingOnUsDespiteOurPromise,
|
violationDiscoveredAlert = AlertType.SpyingOnUsDespiteOurPromise,
|
||||||
demandText = "Stop spying on us.",
|
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!",
|
agreedToDemandText = "[civName] agreed to stop spying on us!",
|
||||||
refusedDemandText = "[civName] refused 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)",
|
wePromisedText = "We promised not to send spies to them ([turns] turns remaining)",
|
||||||
theyPromisedText = "They promised not to send spies to us ([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,
|
demandAlert = AlertType.DemandToStopSpreadingReligion,
|
||||||
violationDiscoveredAlert = AlertType.ReligionSpreadDespiteOurPromise,
|
violationDiscoveredAlert = AlertType.ReligionSpreadDespiteOurPromise,
|
||||||
demandText = "Please don't spread your religion to us.",
|
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!",
|
agreedToDemandText = "[civName] agreed to stop spreading religion to us!",
|
||||||
refusedDemandText = "[civName] refused 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)",
|
wePromisedText = "We promised not to spread religion to them ([turns] turns remaining)",
|
||||||
theyPromisedText = "They promised not to spread religion to us ([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,
|
demandAlert = AlertType.DemandToStopSettlingCitiesNear,
|
||||||
violationDiscoveredAlert = AlertType.CitySettledNearOtherCivDespiteOurPromise,
|
violationDiscoveredAlert = AlertType.CitySettledNearOtherCivDespiteOurPromise,
|
||||||
demandText = "Please don't settle new cities near us.",
|
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!",
|
agreedToDemandText = "[civName] agreed to stop settling cities near us!",
|
||||||
refusedDemandText = "[civName] refused 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)",
|
wePromisedText = "We promised not to settle near them ([turns] turns remaining)",
|
||||||
theyPromisedText = "They promised not to settle near us ([turns] turns remaining)"
|
theyPromisedText = "They promised not to settle near us ([turns] turns remaining)"
|
||||||
)
|
)
|
||||||
|
@ -96,12 +96,12 @@ class AlertPopup(
|
|||||||
AlertType.TilesStolen -> shouldOpen = addTilesStolen()
|
AlertType.TilesStolen -> shouldOpen = addTilesStolen()
|
||||||
|
|
||||||
// demands
|
// demands
|
||||||
AlertType.DemandToStopSettlingCitiesNear -> shouldOpen = addDemandToStopSettlingCitiesNear()
|
AlertType.DemandToStopSettlingCitiesNear -> shouldOpen = addDemand(Demand.DoNotSettleNearUs)
|
||||||
AlertType.CitySettledNearOtherCivDespiteOurPromise -> shouldOpen = addCitySettledNearOtherCivDespiteOurPromise()
|
AlertType.CitySettledNearOtherCivDespiteOurPromise -> shouldOpen = addDemandViolationNoticed(Demand.DoNotSettleNearUs)
|
||||||
AlertType.DemandToStopSpreadingReligion -> shouldOpen = addDemandToStopSpreadingReligion()
|
AlertType.DemandToStopSpreadingReligion -> shouldOpen = addDemand(Demand.DoNotSpreadReligion)
|
||||||
AlertType.ReligionSpreadDespiteOurPromise -> shouldOpen = addReligionSpreadDespiteOurPromise()
|
AlertType.ReligionSpreadDespiteOurPromise -> shouldOpen = addDemandViolationNoticed(Demand.DoNotSpreadReligion)
|
||||||
AlertType.DemandToStopSpyingOnUs -> shouldOpen = addDemandToStopSendingSpiesToUs()
|
AlertType.DemandToStopSpyingOnUs -> shouldOpen = addDemand(Demand.DontSpyOnUs)
|
||||||
AlertType.SpyingOnUsDespiteOurPromise -> shouldOpen = addSpyingOnUsDespiteOurPromise()
|
AlertType.SpyingOnUsDespiteOurPromise -> shouldOpen = addDemand(Demand.DontSpyOnUs)
|
||||||
|
|
||||||
|
|
||||||
AlertType.DeclarationOfFriendship -> shouldOpen = addDeclarationOfFriendship()
|
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)
|
val otherciv = getCiv(popupAlert.value)
|
||||||
if (otherciv.isDefeated()) return false
|
if (otherciv.isDefeated()) return false
|
||||||
addLeaderName(otherciv)
|
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.")
|
addCloseButton("Very well.")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -266,68 +266,22 @@ class AlertPopup(
|
|||||||
music.playVoice("${civInfo.civName}.defeated")
|
music.playVoice("${civInfo.civName}.defeated")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addDemandToStopSettlingCitiesNear(): Boolean {
|
private fun addDemand(demand: Demand): Boolean {
|
||||||
val otherciv = getCiv(popupAlert.value)
|
val otherciv = getCiv(popupAlert.value)
|
||||||
if (otherciv.isDefeated()) return false
|
if (otherciv.isDefeated()) return false
|
||||||
|
|
||||||
val playerDiploManager = viewingCiv.getDiplomacyManager(otherciv)!!
|
val playerDiploManager = viewingCiv.getDiplomacyManager(otherciv)!!
|
||||||
addLeaderName(otherciv)
|
addLeaderName(otherciv)
|
||||||
addGoodSizedLabel("Please don't settle new cities near us.").row()
|
addGoodSizedLabel(demand.demandText).row()
|
||||||
addCloseButton("Very well, we shall look for new lands to settle.", KeyboardBinding.Confirm) {
|
addCloseButton(demand.acceptDemandText, KeyboardBinding.Confirm) {
|
||||||
playerDiploManager.agreeToDemand(Demand.DoNotSettleNearUs)
|
playerDiploManager.agreeToDemand(demand)
|
||||||
}.row()
|
}.row()
|
||||||
addCloseButton("We shall do as we please.", KeyboardBinding.Cancel) {
|
addCloseButton(demand.refuseDemandText, KeyboardBinding.Cancel) {
|
||||||
playerDiploManager.refuseDemand(Demand.DoNotSettleNearUs)
|
playerDiploManager.refuseDemand(demand)
|
||||||
}
|
}
|
||||||
return true
|
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() {
|
private fun addDiplomaticMarriage() {
|
||||||
val city = getCity(popupAlert.value)
|
val city = getCity(popupAlert.value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user