Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 21 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions android/assets/jsons/translations/template.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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? =
Expand Down
1 change: 1 addition & 0 deletions core/src/com/unciv/logic/civilization/PopupAlert.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ enum class AlertType : IsPartOfGameInfoSerialization {
CityConquered,
CityTraded,
BorderConflict,
TilesStolen,

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

SettledCitiesNearUs,
AgreedToNotSettleNearUs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1107,6 +1108,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)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And you need to add the flag, because currently it will pop up every time
I'm not sure this is a bad thing tbh 🤔 Maybe we want to pop up every time?Currently this line just will never be true

Copy link
Contributor Author

@Emandac Emandac Jan 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, I am going to update it to add the flag.
And that explained why I was getting 1 popup per Tile stolen, Now after adding the flag i only get one popup 😅

civInfo.popupAlerts.add(PopupAlert(AlertType.TilesStolen, otherCiv.civName))
diplomacyCityState.setFlag(DiplomacyFlags.TilesStolen, 1)
}
}
cityToAddTo.expansion.takeOwnership(tileToTakeOver)
}

Expand Down
15 changes: 12 additions & 3 deletions core/src/com/unciv/ui/screens/worldscreen/AlertPopup.kt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make so that you don't get declare war option, when you are already at war with that civ

Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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('@')
Expand All @@ -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()
Expand Down
Loading