Thalassicus / cep-bnw

Civ V Communitas Expansion Pack
32 stars 22 forks source link

City State Influence Purchasing (CEAI_Events.lua) #199

Open stackpoint opened 10 years ago

stackpoint commented 10 years ago

@Thalassicus, I was looking over the code for AI influence purchasing for CSD compatibility and I noticed that the PurchaseInfluence function that I believe handles that logic is never called anywhere. I was wondering if you had disabled the function intentionally because the base game can handle influence purchasing or otherwise.

Thalassicus commented 10 years ago

The purchase functions are stored in the DoFlavorFunction branch table:


DoFlavorFunction = {
    FLAVOR_DIPLOMACY            = PurchaseInfluence,
    FLAVOR_OFFENSE              = PurchaseOneUnitOfFlavor,
    ...
}

That line of the branch table is overridden for people using CSD:

if Cep.USING_CSD > 0 then
    DoFlavorFunction.FLAVOR_DIPLOMACY = PurchaseOneUnitOfFlavor
end

This branch table is called in the Low Priorities section of the purchase AI:

success = DoFlavorFunction[flavorType](player, cities, goldMin, flavorType)