local function inBuildMenu(defaultBuildFunction,city,item,tribe)
-- Really useful for controlling unit population
if civ.isUnitType(item) then
if item == unitAliases.Garrison then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Garrison,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Archers then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Archers,city.owner) <= findNativePopulation(city.owner)/4
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Marines then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Marines,city.owner) <= findNativePopulation(city.owner)/4
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Legion then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Legion,city.owner) <= findNativePopulation(city.owner)/8
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Cataphract then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Cataphract,city.owner) <= findNativePopulation(city.owner)/8
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.HeavyCavalry then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.HeavyCavalry,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.LightCavalry then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.LightCavalry,city.owner) <= findNativePopulation(city.owner)/4
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Ballista then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Ballista,city.owner) <= findNativePopulation(city.owner)/8
end
end
end
-- Begin counting for special units obtained through Tributaries tech
if civ.isUnitType(item) then
if item == unitAliases.Barque then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Barque,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Elephants then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Elephants,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Messenger then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Messenger,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Artisans then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Artisans,city.owner) <= findNativePopulation(city.owner)/4
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.HillWarriors then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.HillWarriors,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
-- End counting for special units obtained through Tributaries tech
if civ.isUnitType(item) then
if item == unitAliases.BatteringRam then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.BatteringRam,city.owner) <= findNativePopulation(city.owner)/3
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.SiegeHook then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.SiegeHook,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Catapult then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Catapult,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Galley then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Galley,city.owner) <= findNativePopulation(city.owner)/4
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Trireme then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Trireme,city.owner) <= findNativePopulation(city.owner)/4
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Quadrireme then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Quadrireme,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Juggernaut then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Juggernaut,city.owner) <= findNativePopulation(city.owner)/8
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.SiegeShip then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.SiegeShip,city.owner) <= findNativePopulation(city.owner)/8
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Liburna then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Liburna,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Shepherd then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Shepherd,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Ranger then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Ranger,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.LightInf then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.LightInf,city.owner) <= findNativePopulation(city.owner)/3
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.HeavyInf then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.HeavyInf,city.owner) <= findNativePopulation(city.owner)/4
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Cohort then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Cohort,city.owner) <= findNativePopulation(city.owner)/6
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Hoplites then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Hoplites,city.owner) <= findNativePopulation(city.owner)/4
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.WarElephant then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.WarElephant,city.owner) <= findNativePopulation(city.owner)/8
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.Slingers then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.Slingers,city.owner) <= findNativePopulation(city.owner)/4
end
end
end
if civ.isUnitType(item) then
if item == unitAliases.HorseArchers then
if not defaultBuildFunction(city,item) then
return false
else
return countUnits(unitAliases.HorseArchers,city.owner) <= findNativePopulation(city.owner)/4
end
end
end
if civ.isWonder(item) then
if item == wonderAliases.AcademyofGondishapur then
local tribe = city.owner
return tribe:hasTech(techAliases.Acceptance)
end
end
if civ.isWonder(item) then
if item == wonderAliases.CouncilofNicaea then
local tribe = city.owner
return tribe:hasTech(techAliases.NewReligion)
end
end
if city.owner.isHuman then
if civ.isUnitType(item) then
if item == unitAliases.Merchant or item == unitAliases.Caravan then
return civ.hasImprovement(city,improvementAliases.Marketplace) and defaultBuildFunction(city,item)
end
end
if civ.isUnitType(item) then
if item == unitAliases.Galley or item == unitAliases.Bireme then
return civ.hasImprovement(city,improvementAliases.Harbor) and defaultBuildFunction(city,item)
end
end
if civ.isUnitType(item) then
if item == unitAliases.Trireme or item == unitAliases.Quadrireme then
return civ.hasImprovement(city,improvementAliases.Harbor) and defaultBuildFunction(city,item)
end
end
if civ.isUnitType(item) then
if item == unitAliases.Ballista or item == unitAliases.Cataphract then
return civ.hasImprovement(city,improvementAliases.LayeredCrucibles) and defaultBuildFunction(city,item)
end
end
if civ.isUnitType(item) then
if item == unitAliases.Legion or item == unitAliases.Cohort then
return civ.hasImprovement(city,improvementAliases.LayeredCrucibles) and defaultBuildFunction(city,item)
end
end
if civ.isUnitType(item) then
if item == unitAliases.Juggernaut or item == unitAliases.SiegeShip then
return civ.hasImprovement(city,improvementAliases.Shipyard) and defaultBuildFunction(city,item)
end
end
if civ.isUnitType(item) then
if item == unitAliases.LightInf or item == unitAliases.HeavyInf then
return civ.hasImprovement(city,improvementAliases.Barracks) and defaultBuildFunction(city,item)
end
end
if civ.isUnitType(item) then
if item == unitAliases.LightCavalry or item == unitAliases.HeavyCavalry then
return civ.hasImprovement(city,improvementAliases.Barracks) and defaultBuildFunction(city,item)
end
end
if civ.isUnitType(item) then
if item == unitAliases.Marines then
return civ.hasImprovement(city,improvementAliases.Harbor) and defaultBuildFunction(city,item)
end
end
end
return defaultBuildFunction(city,item)
end
civ.scen.onCanBuild(inBuildMenu)