From a3b48ab5326b6bc569a64f0d12b7631ae5b071a4 Mon Sep 17 00:00:00 2001 From: yairm210 Date: Sat, 11 Jan 2025 19:48:54 +0200 Subject: [PATCH] Added notification when enemy religion spread converts a city --- android/assets/jsons/translations/template.properties | 1 + .../screens/worldscreen/unit/actions/UnitActionsReligion.kt | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/android/assets/jsons/translations/template.properties b/android/assets/jsons/translations/template.properties index 2755282893..2710d8bec6 100644 --- a/android/assets/jsons/translations/template.properties +++ b/android/assets/jsons/translations/template.properties @@ -1469,6 +1469,7 @@ Hurry Construction = Hurry Construction (+[productionAmount]⚙) = Spread Religion = Spread [religionName] = +[civName]'s [unitName] has converted [cityName] to [religionName] = Remove Heresy = Found a Religion = Enhance a Religion = diff --git a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsReligion.kt b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsReligion.kt index b86fe846ac..226af7a97c 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsReligion.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/unit/actions/UnitActionsReligion.kt @@ -97,9 +97,15 @@ object UnitActionsReligion { for (unique in unit.getMatchingUniques(UniqueType.StatsWhenSpreading, checkCivInfoUniques = true)) { unit.civ.addStat(Stat.valueOf(unique.params[1]), followersOfOtherReligions * unique.params[0].toInt()) } + val previousReligion = city.religion.getMajorityReligion() city.religion.addPressure(unit.religion!!, getPressureAddedFromSpread(unit)) if (unit.hasUnique(UniqueType.RemoveOtherReligions)) city.religion.removeAllPressuresExceptFor(unit.religion!!) + + val newReligion = city.religion.getMajorityReligion() + if (previousReligion != newReligion && newReligion != null && city.civ != unit.civ) { + city.civ.addNotification("[${unit.civ.civName}]'s [${unit.name}] has converted [${city.name}] to [${newReligion.name}]!", NotificationCategory.Religion) + } UnitActionModifiers.activateSideEffects(unit, newStyleUnique)