New Beta Version - August 6th (8/6)

Status
Not open for further replies.
1- It's so hard to reform right now that Veneration giving an edge and allowing an AI to reform seems OP, despite players unanimously not feeling that way.
We could also remove Growth handicap so this becomes a way less of a problem, at least on Immortal and Deity;D
 
I agree, i think having more religions is more fun

Well thats a matter of numbers. It might as well make it more interesting when those who founded try to convert those who didn't in order to get that 1 additional city needed to reform.

Right now requirement is 20%, which means that theoretically for 5 religions on Standard every religion should have 1/5 of population to reform. However 1/5 from 8 civilizations is actually 1,6 civs, which means that theoretically (assuming all civs are equal), you need to convert 60% of other civ, which is more that half of their cities, almost impossible to do if you are not the first in their land. If we set it on 15% it would be 1,2 of average civ, which means that you need to convert yourself and couple of cities of your neighbour, but not all of his cities.

I think that would be a right move really.

I strongly disagree. Under your suggestion, everyone reforms every game. This makes for much less interesting gameplay.

I think I am inclined to agree with @ElliotS - I think this might be an issue of suboptimal AI play creating weird incentives. I also agree with @CrazyG - I think Religions might need to be set individually per map size rather than there being a single easy formula. I think maybe the correct number of Religions does not scale linearly with the number of Civs.
 
In my experience, in most games at least 3 AIs reform, while I'm usually the 4th and last to reform after inqusitioning and conquering. So I think that part is fine.

As for religious civs, I think they're all in a good place. Ethiopia is usually among the first to found and spreads its religion like wildfire. Spain's borderline OP with its multitude of various strong traits. India in human hands is very good with a guaranteed earliest pick of all religious beliefs and a possibility to go two out of Fealty/Churches/Ritual or Scripture to really overwhelm the map with its passive spread, I just wish the Indian AI was a bit better protecting its cities with inquisitors. Byzantium has the most flexibility when it comes to religion and a very strong UU to complement its religious game.
 
I strongly disagree. Under your suggestion, everyone reforms every game. This makes for much less interesting gameplay.
No. Do you really think that getting 15% is so easy? It is not.
I think I am inclined to agree with @ElliotS - I think this might be an issue of suboptimal AI play creating weird incentives. I also agree with @CrazyG - I think Religions might need to be set individually per map size rather than there being a single easy formula. I think maybe the correct number of Religions does not scale linearly with the number of Civs.
That is true for sure, but harder to do as far as i understand. It sure does not scale lineary because on larger maps with default number of cities players have more cities. On Standard you have 6-9 cities with 8 players, on Huge default number of players is 12 and you can easily fit 15 cities i guess. I've seen AIs having 40
 
I think the extra religion works alright for bigger maps, but its rough on standard and brutal on anything smaller. Like the two strategies on a small map are warmongering and building the Cathedral of St. Basil.

Good point. I generally play on small maps, so my thoughts on spread are biased by that.
 
Remember that balance for larger maps should be done with extra civs. But G usually debugs in standard size.

The number of followers required for reformation must depend on the number of religions. If having 5 religions requires 20% of the world population following, having 4 must require 25%. Reformation bonus came in recent releases at approximately the same time as the enhancing.
 
On a different note: I really like VP and want to teach some others how to do better at it, as well as maybe learn myself. One thing I think really helps the learning process is comparison. If someone tells you "X is good", that's... okay, but you can't really grasp the mechanics of it sometimes. If someone tries X, and another person tries Y, and you can compare the results, you can see for yourself "huh, this is why X is better!".

So my idea was: I generate a save, and myself and another player both play the first 90 turns (about a quarter of a full game, and IMO normally when a religion is founded). Then we can compare what we did, explain our choices, see who did better, and look at why. Ideally this would work best if it was a player either noticeably stronger or weaker than myself, as it makes comparison better.

Is anyone interested? A sort of shared photojournal, I guess.
 
So the way I see it there are two balance issues caused by poor AI play that may be factoiring into G's opinion on what beliefs are OP.
1- It's so hard to reform right now that Veneration giving an edge and allowing an AI to reform seems OP, despite players unanimously not feeling that way.
2- The AI doesn't seem to understand that sometimes it's better not to spread. Throwing endless missionaries at your neighbors isn't optimal play in many cases.

These facts combine to a meta that makes certain beliefs seem better than they are. There's really good counter-play potential already, the AI just isn't using it.

1. Is it that hard, though? And should it be easy?
2. The AI does, unless it’s one of the high flavor faith civs.
 
1. Is it that hard, though? And should it be easy?
2. The AI does, unless it’s one of the high flavor faith civs.
Conceptually a hard reformation is okay, if you can plausibly win without a reformed religion. The reformation beliefs are extremely powerful. If you found but don't reform, you might be worse off than someone who didn't found a religion, because reformation beliefs are often stronger than a founder + enhancer, especially because so many founders do nothing if you cannot spread your religion.

A big difference between human and AI here is that humans tend to go all or nothing on reforming. I'm not peacefully spreading unless I'm very confident I will hit 20%, and the moment I do I'm done spreading, and I don't expect any of those converted cities to remain my religion more than 1 era from now. this is going all in.

If I go nothing, I buy like 2 missionaries, convert my cities, then save all my faith. If I miss Basil I don't reform, I accept that. What I don't do is pump resources into missionaries and faith generation just to beat my head agaisnt a wall of inquisitors. I certainly don't senTemples are built late, and when the industrial era comes around I have a lot of faith saved up, maybe some holy sites too.

The AI seems to always go all in. One thing is they continue to spread after they already reform. Sometimes you do get more yields, but there aren't that many. With a founder such as hero worship or the WLTKD one, what is the point? You might get 1 vote if you win (you won't, I'm just going to build an inquisitor). And they keep buying missionaires in industrial era, when I'm always spending faith on great people (even if I was a spreader)
 
2. The AI does, unless it’s one of the high flavor faith civs.
Also on point #2, in that Portugal photojournal Sweden sent at least 15 missionaries to one of my cities. He sometimes flipped it, but the Aztec would immediately put it back. Between the two of them, it was probably 5,000 faith to try and get one city in the middle of nowhere to their religion. This is why I wouldn't do a spreading strategy, unless I'm just killing everyone. I would have to be able to stop missionaries with military force, because even if I had enough faith, I wouldn't want to spend it on that. Spreading has become expensive.

Neither one of them should really be investing anything in my tiny island city. Both had already reformed. Aztec had no beliefs which rewarded # of cities following. In my games it appears that all AI are spreading their religion as much as possible.
 
1. Is it that hard, though? And should it be easy?
2. The AI does, unless it’s one of the high flavor faith civs.
Basically what CrazyG said. Your claim that the AI does know when not to spread seems very contrary to my experiences. Last game I had America throwing walls and walls of missionaries at my vassal, egypt. Egypt was buying inquisitors of my religion, getting tons of pressure from my cities, and getting hit with a missionary of mine every now and again. It was a horrible idea and he just wouldn't stop.
 
What I don't do is pump resources into missionaries and faith generation just to beat my head agaisnt a wall of inquisitors
I actually remember using squd of 4 Great Prophets to convert AI in Industial. However that was because i needed votes, not the reformation itself
 
On a different note: I really like VP and want to teach some others how to do better at it, as well as maybe learn myself. One thing I think really helps the learning process is comparison. If someone tells you "X is good", that's... okay, but you can't really grasp the mechanics of it sometimes. If someone tries X, and another person tries Y, and you can compare the results, you can see for yourself "huh, this is why X is better!".

So my idea was: I generate a save, and myself and another player both play the first 90 turns (about a quarter of a full game, and IMO normally when a religion is founded). Then we can compare what we did, explain our choices, see who did better, and look at why. Ideally this would work best if it was a player either noticeably stronger or weaker than myself, as it makes comparison better.

Is anyone interested? A sort of shared photojournal, I guess.
I could possibly do this. Rather new to the whole VP thing and definitely not a top player of unmodded Civ5 either. Could never break into the Immortal & Diety levels and Emperor was down to pure luck.
So, you could use me as the "this is why this thing is not good" person :lol:
Feel free to send me a private message with any particulars (including any additional mods beyond Full VP with EUI) so as to not derail this thread further.
 
Basically what CrazyG said. Your claim that the AI does know when not to spread seems very contrary to my experiences. Last game I had America throwing walls and walls of missionaries at my vassal, egypt. Egypt was buying inquisitors of my religion, getting tons of pressure from my cities, and getting hit with a missionary of mine every now and again. It was a horrible idea and he just wouldn't stop.

Egypt is a big spreader, flavor-wise.

G
 
Here are the two AI routines for faith purchases. The first one runs first- you'll notice it returns a boolean value. If it is false, the AI then goes on to do city by city purchases (ordered by faith per turn for cities):

Code:
bool CvReligionAI::DoFaithPurchases()
{
    ReligionTypes eReligion = GetReligionToSpread();

    CvGameReligions* pReligions = GC.getGame().GetGameReligions();
    const CvReligion* pMyReligion = pReligions->GetReligion(eReligion, m_pPlayer->GetID());
#if !defined(MOD_BALANCE_CORE)
    bool bTooManyMissionaries = m_pPlayer->GetNumUnitsWithUnitAI(UNITAI_MISSIONARY) > GC.getRELIGION_MAX_MISSIONARIES();
#endif

    CvString strLogMsg;
    if(GC.getLogging())
    {
        strLogMsg = m_pPlayer->getCivilizationShortDescription();
    }

#if defined(MOD_BALANCE_CORE)
    CvPlayer &kPlayer = GET_PLAYER(m_pPlayer->GetID());
    if(kPlayer.GetID() == NO_PLAYER)
    {
        return false;
    }
    CvCity* pCapital = m_pPlayer->getCapitalCity();
    CvCity *pHolyCity = NULL;
    if(pMyReligion)
    {
        CvPlot* pHolyCityPlot = GC.getMap().plot(pMyReligion->m_iHolyCityX, pMyReligion->m_iHolyCityY);
        if (pHolyCityPlot)
        {
            pHolyCity = pHolyCityPlot->getPlotCity();

            if (pHolyCity && (pHolyCity->getOwner() == kPlayer.GetID()))
            {
                pCapital = pHolyCity;
            }
        }
    }
    if(pCapital == NULL)
    {
        return false;
    }

    UnitTypes eProphetType = kPlayer.GetSpecificUnitType("UNITCLASS_PROPHET", true);
    
    UnitClassTypes eUnitClassMissionary = (UnitClassTypes)GC.getInfoTypeForString("UNITCLASS_MISSIONARY");
    
    int iNumMissionaries = 0;

    CvUnit* pLoopUnit;
    int iLoop;

    // Current Units
    for (pLoopUnit = kPlayer.firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = kPlayer.nextUnit(&iLoop))
    {
        if (pLoopUnit->GetReligionData() != NULL && pLoopUnit->GetReligionData()->GetSpreadsLeft() > 0 && pLoopUnit->GetReligionData()->GetReligion() == eReligion)
        {
            iNumMissionaries++;
        }
    }

    int iMaxMissionaries = GC.getRELIGION_MAX_MISSIONARIES();
    
    //Do we have any useful beliefs to consider?
    CvBeliefXMLEntries* pkBeliefs = GC.GetGameBeliefs();
    int iBonusValue = 0;
    const int iNumBeliefs = pkBeliefs->GetNumBeliefs();
    for(int iI = 0; iI < iNumBeliefs; iI++)
    {
        const BeliefTypes eBelief(static_cast<BeliefTypes>(iI));
        CvBeliefEntry* pEntry = pkBeliefs->GetEntry(eBelief);
        if(pEntry && m_pPlayer->HasBelief(eBelief))
        {
            for(int iI = 0; iI < NUM_YIELD_TYPES; iI++)
            {
                if(pEntry->GetYieldFromConversion((YieldTypes)iI) > 0)
                {
                    iBonusValue++;
                }
                if(pEntry->GetYieldFromForeignSpread((YieldTypes)iI) > 0)
                {
                    iBonusValue++;
                }
                if(pEntry->GetYieldFromSpread((YieldTypes)iI) > 0)
                {
                    iBonusValue++;
                }
                if(pEntry->GetYieldPerFollowingCity((YieldTypes)iI) > 0)
                {
                    iBonusValue++;
                }
                if (pEntry->GetYieldPerXFollowers((YieldTypes)iI) > 0)
                {
                    iBonusValue++;
                }
            }
            if(pEntry->GetMissionaryInfluenceCS() > 0)
            {
                iBonusValue++;
            }
        }
    }
    iMaxMissionaries += iBonusValue;

    for (int i = MAX_MAJOR_CIVS; i < MAX_CIV_PLAYERS; i++)
    {
        PlayerTypes ePlayer = (PlayerTypes)i;
        if (ePlayer == NO_PLAYER || !GET_PLAYER(ePlayer).isAlive())
            continue;

        if (!pReligions->HasAddedReformationBelief(ePlayer))
            continue;

        //we want fewer missionaries if reformations are poppping up (this is a good way to judge if we have a chance to spread or not)
        //we want even fewer if we're reformed.
        iMaxMissionaries -= m_pPlayer->GetID() == ePlayer ? 3 : 1;
    }

    //minimum 1 (prevents overflow issues if we're on a big map with tons of religions).
    iMaxMissionaries = max(1, iMaxMissionaries);

    if (MOD_BALANCE_CORE_QUEST_CHANGES)
    {
        for (int iMinorLoop = MAX_MAJOR_CIVS; iMinorLoop < MAX_CIV_PLAYERS; iMinorLoop++)
        {
            PlayerTypes eMinor = (PlayerTypes)iMinorLoop;
            if (eMinor != NO_PLAYER)
            {
                CvPlayer* pMinor = &GET_PLAYER(eMinor);
                if (pMinor)
                {
                    CvMinorCivAI* pMinorCivAI = pMinor->GetMinorCivAI();

                    if (pMinorCivAI && pMinorCivAI->IsActiveQuestForPlayer(m_pPlayer->GetID(), MINOR_CIV_QUEST_CONTEST_FAITH))
                    {
                        iMaxMissionaries += 1;
                    }
                }
            }
        }
    }
    bool bTooManyMissionaries = false;
    if(eUnitClassMissionary != NO_UNITCLASS && m_pPlayer->GetPlayerTraits()->NoTrain(eUnitClassMissionary))
    {
        bTooManyMissionaries = true;
    }
    // If our civ benefits from sharing religion, even if we are not the founder, we will always be spreading if we can no longer found (Pius IX)
    else if (kPlayer.GetPlayerTraits()->GetSharedReligionTourismModifier() > 0 && kPlayer.GetPlayerTraits()->GetExtraMissionaryStrength() > 0 && GC.getGame().GetGameReligions()->GetNumReligionsStillToFound() == 0)
    {
        bTooManyMissionaries = iNumMissionaries >= iMaxMissionaries;
    }
    //Let's not spread a non-founder religion outside of our owned cities. That makes us a pawn!
    else if(eReligion != kPlayer.GetReligions()->GetReligionCreatedByPlayer())
    {
        iMaxMissionaries = 1;
        if (AreAllOurCitiesConverted(eReligion, true /*bIncludePuppets*/))
        {
            iMaxMissionaries = 0;
            bTooManyMissionaries = true;
        }
    }
    else
    {
        bTooManyMissionaries = iNumMissionaries >= iMaxMissionaries;
    }

    //Let's see about our religious flavor...
    CvFlavorManager* pFlavorManager = m_pPlayer->GetFlavorManager();
    int iFlavorReligion = pFlavorManager->GetPersonalityIndividualFlavor((FlavorTypes)GC.getInfoTypeForString("FLAVOR_RELIGION"));
    //Religion bonuses should artificially boost flavors.
    iFlavorReligion += iBonusValue;
    // UNITS - DOMESTIC
    if(pCapital != NULL)
    {
        //FIRST PRIORITY
        //Let's make sure our faith is enhanced.
        if (pMyReligion != NULL && !pMyReligion->m_bEnhanced && IsProphetGainRateAcceptable())
        {
            if(eProphetType != NO_UNIT)
            {
                if (BuyGreatPerson(eProphetType, eReligion))
                {
                    if(GC.getLogging())
                    {
                        strLogMsg += ", Bought a Prophet for religion enhancement.";
                        CvString strFaith;
                        strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                        strLogMsg += strFaith;
                        GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                    }
                }
                else
                {
                    if(GC.getLogging())
                    {
                        strLogMsg += ", Saving up for a Prophet for religion enhancement.";
                        CvString strFaith;
                        strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                        strLogMsg += strFaith;
                        GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                    }
                    return true;
                }
            }
        }
        // SECOND PRIORITY
        // If in Industrial, see if we want to save for buying a great person, but only if we've already got a Reformation belief and our cities are in good shape.
        if (m_pPlayer->GetCurrentEra() >= GC.getGame().GetGameReligions()->GetFaithPurchaseGreatPeopleEra(m_pPlayer) && GetDesiredFaithGreatPerson() != NO_UNIT)
        {
            //reduce our max missionaries here if we're at this point, fyi.
            iMaxMissionaries--;
            bTooManyMissionaries = iNumMissionaries >= iMaxMissionaries;

            if(pMyReligion != NULL)
            {
                if(m_pPlayer->IsReformation() || AreAllOurCitiesConverted(eReligion, false /*bIncludePuppets*/))
                {
                    UnitTypes eGPType = GetDesiredFaithGreatPerson();
                    if(eGPType != NO_UNIT)
                    {
                        if (BuyGreatPerson(eGPType, (eGPType == eProphetType) ? eReligion : NO_RELIGION))
                        {
                            if(GC.getLogging())
                            {
                                strLogMsg += ", Bought a Great Person, as we're in the Industrial age, we've reformed, and all our cities are converted.";
                                strLogMsg += GC.getUnitInfo(eGPType)->GetDescription();
                                CvString strFaith;
                                strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                                strLogMsg += strFaith;
                                GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                            }
                        }
                        else
                        {
                            if(GC.getLogging())
                            {
                                strLogMsg += ", Saving up for a Great Person, as we're in the Industrial age, we've reformed, and all our cities are converted.";
                                strLogMsg += GC.getUnitInfo(eGPType)->GetDescription();
                                CvString strFaith;
                                strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                                strLogMsg += strFaith;
                                GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                            }
                            //If our faith is already really high, return false so we can make sure we're not overzealous in our purchase.
                            if (m_pPlayer->GetFaith() > 5000)
                                return false;

                            return false;
                        }
                    }
                }
            }
            else
            {
                UnitTypes eGPType = GetDesiredFaithGreatPerson();
                if(eGPType != NO_UNIT)
                {
                    if (BuyGreatPerson(eGPType, (eGPType == eProphetType) ? eReligion : NO_RELIGION))
                    {
                        if(GC.getLogging())
                        {
                            strLogMsg += ", Bought a Great Person, as we don't have a faith and it is the Industrial age.";
                            strLogMsg += GC.getUnitInfo(eGPType)->GetDescription();
                            CvString strFaith;
                            strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                            strLogMsg += strFaith;
                            GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                        }
                    }
                    else
                    {
                        if(GC.getLogging())
                        {
                            strLogMsg += ", Saving up for a Great Person, as we don't have a faith and it is the Industrial age.";
                            strLogMsg += GC.getUnitInfo(eGPType)->GetDescription();
                            CvString strFaith;
                            strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                            strLogMsg += strFaith;
                            GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                        }
                        return false;
                    }
                }
            }

        }
        //THIRD PRIORITY
        //Let's make sure all of our non-puppet cities are converted.
        if((eReligion != NO_RELIGION) && !AreAllOurCitiesConverted(eReligion, false /*bIncludePuppets*/) && !bTooManyMissionaries)
        {
            if ((eProphetType != NO_UNIT) && ChooseProphetConversionCity(true/*bOnlyBetterThanEnhancingReligion*/) && (m_pPlayer->GetReligions()->GetNumProphetsSpawned(true) <= iFlavorReligion))
            {
                if (BuyGreatPerson(eProphetType, eReligion))
                {
                    if(GC.getLogging())
                    {
                        strLogMsg += ", Bought a Prophet, badly need to Convert Non-Puppet Cities";
                        CvString strFaith;
                        strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                        strLogMsg += strFaith;
                        GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                    }
                }
                else if (!m_pPlayer->GetPlayerTraits()->IsPopulationBoostReligion())
                {
                    if(GC.getLogging())
                    {
                        strLogMsg += ", Saving up for a Prophet, as we need to convert Non-Puppet Cities.";
                        CvString strFaith;
                        strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                        strLogMsg += strFaith;
                        GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                    }
                    return true;
                }
            }
            else if (!m_pPlayer->GetPlayerTraits()->IsPopulationBoostReligion())
            {
                if(BuyMissionary(eReligion))
                {
                    if(GC.getLogging())
                    {
                        strLogMsg += ", Bought a Missionary, need to Convert Non-Puppet Cities";
                        CvString strFaith;
                        strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                        strLogMsg += strFaith;
                        GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                    }
                }
                else
                {
                    if(GC.getLogging())
                    {
                        strLogMsg += ", Saving up for a Prophet or Missionary, as we need to convert Non-Puppet Cities.";
                        CvString strFaith;
                        strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                        strLogMsg += strFaith;
                        GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                    }
                    return true;
                }
            }
        }
        //FOURTH PRIORITY
        // Might as well convert puppet-cities to build our religious strength
        if((eReligion != NO_RELIGION) && m_pPlayer->GetNumPuppetCities() > 0 && !AreAllOurCitiesConverted(eReligion, true /*bIncludePuppets*/) && !bTooManyMissionaries && !m_pPlayer->GetPlayerTraits()->IsPopulationBoostReligion())
        {
            if(BuyMissionary(eReligion))
            {
                if(GC.getLogging())
                {
                    strLogMsg += ", Bought a Missionary, Need to Convert Puppet Cities";
                    CvString strFaith;
                    strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
            }
            else
            {
                if(GC.getLogging())
                {
                    strLogMsg += ", Saving up for a Missionary, as we need to convert Puppet Cities.";
                    CvString strFaith;
                    strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
                return true;
            }
        }
    }
    // FOREIGN UNITS
    bool bStillTooManyMissionaries = (m_pPlayer->GetNumUnitsWithUnitAI(UNITAI_MISSIONARY) > iMaxMissionaries);
    if((eReligion != NO_RELIGION) && (pMyReligion != NULL) && (pCapital != NULL) && !bStillTooManyMissionaries && AreAllOurCitiesConverted(eReligion, false /*bIncludePuppets*/) && !m_pPlayer->GetPlayerTraits()->IsPopulationBoostReligion())
    {
        if (m_pPlayer->GetPlayerTraits()->IsNoNaturalReligionSpread())
        {
            if(pMyReligion->m_Beliefs.GetUniqueCiv(m_pPlayer->GetID()) == m_pPlayer->getCivilizationType())
            {
                return false;
            }
        }
        // FLAVOR DEPENDENCIES
        // FIRST PRIORITY
        //Let's start with the highest-flavor stuff and work our way down...
        //Are we super religious? Target all cities, and always get Missionaries.
        if (iFlavorReligion >= 10 && HaveNearbyConversionTarget(eReligion, true /*bCanIncludeReligionStarter*/))
        {
            if(BuyMissionary(eReligion))
            {
                if(GC.getLogging())
                {
                    strLogMsg += ", Focusing on Missionaries, Need to Convert EVERYONE because religious zealotry";
                    CvString strFaith;
                    strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
            }   
            else
            {
                if(GC.getLogging())
                {
                    strLogMsg += ", Saving up for Missionaries, Need to Convert EVERYONE because religious zealotry";
                    CvString strFaith;
                    strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
                return false;
            }

        }
        //SECOND PRIORITY
        // Have civs nearby to target who didn't start a religion?
        if((iFlavorReligion >= 7) && HaveNearbyConversionTarget(eReligion, false /*bCanIncludeReligionStarter*/))
        {
            if(BuyMissionary(eReligion))
            {
                if(GC.getLogging())
                {
                    strLogMsg += ", Focusing on Missionaries, Need to Convert Cities of Non-Religion Starters";
                    CvString strFaith;
                    strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
            }
            else
            {
                if(GC.getLogging())
                {
                    strLogMsg += ", Saving up for Missionaries, Need to Convert Cities of Non-Religion Starters";
                    CvString strFaith;
                    strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
                return false;
            }
        }
    }
    return false;
}

AND

Code:
#if defined(MOD_BALANCE_CORE)
void CvReligionAI::DoFaithPurchasesInCities(CvCity* pCity)
{
    CvPlayer &kPlayer = GET_PLAYER(m_pPlayer->GetID());
    if(kPlayer.GetID() == NO_PLAYER)
    {
        return;
    }
    if(pCity == NULL)
    {
        return;
    }
    ReligionTypes eReligion = pCity->GetCityReligions()->GetReligiousMajority();
    if(eReligion == NO_RELIGION)
    {
        return;
    }
    CvGameReligions* pReligions = GC.getGame().GetGameReligions();
    const CvReligion* pMyReligion = pReligions->GetReligion(eReligion, m_pPlayer->GetID());

    //Not enhanced, but getting there slowly?
    if(!pMyReligion->m_bEnhanced && IsProphetGainRateAcceptable())
    {
        return;
    }

    BuildingClassTypes eFaithBuilding = FaithBuildingAvailable(eReligion, pCity);

    CvString strLogMsg;
    if(GC.getLogging())
    {
        strLogMsg = m_pPlayer->getCivilizationShortDescription();
    }

    // FIRST PRIORITY - OUR RELIGION'S BUILDING(S) IN CORE CITIES
    if((eReligion != NO_RELIGION) && (eFaithBuilding != NO_BUILDINGCLASS))
    {
        BuildingTypes eBuilding = (BuildingTypes)m_pPlayer->getCivilizationInfo().getCivilizationBuildings(eFaithBuilding);
        if(pCity->GetCityBuildings()->GetNumBuilding(eBuilding) < 1 && pCity->IsCanPurchase(true, true, NO_UNIT, eBuilding, NO_PROJECT, YIELD_FAITH))
        {
            if(BuyFaithBuilding(pCity, eBuilding))
            {
                if(GC.getLogging())
                {
                    strLogMsg += ", Bought a Faith Building";
                    CvString strFaith;
                    strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
                return;
            }
            else
            {
                if(GC.getLogging())
                {
                    strLogMsg += ", Saving up for a Faith Building.";
                    CvString strFaith;
                    strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
                return;
            }
        }
    }

    // SECOND PRIORITY -- INQUISITORS -- Only applicable if all main cities have our faith buildings.
    // Have cities Inquisitors can defend?
    if (pMyReligion->m_bEnhanced)
    {
        if ((eReligion != NO_RELIGION) && (eReligion == GetReligionToSpread()) && !HaveEnoughInquisitors(eReligion) && !pCity->GetCityReligions()->HasFriendlyInquisitor(eReligion))
        {
            UnitTypes eInquisitor = kPlayer.GetSpecificUnitType("UNITCLASS_INQUISITOR", true);

            if (pCity->IsCanPurchase(true, true, eInquisitor, (BuildingTypes)-1, (ProjectTypes)-1, YIELD_FAITH))
            {
                pCity->Purchase(eInquisitor, (BuildingTypes)-1, (ProjectTypes)-1, YIELD_FAITH);
                if (GC.getLogging())
                {
                    CvString strFaith;
                    strFaith.Format(", Bought an inquisitor");
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
                if (GC.getLogging())
                {
                    CvString strFaith;
                    strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
            }
            else
            {
                if (GC.getLogging())
                {
                    strLogMsg += ", Focusing on Inquisitors, Need to Defend Our Cities";
                    CvString strFaith;
                    strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                    strLogMsg += strFaith;
                    GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                }
                return;
            }
        }
    }

    // THIRD PRIORITY - NON-FAITH BUILDINGS
    if (eReligion != NO_RELIGION)
    {
        // FIRST SUB-PRIORITY
        // Try to build other buildings with Faith if we took that belief
        for (int iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
        {
            BuildingTypes eNonFaithBuilding = (BuildingTypes)m_pPlayer->getCivilizationInfo().getCivilizationBuildings(iI);
            if (eNonFaithBuilding != NO_BUILDING)
            {
                CvBuildingEntry* pBuildingEntry = GC.GetGameBuildings()->GetEntry(eNonFaithBuilding);
                //Changed - let's make sure it costs faith, and isn't a religious-specific building
                if (pBuildingEntry && pBuildingEntry->GetFaithCost() > 0 && pBuildingEntry->GetReligiousPressureModifier() <= 0)
                {
                    if (pCity->GetCityBuildings()->GetNumBuilding(eNonFaithBuilding) < 1 && pCity->IsCanPurchase(true, true, NO_UNIT, eNonFaithBuilding, NO_PROJECT, YIELD_FAITH))
                    {
                        if (BuyFaithBuilding(pCity, eNonFaithBuilding))
                        {
                            if (GC.getLogging())
                            {
                                strLogMsg += ", Bought a Non-Faith Building";
                                CvString strFaith;
                                strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                                strLogMsg += strFaith;
                                GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                            }
                            return;
                        }
                        else
                        {
                            if (GC.getLogging())
                            {
                                strLogMsg += ", Focusing on Non-Faith Buildings, have belief that allows this";
                                CvString strFaith;
                                strFaith.Format(", Faith: %d", m_pPlayer->GetFaith());
                                strLogMsg += strFaith;
                                GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                            }
                            return;
                        }
                    }
                }
            }
        }
    }

    // FOURTH PRIORITY - OTHER UNITS
    // Try to build other units with Faith if we took that belief
    if((eReligion != NO_RELIGION) && AreAllOurCitiesConverted(eReligion, false /*bIncludePuppets*/))
    {
        int iPurchaseAmount = 5;
        if (m_pPlayer->GetPlayerTraits()->IsCanPurchaseNavalUnitsFaith())
        {
            iPurchaseAmount *= 10;
        }
        if((kPlayer.GetTreasury()->CalculateBaseNetGoldTimes100() > 0) && (kPlayer.GetNumUnitsOutOfSupply() <= 0))
        {
            CvCityBuildable selection = (pCity->GetCityStrategyAI()->ChooseHurry(true, true));
            if (selection.m_eBuildableType != NOT_A_CITY_BUILDABLE)
            {
                UnitTypes eUnit = (UnitTypes)selection.m_iIndex;
                if (eUnit != NO_UNIT)
                {
                    CvUnitEntry* pUnitEntry = GC.getUnitInfo(eUnit);
                    if (pUnitEntry)
                    {
                        if (eUnit == pCity->GetUnitForOperation() || eUnit == kPlayer.GetMilitaryAI()->GetUnitForArmy(pCity))
                        {
                            pCity->Purchase(eUnit, (BuildingTypes)-1, (ProjectTypes)-1, YIELD_FAITH);
                            if (GC.getLogging())
                            {
                                CvString strFaith;
                                strFaith.Format(", Bought a Non-Faith military Unit, %s, Faith: %d", pUnitEntry->GetDescriptionKey(), m_pPlayer->GetFaith());
                                strLogMsg += strFaith;
                                GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                            }
                            return;
                        }
                        else if (m_pPlayer->GetNumUnitsWithUnitAI(pUnitEntry->GetDefaultUnitAIType()) <= iPurchaseAmount)
                        {
                            pCity->Purchase(eUnit, (BuildingTypes)-1, (ProjectTypes)-1, YIELD_FAITH);
                            if (GC.getLogging())
                            {
                                CvString strFaith;
                                strFaith.Format(", Bought a Non-Faith military Unit, %s, (up to %d), Faith: %d", pUnitEntry->GetDescriptionKey(), iPurchaseAmount, m_pPlayer->GetFaith());
                                strLogMsg += strFaith;
                                GC.getGame().GetGameReligions()->LogReligionMessage(strLogMsg);
                            }
                            return;
                        }
                    }
                }
            }
        }
    }
}

The code is annotated pretty well, but I'm open to questions. This is heavily scripted because, well, these are the tools I have to work with from Firaxis. I may be missing a prostrat(TM) here somewhere that you all can see, and I can't. Take a look!

G
 
Status
Not open for further replies.
Back
Top Bottom