Added "don't spread religion to us" demand

This commit is contained in:
yairm210
2024-08-14 12:04:17 +03:00
parent 04f1508dfa
commit ea2234b9a2
8 changed files with 134 additions and 9 deletions

View File

@ -186,6 +186,8 @@ Do you want to break your promise to [leaderName]? =
Break promise = Break promise =
We promised not to settle near them ([count] turns remaining) = We promised not to settle near them ([count] turns remaining) =
They promised not to settle near us ([count] turns remaining) = They promised not to settle near us ([count] turns remaining) =
We promised not to spread religion to them ([count] turns remaining) =
They promised not to spread religion to us ([count] turns remaining) =
[civName] is upset that you demanded tribute from [cityState], whom they have pledged to protect! = [civName] is upset that you demanded tribute from [cityState], whom they have pledged to protect! =
[civName] is upset that you attacked [cityState], whom they have pledged to protect! = [civName] is upset that you attacked [cityState], whom they have pledged to protect! =
@ -214,6 +216,11 @@ Please don't settle new cities near us. =
Very well, we shall look for new lands to settle. = Very well, we shall look for new lands to settle. =
We shall do as we please. = We shall do as we please. =
We noticed your new city near our borders, despite your promise. This will have....implications. = We noticed your new city near our borders, despite your promise. This will have....implications. =
Please don't spread your religion to us. =
Very well, we shall spread our faith elsewhere. =
We noticed you have continued spreading your faith, despite your promise. This will have...consequences. =
I've been informed that my armies have taken tribute from [civName], a city-state under your protection.\nI assure you, this was quite unintentional, and I hope that this does not serve to drive us apart. = I've been informed that my armies have taken tribute from [civName], a city-state under your protection.\nI assure you, this was quite unintentional, and I hope that this does not serve to drive us apart. =
We asked [civName] for a tribute recently and they gave in.\nYou promised to protect them from such things, but we both know you cannot back that up. = We asked [civName] for a tribute recently and they gave in.\nYou promised to protect them from such things, but we both know you cannot back that up. =
It's come to my attention that I may have attacked [civName].\nWhile it was not my goal to be at odds with your empire, this was deemed a necessary course of action. = It's come to my attention that I may have attacked [civName].\nWhile it was not my goal to be at odds with your empire, this was deemed a necessary course of action. =
@ -1056,6 +1063,8 @@ One of our trades with [nation] has ended =
One of our trades with [nation] has been cut short = One of our trades with [nation] has been cut short =
[nation] agreed to stop settling cities near us! = [nation] agreed to stop settling cities near us! =
[nation] refused to stop settling cities near us! = [nation] refused to stop settling cities near us! =
[nation] agreed to stop spreading religion to us! =
[nation] refused to stop spreading religion to us! =
We have allied with [nation]. = We have allied with [nation]. =
We have lost alliance with [nation]. = We have lost alliance with [nation]. =
We have discovered [naturalWonder]! = We have discovered [naturalWonder]! =

View File

@ -105,6 +105,7 @@ object NextTurnAutomation {
} }
private fun respondToPopupAlerts(civInfo: Civilization) { private fun respondToPopupAlerts(civInfo: Civilization) {
for (popupAlert in civInfo.popupAlerts.toList()) { // toList because this can trigger other things that give alerts, like Golden Age for (popupAlert in civInfo.popupAlerts.toList()) { // toList because this can trigger other things that give alerts, like Golden Age
if (popupAlert.type == AlertType.DemandToStopSettlingCitiesNear) { // we're called upon to make a decision if (popupAlert.type == AlertType.DemandToStopSettlingCitiesNear) { // we're called upon to make a decision
val demandingCiv = civInfo.gameInfo.getCivilization(popupAlert.value) val demandingCiv = civInfo.gameInfo.getCivilization(popupAlert.value)
val diploManager = civInfo.getDiplomacyManager(demandingCiv)!! val diploManager = civInfo.getDiplomacyManager(demandingCiv)!!
@ -112,6 +113,16 @@ object NextTurnAutomation {
diploManager.agreeNotToSettleNear() diploManager.agreeNotToSettleNear()
else diploManager.refuseDemandNotToSettleNear() else diploManager.refuseDemandNotToSettleNear()
} }
if (popupAlert.type == AlertType.DemandToStopSpreadingReligion) {
val demandingCiv = civInfo.gameInfo.getCivilization(popupAlert.value)
val diploManager = civInfo.getDiplomacyManager(demandingCiv)!!
if (Automation.threatAssessment(civInfo, demandingCiv) >= ThreatLevel.High
|| diploManager.isRelationshipLevelGT(RelationshipLevel.Ally))
diploManager.agreeNotToSpreadReligionTo()
else diploManager.refuseNotToSpreadReligionTo()
}
if (popupAlert.type == AlertType.DeclarationOfFriendship) { if (popupAlert.type == AlertType.DeclarationOfFriendship) {
val requestingCiv = civInfo.gameInfo.getCivilization(popupAlert.value) val requestingCiv = civInfo.gameInfo.getCivilization(popupAlert.value)
val diploManager = civInfo.getDiplomacyManager(requestingCiv)!! val diploManager = civInfo.getDiplomacyManager(requestingCiv)!!
@ -123,7 +134,6 @@ object NextTurnAutomation {
diploManager.otherCivDiplomacy().setFlag(DiplomacyFlags.DeclinedDeclarationOfFriendship, 10) diploManager.otherCivDiplomacy().setFlag(DiplomacyFlags.DeclinedDeclarationOfFriendship, 10)
requestingCiv.addNotification("[${civInfo.civName}] has denied our Declaration of Friendship!", NotificationCategory.Diplomacy, NotificationIcon.Diplomacy, civInfo.civName) requestingCiv.addNotification("[${civInfo.civName}] has denied our Declaration of Friendship!", NotificationCategory.Diplomacy, NotificationIcon.Diplomacy, civInfo.civName)
} }
} }
} }
@ -534,6 +544,8 @@ object NextTurnAutomation {
val diploManager = civInfo.getDiplomacyManager(otherCiv)!! val diploManager = civInfo.getDiplomacyManager(otherCiv)!!
if (diploManager.hasFlag(DiplomacyFlags.SettledCitiesNearUs)) if (diploManager.hasFlag(DiplomacyFlags.SettledCitiesNearUs))
onCitySettledNearBorders(civInfo, otherCiv) onCitySettledNearBorders(civInfo, otherCiv)
if (diploManager.hasFlag(DiplomacyFlags.SpreadReligionInOurCities))
onReligionSpreadInOurCity(civInfo, otherCiv)
} }
} }
@ -557,6 +569,25 @@ object NextTurnAutomation {
diplomacyManager.removeFlag(DiplomacyFlags.SettledCitiesNearUs) diplomacyManager.removeFlag(DiplomacyFlags.SettledCitiesNearUs)
} }
private fun onReligionSpreadInOurCity(civInfo: Civilization, otherCiv: Civilization){
val diplomacyManager = civInfo.getDiplomacyManager(otherCiv)!!
when {
diplomacyManager.hasFlag(DiplomacyFlags.IgnoreThemSpreadingReligion) -> {}
diplomacyManager.hasFlag(DiplomacyFlags.AgreedToNotSpreadReligion) -> {
otherCiv.popupAlerts.add(PopupAlert(AlertType.ReligionSpreadDespiteOurPromise, civInfo.civName))
diplomacyManager.setFlag(DiplomacyFlags.IgnoreThemSpreadingReligion, 100)
diplomacyManager.setModifier(DiplomaticModifiers.BetrayedPromiseToNotSpreadReligionToUs, -20f)
diplomacyManager.removeFlag(DiplomacyFlags.AgreedToNotSpreadReligion)
}
else -> {
val threatLevel = Automation.threatAssessment(civInfo, otherCiv)
if (threatLevel < ThreatLevel.High) // don't piss them off for no reason please.
otherCiv.popupAlerts.add(PopupAlert(AlertType.DemandToStopSpreadingReligion, civInfo.civName))
}
}
diplomacyManager.removeFlag(DiplomacyFlags.SpreadReligionInOurCities)
}
fun getMinDistanceBetweenCities(civ1: Civilization, civ2: Civilization): Int { fun getMinDistanceBetweenCities(civ1: Civilization, civ2: Civilization): Int {
return getClosestCities(civ1, civ2)?.aerialDistance ?: Int.MAX_VALUE return getClosestCities(civ1, civ2)?.aerialDistance ?: Int.MAX_VALUE
} }

View File

@ -11,8 +11,13 @@ enum class AlertType : IsPartOfGameInfoSerialization {
CityConquered, CityConquered,
CityTraded, CityTraded,
BorderConflict, BorderConflict,
DemandToStopSettlingCitiesNear, DemandToStopSettlingCitiesNear,
CitySettledNearOtherCivDespiteOurPromise, CitySettledNearOtherCivDespiteOurPromise,
DemandToStopSpreadingReligion,
ReligionSpreadDespiteOurPromise,
GoldenAge, GoldenAge,
DeclarationOfFriendship, DeclarationOfFriendship,
StartIntro, StartIntro,

View File

@ -52,19 +52,27 @@ enum class DiplomacyFlags {
DeclinedJoinWarOffer, DeclinedJoinWarOffer,
ResearchAgreement, ResearchAgreement,
BorderConflict, BorderConflict,
SettledCitiesNearUs, SettledCitiesNearUs,
AgreedToNotSettleNearUs, AgreedToNotSettleNearUs,
IgnoreThemSettlingNearUs, IgnoreThemSettlingNearUs,
SpreadReligionInOurCities,
AgreedToNotSpreadReligion,
IgnoreThemSpreadingReligion,
ProvideMilitaryUnit, ProvideMilitaryUnit,
MarriageCooldown, MarriageCooldown,
NotifiedAfraid, NotifiedAfraid,
RecentlyPledgedProtection, RecentlyPledgedProtection,
RecentlyWithdrewProtection, RecentlyWithdrewProtection,
AngerFreeIntrusion, AngerFreeIntrusion,
RememberDestroyedProtectedMinor, RememberDestroyedProtectedMinor,
RememberAttackedProtectedMinor, RememberAttackedProtectedMinor,
RememberBulliedProtectedMinor, RememberBulliedProtectedMinor,
RememberSidedWithProtectedMinor, RememberSidedWithProtectedMinor,
Denunciation, Denunciation,
WaryOf, WaryOf,
Bullied, Bullied,
@ -84,7 +92,9 @@ enum class DiplomaticModifiers(val text: String) {
Denunciation("You have publicly denounced us!"), Denunciation("You have publicly denounced us!"),
DenouncedOurAllies("You have denounced our allies"), DenouncedOurAllies("You have denounced our allies"),
RefusedToNotSettleCitiesNearUs("You refused to stop settling cities near us"), RefusedToNotSettleCitiesNearUs("You refused to stop settling cities near us"),
RefusedToNotSpreadReligionToUs("You refused to stop spreading religion to us"),
BetrayedPromiseToNotSettleCitiesNearUs("You betrayed your promise to not settle cities near us"), BetrayedPromiseToNotSettleCitiesNearUs("You betrayed your promise to not settle cities near us"),
BetrayedPromiseToNotSpreadReligionToUs("You betrayed your promise to not spread your religion to us"),
UnacceptableDemands("Your arrogant demands are in bad taste"), UnacceptableDemands("Your arrogant demands are in bad taste"),
UsedNuclearWeapons("Your use of nuclear weapons is disgusting!"), UsedNuclearWeapons("Your use of nuclear weapons is disgusting!"),
StealingTerritory("You have stolen our lands!"), StealingTerritory("You have stolen our lands!"),
@ -106,6 +116,7 @@ enum class DiplomaticModifiers(val text: String) {
DenouncedOurEnemies("You have denounced our enemies"), DenouncedOurEnemies("You have denounced our enemies"),
OpenBorders("Our open borders have brought us closer together."), OpenBorders("Our open borders have brought us closer together."),
FulfilledPromiseToNotSettleCitiesNearUs("You fulfilled your promise to stop settling cities near us!"), FulfilledPromiseToNotSettleCitiesNearUs("You fulfilled your promise to stop settling cities near us!"),
FulfilledPromiseToNotSpreadReligion("You fulfilled your promise to stop spreading religion to us!"),
GaveUsUnits("You gave us units!"), GaveUsUnits("You gave us units!"),
GaveUsGifts("We appreciate your gifts"), GaveUsGifts("We appreciate your gifts"),
ReturnedCapturedUnits("You returned captured units to us"), ReturnedCapturedUnits("You returned captured units to us"),
@ -679,6 +690,21 @@ class DiplomacyManager() : IsPartOfGameInfoSerialization {
NotificationCategory.Diplomacy, NotificationIcon.Diplomacy, civInfo.civName) NotificationCategory.Diplomacy, NotificationIcon.Diplomacy, civInfo.civName)
} }
fun agreeNotToSpreadReligionTo() {
otherCivDiplomacy().setFlag(DiplomacyFlags.AgreedToNotSpreadReligion, 100)
addModifier(DiplomaticModifiers.UnacceptableDemands, -10f)
otherCiv().addNotification("[${civInfo.civName}] agreed to stop spreading religion to us!",
NotificationCategory.Diplomacy, NotificationIcon.Diplomacy, civInfo.civName)
}
fun refuseNotToSpreadReligionTo() {
addModifier(DiplomaticModifiers.UnacceptableDemands, -20f)
otherCivDiplomacy().setFlag(DiplomacyFlags.IgnoreThemSpreadingReligion, 100)
otherCivDiplomacy().addModifier(DiplomaticModifiers.RefusedToNotSpreadReligionToUs, -15f)
otherCiv().addNotification("[${civInfo.civName}] refused to stop spreading religion to us!",
NotificationCategory.Diplomacy, NotificationIcon.Diplomacy, civInfo.civName)
}
fun sideWithCityState() { fun sideWithCityState() {
otherCivDiplomacy().setModifier(DiplomaticModifiers.SidedWithProtectedMinor, -5f) otherCivDiplomacy().setModifier(DiplomaticModifiers.SidedWithProtectedMinor, -5f)
otherCivDiplomacy().setFlag(DiplomacyFlags.RememberSidedWithProtectedMinor, 25) otherCivDiplomacy().setFlag(DiplomacyFlags.RememberSidedWithProtectedMinor, 25)

View File

@ -189,6 +189,9 @@ object DiplomacyTurnManager {
DiplomacyFlags.AgreedToNotSettleNearUs.name -> { DiplomacyFlags.AgreedToNotSettleNearUs.name -> {
addModifier(DiplomaticModifiers.FulfilledPromiseToNotSettleCitiesNearUs, 10f) addModifier(DiplomaticModifiers.FulfilledPromiseToNotSettleCitiesNearUs, 10f)
} }
DiplomacyFlags.AgreedToNotSettleNearUs.name -> {
addModifier(DiplomaticModifiers.FulfilledPromiseToNotSpreadReligion, 10f)
}
DiplomacyFlags.RecentlyAttacked.name -> { DiplomacyFlags.RecentlyAttacked.name -> {
civInfo.cityStateFunctions.askForUnitGifts(otherCiv()) civInfo.cityStateFunctions.askForUnitGifts(otherCiv())
} }
@ -282,6 +285,7 @@ object DiplomacyTurnManager {
revertToZero(DiplomaticModifiers.BetrayedDefensivePact, 1 / 16f) // That's an outrageous thing to do revertToZero(DiplomaticModifiers.BetrayedDefensivePact, 1 / 16f) // That's an outrageous thing to do
revertToZero(DiplomaticModifiers.RefusedToNotSettleCitiesNearUs, 1 / 4f) revertToZero(DiplomaticModifiers.RefusedToNotSettleCitiesNearUs, 1 / 4f)
revertToZero(DiplomaticModifiers.BetrayedPromiseToNotSettleCitiesNearUs, 1 / 8f) // That's a bastardly thing to do revertToZero(DiplomaticModifiers.BetrayedPromiseToNotSettleCitiesNearUs, 1 / 8f) // That's a bastardly thing to do
revertToZero(DiplomaticModifiers.BetrayedPromiseToNotSpreadReligionToUs, 1 / 8f)
revertToZero(DiplomaticModifiers.UnacceptableDemands, 1 / 4f) revertToZero(DiplomaticModifiers.UnacceptableDemands, 1 / 4f)
revertToZero(DiplomaticModifiers.StealingTerritory, 1 / 4f) revertToZero(DiplomaticModifiers.StealingTerritory, 1 / 4f)
revertToZero(DiplomaticModifiers.DenouncedOurAllies, 1 / 4f) revertToZero(DiplomaticModifiers.DenouncedOurAllies, 1 / 4f)

View File

@ -175,16 +175,25 @@ class MajorCivDiplomacyTable(private val diplomacyScreen: DiplomacyScreen) {
): Table? { ): Table? {
val promisesTable = Table() val promisesTable = Table()
// Not for (flag in DiplomacyFlags.values()) - all other flags should result in DiplomaticModifiers or stay internal? if (otherCivDiplomacyManager.hasFlag(DiplomacyFlags.AgreedToNotSettleNearUs)) {
val flag = DiplomacyFlags.AgreedToNotSettleNearUs
if (otherCivDiplomacyManager.hasFlag(flag)) {
val text = val text =
"We promised not to settle near them ([${otherCivDiplomacyManager.getFlag(flag)}] turns remaining)" "We promised not to settle near them ([${otherCivDiplomacyManager.getFlag(DiplomacyFlags.AgreedToNotSettleNearUs)}] turns remaining)"
promisesTable.add(text.toLabel(Color.LIGHT_GRAY)).row() promisesTable.add(text.toLabel(Color.LIGHT_GRAY)).row()
} }
if (diplomacyManager.hasFlag(flag)) { if (diplomacyManager.hasFlag(DiplomacyFlags.AgreedToNotSettleNearUs)) {
val text = val text =
"They promised not to settle near us ([${diplomacyManager.getFlag(flag)}] turns remaining)" "They promised not to settle near us ([${diplomacyManager.getFlag(DiplomacyFlags.AgreedToNotSettleNearUs)}] turns remaining)"
promisesTable.add(text.toLabel(Color.LIGHT_GRAY)).row()
}
if (otherCivDiplomacyManager.hasFlag(DiplomacyFlags.AgreedToNotSpreadReligion)) {
val text =
"We promised not to spread religion to them ([${otherCivDiplomacyManager.getFlag(DiplomacyFlags.AgreedToNotSpreadReligion)}] turns remaining)"
promisesTable.add(text.toLabel(Color.LIGHT_GRAY)).row()
}
if (diplomacyManager.hasFlag(DiplomacyFlags.AgreedToNotSpreadReligion)) {
val text =
"They promised not to spread religion to us ([${diplomacyManager.getFlag(DiplomacyFlags.AgreedToNotSpreadReligion)}] turns remaining)"
promisesTable.add(text.toLabel(Color.LIGHT_GRAY)).row() promisesTable.add(text.toLabel(Color.LIGHT_GRAY)).row()
} }
@ -228,6 +237,20 @@ class MajorCivDiplomacyTable(private val diplomacyScreen: DiplomacyScreen) {
} }
demandsTable.add(dontSettleCitiesButton).row() demandsTable.add(dontSettleCitiesButton).row()
val dontSpreadReligionButton = "Please don't spread your religion to us.".toTextButton()
if (otherCiv.popupAlerts.any { it.type == AlertType.DemandToStopSpreadingReligion && it.value == viewingCiv.civName })
dontSettleCitiesButton.disable()
dontSettleCitiesButton.onClick {
otherCiv.popupAlerts.add(
PopupAlert(
AlertType.DemandToStopSpreadingReligion,
viewingCiv.civName
)
)
dontSpreadReligionButton.disable()
}
demandsTable.add(dontSpreadReligionButton).row()
demandsTable.add(Constants.close.toTextButton().onClick { diplomacyScreen.updateRightSide(otherCiv) }) demandsTable.add(Constants.close.toTextButton().onClick { diplomacyScreen.updateRightSide(otherCiv) })
return demandsTable return demandsTable
} }

View File

@ -92,6 +92,8 @@ class AlertPopup(
AlertType.BorderConflict -> addBorderConflict() AlertType.BorderConflict -> addBorderConflict()
AlertType.DemandToStopSettlingCitiesNear -> addDemandToStopSettlingCitiesNear() AlertType.DemandToStopSettlingCitiesNear -> addDemandToStopSettlingCitiesNear()
AlertType.CitySettledNearOtherCivDespiteOurPromise -> addCitySettledNearOtherCivDespiteOurPromise() AlertType.CitySettledNearOtherCivDespiteOurPromise -> addCitySettledNearOtherCivDespiteOurPromise()
AlertType.DemandToStopSpreadingReligion -> addDemandToStopSpreadingReligion()
AlertType.ReligionSpreadDespiteOurPromise -> addReligionSpreadDespiteOurPromise()
AlertType.WonderBuilt -> addWonderBuilt() AlertType.WonderBuilt -> addWonderBuilt()
AlertType.TechResearched -> addTechResearched() AlertType.TechResearched -> addTechResearched()
AlertType.GoldenAge -> addGoldenAge() AlertType.GoldenAge -> addGoldenAge()
@ -241,6 +243,26 @@ class AlertPopup(
} }
} }
private fun addDemandToStopSpreadingReligion() {
val otherciv = getCiv(popupAlert.value)
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.agreeNotToSpreadReligionTo()
}.row()
addCloseButton("We shall do as we please.", KeyboardBinding.Cancel) {
playerDiploManager.refuseNotToSpreadReligionTo()
}
}
private fun addReligionSpreadDespiteOurPromise() {
val otherciv = getCiv(popupAlert.value)
addLeaderName(otherciv)
addGoodSizedLabel("We noticed you have continued spreading your faith, despite your promise. This will have....consequences.").row()
addCloseButton("Very well.")
}
private fun addDiplomaticMarriage() { private fun addDiplomaticMarriage() {
val city = getCity(popupAlert.value) val city = getCity(popupAlert.value)
addGoodSizedLabel(city.name.tr() + ": " + "What would you like to do with the city?".tr(), Constants.headingFontSize) // Add name because there might be several cities addGoodSizedLabel(city.name.tr() + ": " + "What would you like to do with the city?".tr(), Constants.headingFontSize) // Add name because there might be several cities

View File

@ -1,6 +1,7 @@
package com.unciv.ui.screens.worldscreen.unit.actions package com.unciv.ui.screens.worldscreen.unit.actions
import com.unciv.logic.civilization.NotificationCategory import com.unciv.logic.civilization.NotificationCategory
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
import com.unciv.logic.map.mapunit.MapUnit import com.unciv.logic.map.mapunit.MapUnit
import com.unciv.logic.map.tile.Tile import com.unciv.logic.map.tile.Tile
import com.unciv.models.UnitAction import com.unciv.models.UnitAction
@ -101,6 +102,10 @@ object UnitActionsReligion {
city.religion.removeAllPressuresExceptFor(unit.religion!!) city.religion.removeAllPressuresExceptFor(unit.religion!!)
UnitActionModifiers.activateSideEffects(unit, newStyleUnique) UnitActionModifiers.activateSideEffects(unit, newStyleUnique)
if (city.civ != unit.civ) city.civ.getDiplomacyManager(unit.civ)!!
.setFlag(DiplomacyFlags.SpreadReligionInOurCities, 30)
}.takeIf { unit.civ.religionManager.maySpreadReligionNow(unit) }.takeIf { unit.civ.religionManager.maySpreadReligionNow(unit)
&& UnitActionModifiers.canActivateSideEffects(unit, newStyleUnique)} && UnitActionModifiers.canActivateSideEffects(unit, newStyleUnique)}
)) ))