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

Conversation

Emandac
Copy link
Contributor

@Emandac Emandac commented Dec 30, 2024

Before the city state Ai, didn't care if you steal their lands.
But now with this update to the code, they will hate you now.
Except if you are friends with them.

Also modified other files, to have the popup when you steal their lands.


// If citystate gets tile stolen from another civ, then the civ gets a diplomacy Influence debuffer.
if (diplomacy.hasModifier(DiplomaticModifiers.StealingTerritory) && diplomacy.isRelationshipLevelLT(RelationshipLevel.Friend)) {
diplomacy.addInfluence(-25f)
Copy link
Owner

Choose a reason for hiding this comment

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

This should be in UniqueTriggerActivation:1107 (UniqueType.OneTimeTakeOverTilesInRadius)
This should happen when the tile is being stolen
Also, even if you have a good relationship with a CS, stealing tiles is a Bad Action, and should have consequences
I think 15 influence per tile stolen sounds around right

otherCiv.popupAlerts.add(PopupAlert(AlertType.BorderOccupation, civInfo.civName))

// to only show popup once.
diplomacy.setFlag(DiplomacyFlags.BorderOccupation, -1)
Copy link
Owner

Choose a reason for hiding this comment

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

Flag name is not indicative of what it's actually remembering - should be "TilesStolen" or similar, this sounds like you have units on tiles on their borders

@Emandac
Copy link
Contributor Author

Emandac commented Dec 31, 2024

I have changed the BorderOccupation name to TilesStolen.
And also now you get a -15 for each tile stolen.
like you said.

// 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.getDiplomacyManager(civInfo)!!
Copy link
Owner

Choose a reason for hiding this comment

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

How about getDiplomacyManagerOrMeet, that way we don't run into weird problems if we manage to steal tiles from a civ we haven't met yet

Comment on lines 126 to 128
addGoodSizedLabel("You stole some of our territory!")
addCloseButton("Yes.", KeyboardBinding.Confirm)
addCloseButton("No.", KeyboardBinding.Cancel)
Copy link
Owner

Choose a reason for hiding this comment

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

What is this about? Let the player know this was unacceptable, but there's no choice here,
Something like "Those lands were not yours to take. This has not gone unnoticed."
And then just addCloseButton()

Also, this text needs to go in template.properties so it's translatable

@Emandac
Copy link
Contributor Author

Emandac commented Dec 31, 2024

Done

addGoodSizedLabel("You stole some of our territory!")
addCloseButton("Yes.", KeyboardBinding.Confirm)
addCloseButton("No.", KeyboardBinding.Cancel)
addGoodSizedLabel("Those lands were not yours to take. This has not gone unnoticed")
Copy link
Owner

Choose a reason for hiding this comment

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

With a period on the end :)
Also in the properties file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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 😅

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

@yairm210 yairm210 merged commit a4a403b into yairm210:master Jan 4, 2025
4 checks passed
@SomeTroglodyte
Copy link
Collaborator

Small side note "after the fact": Nudge nudge white-space. This PR introduced several lines consisting only of blanks, and there's a block of 3 empty lines in the middle of a function. Some recent @SeventhM PR's too. White-space changes are still changes to git, so inconsistent handling can lead to unnecessarily increased merge troubles. I thought the policy was no trailing white-space except where needed (templates) - "Do as you wont but never change another's insignificant white-space" could work too, but it needs consensus.

@SeventhM
Copy link
Collaborator

Small side note "after the fact": Nudge nudge white-space. This PR introduced several lines consisting only of blanks, and there's a block of 3 empty lines in the middle of a function. Some recent @SeventhM PR's too. White-space changes are still changes to git, so inconsistent handling can lead to unnecessarily increased merge troubles. I thought the policy was no trailing white-space except where needed (templates) - "Do as you wont but never change another's insignificant white-space" could work too, but it needs consensus.

I'm not entirely sure what you're trying to say here. My general rule of thumb has been:

  1. Avoid trailing whitespace at the end of lines (usually for newlines that Studio hasn't cleaned up automatically)
  2. Delete trailing whitespace at the end of lines if it's code I'm already touching for other reasons (which imo should usually be consistent with point 1)
  3. Keep all/most other whitespace the same, including lines between statements. Most of the lines between statements is intentional to help separate obvious code blocks. And, like, in another PR I did, I was explicitly requested to add in such a line

The only time I delete lines between statements/functions is if there's two lines instead of one accidentally

@SomeTroglodyte
Copy link
Collaborator

SomeTroglodyte commented Jan 22, 2025

trying to say here

Uh, sorry, this here is not the diff I had in mind with that comment1... Curious - now which one did I mean?

That was #12817, so not even the same author, and most are by now fixed. PrevIdleButton still has one blank less than NextIdleButton.

Footnotes

  1. Waving hand to side: "These are not the lines you're looking for"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants