local iBonusPerTurn = 2 --To be tweaked by playtesting. Put here for easy changing.
function raiseCityStateInfluence( player )
local pPlayer = Players[player]
if pPlayer:IsEverAlive() and pPlayer:IsAlive() then
print("Turn started for ",pPlayer:GetCivilizationShortDescription())
if pPlayer:GetCivilizationType() == GameInfoTypes["CIVILIZATION_ALTEA"] then
local iTeam = pPlayer:GetTeam()
local pTeam = Teams[iTeam]
local atPeace = true
for iOtherTeam, pOtherTeam in pairs(Teams) do
if pTeam:IsAtWar(iOtherTeam) and iOtherTeam ~= 63 then
atPeace = false
end --Exclude 63 because that is Barbarians!
end
if (not atPeace) then
print("--Archanea is at war. Influence will not be raised.")
end
if atPeace then
print("--raising influence with protected city-states")
for iLoop = GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS-1, 1 do
local pMinorCiv = Players[iLoop]
if pMinorCiv:IsEverAlive() and pMinorCiv:IsAlive() then
if pPlayer:IsProtectingMinor(iLoop) then
local influence = pMinorCiv:GetMinorCivFriendshipWithMajor([color="blue"]player[/color])
if influence < 65 then
print("--",pMinorCiv:GetCivilizationShortDescription())
pMinorCiv:ChangeMinorCivFriendshipWithMajor(player,iBonusPerTurn)
end
end
end
end
end
end
end
end
[color="green"]GameEvents.PlayerDoTurn.Add(raiseCityStateInfluence)[/color]