Casus Belli - Just Wars in Civ 5

Jiska

Warlord
Joined
Apr 23, 2016
Messages
164
Steam Link: with Screenshots: https://steamcommunity.com/sharedfiles/filedetails/?id=2491506127

Differentiates between types of declared wars. How to declare each (and order of precedence, descending):

-Ideological War: Have adopted different Ideologies. (25% Warmonger Penalty.)
-Holy War: Have founded different Religions (can't if adopted Secularism). (33% Warmonger Penalty.)
-Territorial War: Have completed more than two Policy Branches and have less than 20 Tiles distance between Capitals. (50% Warmonger Penalty.)
-Colonial War: Be more than three Eras in advance. (50% Warmonger Penalty.)
-Protectorate War: Have had a City-State under your protection be Bullied. (66% Warmonger Penalty.)
-Reconquest War: Other player has control of one of your Cities. (66% Warmonger Penalty.)
-Formal War: Have Denounced or been Denounced or other broken promise more than five turns ago. (75% Warmonger Penalty.)
-Surprise War: Default. (100 % Warmonger Penalty.)

Because this is a DLL mod, it won't be compatible with other DLL mods. (Or anything that modifies LeaderHeadRoot.lua). A more fleshed out version of this will be rolled into the next patch of Empires Ascendant.
 
Last edited:
Lovely feature, is there a possibility you could share the DLL code in question (read that you might provide it on the steam mod page). Again, this is an amazing mod, thanks regardless.
 
Would you mind sharing the DLL code with me? Would love to merge this with the VP DLL :)
 
Sure thing. I'm at bit busy now, I'll hop on my desktop at some point in the next few days and post it
 
Modify CvDiplomacyAIHelpers::ApplyWarmongerPenalties inCvDiplomacyAI.cpp to the following:

C++:
void CvDiplomacyAIHelpers::ApplyWarmongerPenalties(PlayerTypes eConqueror, PlayerTypes eConquered)
{
    CvPlayer &kConqueringPlayer = GET_PLAYER(eConqueror);

    int iWarmongerModifier = 1;
    ICvEngineScriptSystem1* pkScriptSystem = gDLL->GetScriptSystem();
    if (pkScriptSystem)
    {
        CvLuaArgsHandle args;
        args->Push(eConqueror);
        args->Push(eConquered);

        // Iska catchme
        // Attempt to execute the game events.
        // Will return false if there are no registered listeners.
      
        LuaSupport::CallAccumulator(pkScriptSystem, "GetWarmongerPenaltyModifier", args.get(), iWarmongerModifier);
    }

    for(int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)
    {
        PlayerTypes eMajor = (PlayerTypes)iMajorLoop;
        if (eConqueror != eMajor && GET_PLAYER(eMajor).isAlive())
        {
            // Have I met the player who conquered the city?
            CvTeam &kAffectedTeam = GET_TEAM(GET_PLAYER(eMajor).getTeam());
            if (kAffectedTeam.isHasMet(kConqueringPlayer.getTeam()))
            {
                int iNumCities = max(GET_PLAYER(eConquered).getNumCities(), 1);
                int iWarmongerOffset = CvDiplomacyAIHelpers::GetWarmongerOffset(iNumCities, GET_PLAYER(eConquered).isMinorCiv());
                // Half penalty if I'm also at war with conquered civ
                //if (kAffectedTeam.isAtWar(GET_PLAYER(eConquered).getTeam()))
                //{    YOINKED! Modified by Iska for Casus Belli
                iWarmongerOffset *= iWarmongerModifier;
                //}

                GET_PLAYER(eMajor).GetDiplomacyAI()->ChangeOtherPlayerWarmongerAmount(eConqueror, iWarmongerOffset);
            }
        }
    }
}
 
B
Modify CvDiplomacyAIHelpers::ApplyWarmongerPenalties inCvDiplomacyAI.cpp to the following:

C++:
void CvDiplomacyAIHelpers::ApplyWarmongerPenalties(PlayerTypes eConqueror, PlayerTypes eConquered)
{
    CvPlayer &kConqueringPlayer = GET_PLAYER(eConqueror);

    int iWarmongerModifier = 1;
    ICvEngineScriptSystem1* pkScriptSystem = gDLL->GetScriptSystem();
    if (pkScriptSystem)
    {
        CvLuaArgsHandle args;
        args->Push(eConqueror);
        args->Push(eConquered);

        // Iska catchme
        // Attempt to execute the game events.
        // Will return false if there are no registered listeners.
     
        LuaSupport::CallAccumulator(pkScriptSystem, "GetWarmongerPenaltyModifier", args.get(), iWarmongerModifier);
    }

    for(int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)
    {
        PlayerTypes eMajor = (PlayerTypes)iMajorLoop;
        if (eConqueror != eMajor && GET_PLAYER(eMajor).isAlive())
        {
            // Have I met the player who conquered the city?
            CvTeam &kAffectedTeam = GET_TEAM(GET_PLAYER(eMajor).getTeam());
            if (kAffectedTeam.isHasMet(kConqueringPlayer.getTeam()))
            {
                int iNumCities = max(GET_PLAYER(eConquered).getNumCities(), 1);
                int iWarmongerOffset = CvDiplomacyAIHelpers::GetWarmongerOffset(iNumCities, GET_PLAYER(eConquered).isMinorCiv());
                // Half penalty if I'm also at war with conquered civ
                //if (kAffectedTeam.isAtWar(GET_PLAYER(eConquered).getTeam()))
                //{    YOINKED! Modified by Iska for Casus Belli
                iWarmongerOffset *= iWarmongerModifier;
                //}

                GET_PLAYER(eMajor).GetDiplomacyAI()->ChangeOtherPlayerWarmongerAmount(eConqueror, iWarmongerOffset);
            }
        }
    }
}
By chance do you still mod for Civ 5? I would love these options in the Civ IV Diplomacy mod. Is there a way to make it work or would it be far too arduous?
 
Top Bottom