"Religious differences strain your relationship"

Wumper

Chieftain
Joined
Mar 10, 2016
Messages
48
I am this both at a question in case I'm missing something, or a suggestion if that's not the case, but isn't the effect of different religions of diplomacy way too big? I founded a religion, but didn't try to spread it yet. It is only present in my capital and my other cities are under heavy pressure from other religions, yet both of my allies broke our declaraiton of friendship due to religiosu differences. I haven't tried spreading mine to them, they haven't tried either. Our religions are not even present in the same areas, yet this outweighs a friendship that lasted more than a hundred turns now, even though there are no other negative things between us. What gives?
 
I actually think the religious differences is just the excuse. A lot of times the AI will say that when the relationship has soured due to any circumstance. If you turn on transparent diplomacy you can see what is causing your relationship positives and negatives
 
ePlayer = the player the AI is evaluating
GetID()/GetPlayer() = the AI

State religion = Majority religion

Negative score = good
Positive score = bad
(they're flipped for the UI to not confuse the player)

Code:
int CvDiplomacyAI::GetReligionScore(PlayerTypes ePlayer)
{
    if (GC.getGame().isOption(GAMEOPTION_NO_RELIGION))
        return 0;

    if (IsVassal(ePlayer))
        return 0; // Vassals have their own function for this

    int iOpinionWeight = 0;

    ReligionTypes eOurOwnedReligion = GetPlayer()->GetReligions()->GetOwnedReligion();
    ReligionTypes eOurStateReligion = GetPlayer()->GetReligions()->GetStateReligion(false);
    ReligionTypes eTheirOwnedReligion = GET_PLAYER(ePlayer).GetReligions()->GetOwnedReligion();
    ReligionTypes eTheirStateReligion = GET_PLAYER(ePlayer).GetReligions()->GetStateReligion(false);

    int iFlavorReligion = m_pPlayer->GetFlavorManager()->GetPersonalityFlavorForDiplomacy((FlavorTypes)GC.getInfoTypeForString("FLAVOR_RELIGION"));
    int iEraMod = GC.getEraInfo(GC.getGame().getCurrentEra())->getDiploEmphasisReligion();

    // Weight increases or decreases based on flavors
    if (iFlavorReligion < 5)
    {
        iEraMod = max(0, iEraMod - 1);
    }
    else if (iFlavorReligion > 7)
    {
        iEraMod++;
    }

    iEraMod += GetPlayer()->GetPlayerTraits()->IsReligious() ? 1 : 0;

    // We didn't found or conquer, but have a state religion
    if (eOurOwnedReligion == NO_RELIGION && eOurStateReligion != NO_RELIGION)
    {
        if (GetNegativeReligiousConversionPoints(ePlayer) <= 0 && !IsHolyCityCapturedBy(ePlayer))
        {
            if (eOurStateReligion == eTheirOwnedReligion)
            {
                iOpinionWeight = /*-4*/ GD_INT_GET(OPINION_WEIGHT_ADOPTING_HIS_RELIGION) * iEraMod;

                // If it's the World Religion and they're its controller, support them since we get extra League votes from it
                if (GC.getGame().GetGameLeagues()->GetReligionSpreadStrengthModifier(ePlayer, eTheirOwnedReligion) > 0)
                {
                    iOpinionWeight *= /*150*/ GD_INT_GET(OPINION_WEIGHT_WORLD_RELIGION_MODIFIER);
                    iOpinionWeight /= 100;
                }
            }
            // Same state religions?
            else if (eOurStateReligion == eTheirStateReligion)
            {
                iOpinionWeight = /*-2*/ GD_INT_GET(OPINION_WEIGHT_SAME_STATE_RELIGIONS) * iEraMod;
            }
        }
        // Different majority religions?
        if (eOurStateReligion != eTheirStateReligion && eTheirStateReligion != NO_RELIGION)
        {
            iOpinionWeight = /*2*/ GD_INT_GET(OPINION_WEIGHT_DIFFERENT_OWNED_RELIGIONS) * iEraMod;
        }
    }
    // We founded or conquered
    else if (eOurOwnedReligion != NO_RELIGION)
    {
        // Did they also found or conquer? We don't like that!
        if (eTheirOwnedReligion != NO_RELIGION)
        {
            iOpinionWeight = /*5*/ GD_INT_GET(OPINION_WEIGHT_DIFFERENT_OWNED_RELIGIONS) * iEraMod;

            // If it's the World Religion and they control its Holy City, we should work against them
            if (GC.getGame().GetGameLeagues()->GetReligionSpreadStrengthModifier(ePlayer, eTheirOwnedReligion) > 0)
            {
                iOpinionWeight *= /*150*/ GD_INT_GET(OPINION_WEIGHT_WORLD_RELIGION_MODIFIER);
                iOpinionWeight /= 100;
            }
        }
        // No? Well, do they have a state religion?
        else if (eTheirStateReligion != NO_RELIGION)
        {
            // Ours?
            if (eTheirStateReligion == eOurOwnedReligion)
            {
                iOpinionWeight = /*-8*/ GD_INT_GET(OPINION_WEIGHT_ADOPTING_MY_RELIGION) * iEraMod;

                // If it's the World Religion and we control its Holy City, we should work together
                if (GC.getGame().GetGameLeagues()->GetReligionSpreadStrengthModifier(GetID(), eOurOwnedReligion) > 0)
                {
                    iOpinionWeight *= /*150*/ GD_INT_GET(OPINION_WEIGHT_WORLD_RELIGION_MODIFIER);
                    iOpinionWeight /= 100;
                }
            }
            // Someone else's?
            else
            {
                const CvReligion* pReligion = GC.getGame().GetGameReligions()->GetReligion(eTheirStateReligion, NO_PLAYER);
                if (!pReligion)
                    return 0;

                // If the religion's founder is our teammate, don't apply a penalty if that teammate is still alive.
                if (IsTeammate((PlayerTypes)pReligion->m_eFounder) && GET_PLAYER((PlayerTypes)pReligion->m_eFounder).getNumCities() > 0)
                    return 0;

                // If the religion's founder is THEIR teammate, treat it like a state religion.
                if (GET_PLAYER(ePlayer).GetDiplomacyAI()->IsTeammate((PlayerTypes)pReligion->m_eFounder) && GET_PLAYER((PlayerTypes)pReligion->m_eFounder).getNumCities() > 0)
                {
                    iOpinionWeight = /*5*/ GD_INT_GET(OPINION_WEIGHT_DIFFERENT_OWNED_RELIGIONS) * iEraMod;

                    // If it's the World Religion and their teammate controls its Holy City, we should work against them
                    if (GC.getGame().GetGameLeagues()->GetReligionSpreadStrengthModifier((PlayerTypes)pReligion->m_eFounder, eTheirStateReligion) > 0)
                    {
                        iOpinionWeight *= /*150*/ GD_INT_GET(OPINION_WEIGHT_WORLD_RELIGION_MODIFIER);
                        iOpinionWeight /= 100;
                    }
                }
                // Otherwise, apply a penalty for different majority religions.
                else
                {
                    iOpinionWeight = /*2*/ GD_INT_GET(OPINION_WEIGHT_DIFFERENT_OWNED_RELIGIONS) * iEraMod;
                }
            }
        }
    }

    if (iOpinionWeight > 0 && IsIgnoreReligionDifferences(ePlayer))
        return 0;

    return iOpinionWeight;
}

/// Should we ignore religious differences with ePlayer?
bool CvDiplomacyAI::IsIgnoreReligionDifferences(PlayerTypes ePlayer) const
{
    if (!GetPlayer()->isMajorCiv() || !GET_PLAYER(ePlayer).isMajorCiv())
        return true;

    if (IsTeammate(ePlayer) || IsMaster(ePlayer))
        return true;

    if (GetNegativeReligiousConversionPoints(ePlayer) > 0)
        return false;

    if (IsHolyCityCapturedBy(ePlayer))
        return false;

    // Capital captured? Exception if they resurrected us: only test to see if they captured it.
    if (WasResurrectedBy(ePlayer))
    {
        vector<PlayerTypes> vTheirTeam = GET_TEAM(GET_PLAYER(ePlayer).getTeam()).getPlayers();
        for (size_t i=0; i<vTheirTeam.size(); i++)
        {
            if (!GET_PLAYER(vTheirTeam[i]).isMajorCiv())
                continue;

            if (IsPlayerCapturedCapital(vTheirTeam[i]))
                return false;
        }
    }
    else
    {
        if (IsCapitalCapturedBy(ePlayer))
            return false;
    }

    // Special diplomatic behavior for Celts - no natural religion spread
    if (!HasEverConvertedCity(ePlayer) && !GET_PLAYER(ePlayer).GetDiplomacyAI()->HasEverConvertedCity(GetID()))
    {
        if (GetPlayer()->GetPlayerTraits()->IsNoNaturalReligionSpread())
            return true;

        if (GET_PLAYER(ePlayer).GetPlayerTraits()->IsNoNaturalReligionSpread())
            return true;
    }

    if (IsAtWar(ePlayer) || IsUntrustworthy(ePlayer))
        return false;

    // Ideological buddies tolerate religious differences.
    if (IsPlayerSameIdeology(ePlayer))
        return true;

    if (IsPlayerLiberatedCapital(ePlayer) || IsPlayerLiberatedHolyCity(ePlayer) || IsPlayerReturnedCapital(ePlayer) || IsPlayerReturnedHolyCity(ePlayer) || WasResurrectedBy(ePlayer) || GetDoFType(ePlayer) == DOF_TYPE_BATTLE_BROTHERS)
        return true;

    if (IsCityRecentlyLiberatedBy(ePlayer))
        return true;

    // If they're helping us go to war, we'll set aside our differences for now.
    if (GetCoopWarScore(ePlayer) > 1 || GetGlobalCoopWarWithState(ePlayer) >= COOP_WAR_STATE_PREPARING)
        return true;

    return false;
}

DiploEmphasisReligion:
Code:
Ancient: 2
Classical: 4
Medieval: 6
Renaissance: 5
Industrial: 4
Modern: 3
Atomic: 2
Information: 1

@Wumper If you have any further questions, let me know.
 
Last edited:
Actually after looking at this more closely, there IS a bug here:
Code:
                // Otherwise, apply a penalty for different majority religions.
                else
                {
                    iOpinionWeight = /*2*/ GD_INT_GET(OPINION_WEIGHT_DIFFERENT_OWNED_RELIGIONS) * iEraMod;
                }

This is referencing the wrong global, applying a penalty of 5 * iEraMod instead of the intended 2 * iEraMod for different majority religions, resulting in a 2.5x larger penalty than intended.

The intended value is OPINION_WEIGHT_DIFFERENT_STATE_RELIGIONS.

Will fix. Thanks for bringing it to my attention. However, a large penalty between founders of different religions is intended.
 
Last edited:
Top Bottom