JFD
Kathigitarkh
I'm evidently not seeing a problem with this code that's preventing it from working (although when I originally wrote it and released the associated mod, surely I must've tested it!). The intent is that it checks for a Mountain within a city's borders and if there is one, it does stuff.
Code:
function JFD_HasMountainWithinBorders(playerID)
local player = Players[playerID]
if player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_JFD_ARMENIA"] and player:IsAlive() then
for city in player:Cities() do
if city:IsHasBuilding(GameInfoTypes["BUILDING_JFD_ARMENIAN_MONASTERY"]) then
for cityPlot = 0, city:GetNumCityPlots() -1, 1 do
local plot = city:GetCityIndexPlot(cityPlot)
if plot:IsMountain() and plot:GetOwner() == playerID then
city:SetNumRealBuilding(GameInfoTypes["BUILDING_JFD_ARMENIAN_FAITH"], 1)
else
if city:IsHasBuilding(GameInfoTypes["BUILDING_JFD_ARMENIAN_FAITH"]) then
city:SetNumRealBuilding(GameInfoTypes["BUILDING_JFD_ARMENIAN_FAITH"], 0)
end
end
end
else
if city:IsHasBuilding(GameInfoTypes["BUILDING_JFD_ARMENIAN_FAITH"]) then
city:SetNumRealBuilding(GameInfoTypes["BUILDING_JFD_ARMENIAN_FAITH"], 0)
end
end
end
end
end
GameEvents.PlayerDoTurn.Add(JFD_HasMountainWithinBorders)