Skip to content

Commit

Permalink
Updated CityStateFunction.tk so that city states, will get angry at y…
Browse files Browse the repository at this point in the history
…ou, 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
Emandac authored Jan 4, 2025

Verified

This commit was signed with the committer’s verified signature.
hakimifr Hakimi
1 parent 9ce439f commit a4a403b
Showing 5 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions android/assets/jsons/translations/template.properties
Original file line number Diff line number Diff line change
@@ -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? =
1 change: 1 addition & 0 deletions core/src/com/unciv/logic/civilization/PopupAlert.kt
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ enum class AlertType : IsPartOfGameInfoSerialization {
CityConquered,
CityTraded,
BorderConflict,
TilesStolen,

DemandToStopSettlingCitiesNear,
CitySettledNearOtherCivDespiteOurPromise,
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@ enum class DiplomacyFlags {
DeclinedJoinWarOffer,
ResearchAgreement,
BorderConflict,
TilesStolen,

SettledCitiesNearUs,
AgreedToNotSettleNearUs,
Original file line number Diff line number Diff line change
@@ -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)
}

15 changes: 12 additions & 3 deletions core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit a4a403b

Please sign in to comment.