Updated CityStateFunction.tk so that city states, will get angry at you, if you steal their lands (#12725)

* Settler settle best tile when not escort and dangerous Tiles instead of running away

Settler unit will now settle on best tile in dangerous Tiles without escort instead of running away.

* Update WorkerAutomation.kt

* Update SpecificUnitAutomation.kt

* Update WorkerAutomation.kt

* Update SpecificUnitAutomation.kt

* Now city states get mad when you steal their Lands

* new version

* change to getDiplomacyManagerOrMeet

* added text to template.properties and changed AlertPopup.kt

* Update template.properties

* with period at the end :b

* add flag now

* Made Option to declare war when a city state is bullied unavailable
This commit is contained in:
General_E 2025-01-04 19:05:08 +01:00 committed by GitHub
parent 9ce439fd7f
commit a4a403b104
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 29 additions and 3 deletions

View File

@ -1598,6 +1598,7 @@ Keep it =
Remove your troops in our border immediately! =
Sorry. =
Never! =
Those lands were not yours to take. This has not gone unnoticed. =
Offer Declaration of Friendship ([30] turns) =
My friend, shall we declare our friendship to the world? =

View File

@ -11,6 +11,7 @@ enum class AlertType : IsPartOfGameInfoSerialization {
CityConquered,
CityTraded,
BorderConflict,
TilesStolen,
DemandToStopSettlingCitiesNear,
CitySettledNearOtherCivDespiteOurPromise,

View File

@ -52,6 +52,7 @@ enum class DiplomacyFlags {
DeclinedJoinWarOffer,
ResearchAgreement,
BorderConflict,
TilesStolen,
SettledCitiesNearUs,
AgreedToNotSettleNearUs,

View File

@ -16,6 +16,7 @@ import com.unciv.logic.civilization.NotificationIcon
import com.unciv.logic.civilization.PolicyAction
import com.unciv.logic.civilization.PopupAlert
import com.unciv.logic.civilization.TechAction
import com.unciv.logic.civilization.diplomacy.DiplomacyFlags
import com.unciv.logic.civilization.diplomacy.DiplomaticModifiers
import com.unciv.logic.civilization.managers.ReligionState
import com.unciv.logic.map.mapgenerator.NaturalWonderGenerator
@ -1109,6 +1110,19 @@ object UniqueTriggerActivation {
otherCiv.getDiplomacyManagerOrMeet(civInfo).addModifier(DiplomaticModifiers.StealingTerritory, -10f)
civsToNotify.add(otherCiv)
}
// check if civ has steal a tile from a citystate
if (otherCiv != null && otherCiv.isCityState) {
// create this varibale diplomacyCityState for more readability
val diplomacyCityState = otherCiv.getDiplomacyManagerOrMeet(civInfo)
diplomacyCityState.addInfluence(-15f)
if (!diplomacyCityState.hasFlag(DiplomacyFlags.TilesStolen)) {
civInfo.popupAlerts.add(PopupAlert(AlertType.TilesStolen, otherCiv.civName))
diplomacyCityState.setFlag(DiplomacyFlags.TilesStolen, 1)
}
}
cityToAddTo.expansion.takeOwnership(tileToTakeOver)
}

View File

@ -91,6 +91,7 @@ class AlertPopup(
AlertType.CityConquered -> addCityConquered()
AlertType.CityTraded -> addCityTraded()
AlertType.BorderConflict -> addBorderConflict()
AlertType.TilesStolen -> addTilesStolen()
AlertType.DemandToStopSettlingCitiesNear -> addDemandToStopSettlingCitiesNear()
AlertType.CitySettledNearOtherCivDespiteOurPromise -> addCitySettledNearOtherCivDespiteOurPromise()
AlertType.DemandToStopSpreadingReligion -> addDemandToStopSpreadingReligion()
@ -118,6 +119,13 @@ class AlertPopup(
addCloseButton("Sorry.", KeyboardBinding.Confirm)
addCloseButton("Never!", KeyboardBinding.Cancel)
}
private fun addTilesStolen() {
val civInfo = getCiv(popupAlert.value)
addLeaderName(civInfo)
addGoodSizedLabel("Those lands were not yours to take. This has not gone unnoticed.")
addCloseButton()
}
private fun addBulliedOrAttackedProtectedOrAlliedMinor() {
val involvedCivs = popupAlert.value.split('@')
@ -138,13 +146,14 @@ class AlertPopup(
"I thought you might like to know that I've launched an invasion of one of your little pet states.\nThe lands of [${cityState.civName}] will make a fine addition to my own."
}
addGoodSizedLabel(text).row()
addCloseButton("THIS MEANS WAR!", KeyboardBinding.Confirm) {
if (!player.isAtWarWith(bullyOrAttacker)) {
addCloseButton("THIS MEANS WAR!", KeyboardBinding.Confirm) {
player.getDiplomacyManager(bullyOrAttacker)!!.sideWithCityState()
val warReason = if (popupAlert.type == AlertType.AttackedAllyMinor) WarType.AlliedCityStateWar else WarType.ProtectedCityStateWar
player.getDiplomacyManager(bullyOrAttacker)!!.declareWar(DeclareWarReason(warReason, cityState))
cityState.getDiplomacyManager(player)!!.influence += 20f // You went to war for us!!
}.row()
}.row()}
addCloseButton("You'll pay for this!", KeyboardBinding.Confirm) {
player.getDiplomacyManager(bullyOrAttacker)!!.sideWithCityState()