Rules about promises to not settle nearby

Jeddite

Chieftain
Joined
Feb 4, 2025
Messages
74
What are the exact rules? There was no way Washington would be triggered by settling Hangzhou, though I had a slight worry, so I waited and settled a turn before, when Osaka was recaptured by Japan specifically for that reason. This is one of the most important and meaningful mechanism and planning and diplomacy constraint for the player, but I was like "no f way he will be pissed off from that far away". It's great if there are specific rules for example not in 6 tiles outward from AI city, no matter how much from their capital/core cities. I don't criticize, it will be more fun when we are sitting on the barrel of gunpowder with Washington, and now I will settle all that space. I am just interested in rules. By the way there is no modifier for being too expansioninst or having more than median number of cities anymore? It's always the best to spam then with already great things like Progress, wide religion, Industry and Order/even freedom, basically anything.

Spoiler :

Civ5Screen0100.jpg

 
Code:
/// How close to one of our cities must a newly-settled city be in order to trigger our aggression?
int CvDiplomacyAI::GetExpansionBickerRange() const
{
    if (GetPlayer()->isHuman() || GetPlayer()->GetPlayerTraits()->IsExpansionist() || GetBoldness() >= 8)
        return /*7*/ GD_INT_GET(EXPANSION_BICKER_RANGE_HIGH);

    if (GetBoldness() >= 4)
        return /*6*/ GD_INT_GET(EXPANSION_BICKER_RANGE_MEDIUM);

    return /*5*/ GD_INT_GET(EXPANSION_BICKER_RANGE_LOW);
}

/// Updates how pissy the AI is about other players settling too near them
/// Also tests whether other players have broken any expansion or land buying promises since last turn
void CvDiplomacyAI::DoExpansionBickering()
{
    if (GetPlayer()->isHuman())
        return;

    int iLoop = 0;
    int iLoop2 = 0;
    int iGameTurn = GC.getGame().getGameTurn();
    int iExpansionBickerRange = GetExpansionBickerRange();

    for (int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)
    {
        PlayerTypes ePlayer = (PlayerTypes) iPlayerLoop;
        if (!IsPlayerValid(ePlayer))
            continue;

        // No point in updating this while at war
        if (IsAtWar(ePlayer))
            continue;

        // Test to see if a land buying promise was broken
        if (GetNumTurnsBorderPromise(ePlayer) > 0)
        {
            AggressivePostureTypes eOldPosture = GetBorderPromisePosture(ePlayer);
            if (GetPlotBuyingAggressivePosture(ePlayer) > eOldPosture)
                SetBorderPromiseState(ePlayer, PROMISE_STATE_BROKEN);
        }

        // Don't bother checking further if they ignored/broke a promise, if bicker range is 0, or if they're our master.
        if (GetExpansionPromiseState(ePlayer) >= PROMISE_STATE_IGNORED || iExpansionBickerRange <= 0 || IsVassal(ePlayer))
        {
            SetAngryAboutExpansion(ePlayer, false);
            continue;
        }

        // If they haven't expanded or if it's been too long for us to complain about their expansion, forget about it.
        if (GET_PLAYER(ePlayer).getNumCities() <= 1 || GET_PLAYER(ePlayer).GetNumCitiesFounded() == 0 || GET_PLAYER(ePlayer).GetTurnsSinceSettledLastCity() >= /*30*/ GD_INT_GET(EXPANSION_BICKER_TIMEOUT))
        {
            SetAngryAboutExpansion(ePlayer, false);
            continue;
        }

        CvCity* pTheirCapital = GET_PLAYER(ePlayer).getCapitalCity();
        if (!pTheirCapital || !pTheirCapital->plot())
            continue;

        bool bFoundOne = false;

        for (CvCity* pLoopCity = GET_PLAYER(ePlayer).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER(ePlayer).nextCity(&iLoop))
        {
            CvPlot* pCityPlot = pLoopCity->plot();
            if (!pCityPlot)
                continue;

            // Ignore their capital
            if (pLoopCity->IsOriginalCapitalForPlayer(ePlayer))
                continue;

            // If this city already existed last time we got mad, don't get mad again over it
            // This flag also excludes City-States purchased by Venice/Austria
            if (pLoopCity->IsIgnoredForExpansionBickering(GetID()))
                continue;

            // Can we actually see this city? No cheating!
            if (!pCityPlot->isRevealed(GetTeam()))
                continue;

            // Only count settled cities, not conquered ones
            if (GET_PLAYER(pLoopCity->getOriginalOwner()).getTeam() != GET_PLAYER(ePlayer).getTeam())
                continue;

            // Must have founded the city recently
            int iTurnFounded = pLoopCity->getGameTurnFounded();
            if (iGameTurn - iTurnFounded >= /*30*/ GD_INT_GET(EXPANSION_BICKER_TIMEOUT))
                continue;

            // Must be close to one of our cities
            if (GetPlayer()->GetCityDistanceInPlots(pCityPlot) > iExpansionBickerRange)
                continue;

            int iDistanceFromTheirCapital = plotDistance(*pCityPlot, *pTheirCapital->plot());

            // Check to see if any of our cities within range of them were founded earlier than theirs was
            for (CvCity* pOurLoopCity = GetPlayer()->firstCity(&iLoop2); pOurLoopCity != NULL; pOurLoopCity = GetPlayer()->nextCity(&iLoop2))
            {
                CvPlot* pOurCityPlot = pOurLoopCity->plot();
                if (!pOurCityPlot)
                    continue;

                // If we acquired our city after they founded theirs, they're not being aggressive
                int iGameTurnAcquired = pOurLoopCity->getGameTurnAcquired();
                if (iGameTurnAcquired > iTurnFounded)
                    continue;
                else if (iGameTurnAcquired == iTurnFounded)
                {
                    // If they're earlier in the player order, they're not being aggressive, they just got there first!
                    if ((int)ePlayer < (int)GetID())
                        continue;
                }

                // Must be on same land area
                if (pCityPlot->getLandmass() != pOurCityPlot->getLandmass())
                    continue;

                // Is this city near them?
                int iDistanceBetweenUs = plotDistance(*pCityPlot, *pOurCityPlot);
                if (iDistanceBetweenUs > iExpansionBickerRange)
                    continue;

                // If their city is closer to (or equidistant from) their own capital, it's within their sphere of influence - ignore it
                if (iDistanceFromTheirCapital <= iDistanceBetweenUs)
                    continue;

                // We've got a reason to be mad!
                bFoundOne = true;
                break;
            }
            if (bFoundOne)
                break;
        }

        // AI is pissed!
        if (bFoundOne)
        {
            if (GetNumTurnsExpansionPromise(ePlayer) > 0) // Call this function, because expansion bickering occurs before TestOpinionModifiers()
            {
                SetExpansionPromiseState(ePlayer, PROMISE_STATE_BROKEN); // You broke the promise you made!

                // Flag all of their cities as ignored for future bickering
                for (CvCity* pLoopCity = GET_PLAYER(ePlayer).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER(ePlayer).nextCity(&iLoop))
                {
                    pLoopCity->SetIgnoredForExpansionBickering(GetID(), true);
                }
            }
            else
                SetAngryAboutExpansion(ePlayer, true); // Let's give them a piece of our mind!
        }
        else
            SetAngryAboutExpansion(ePlayer, false);
    }
}
 
So I guess, it will always be a thrill and a gamle to be founding cities. Actually, even better than just mathematically "cheating". I guess warmongers tends to be bold and expansionist (plus Alexander had high boldness IIRC) so they will be more pissed likely. Thank you.

Another thing: is breaking such a promise making only the betrayed AI pissed off or also counts towards general distrust meter in other AIs?
 
nother thing: is breaking such a promise making only the betrayed AI pissed off or also counts towards general distrust meter in other AIs?
Only that AI, although if they denounce you others might be upset that their friend has denounced you and the usual alliance bloc shenanigans.

The only promises that can trigger distrust with other AIs directly are:
- Breaking a promise not to declare war
- Breaking a promise not to conquer a protected City-State

And in addition, here are the other non-promise things that can trigger distrust directly with other AIs in the world, in order of least to most severity:
- Reporting on an AI's coop war offer to the target AI - this is just an opinion penalty
- Being denounced by a leader who had a Declaration of Friendship with you - this is also just an opinion penalty
- Civilian killer penalty if you specifically capture Settlers, Workers, etc. that aren't on a city tile, or raze cities - this is also just an opinion penalty
- Ending a Declaration of Friendship early
- Declaring war on your own vassal, outside of a declaration of independence
- Denouncing a leader you had a Declaration of Friendship with
- Declaring war on a leader you had a Declaration of Friendship with
- Declaring war on a civ you resurrected - this is the only permanent one
 
Back
Top Bottom