I will think of it, but it's for sure doable.
Last edited:
local L = Locale.ConvertTextKey
local tBuildings = {}
local tWaterBuildings = {}
(...)
function JewelOfTheEast1(iPlayer, iUnitOrCity, iRole, bIsCity)
if not (bIsCity and iRole == 1) then return end
local pPlayer = Players[iPlayer]
if not pPlayer then return end
local pCity = pPlayer:GetCityByID(iUnitOrCity)
tBuildings = {}
tWaterBuildings = {}
for building in GameInfo.Buildings() do
if pCity:IsHasBuilding(building.ID) and (not building.NukeImmune or building.ID == GameInfoTypes.BUILDING_MILITARY_BASE) and building.HurryCostModifier ~= -1 then -- no wonders or dummies
local bIsUnique = false
local bIsFound = false
for uniqueBuilding in DB.Query("select * from Civilization_BuildingClassOverrides where BuildingType = ?", building.Type) do
bIsUnique = true
for equivalentBuilding in GameInfo.Buildings() do
if equivalentBuilding.BuildingClass == uniqueBuilding.BuildingClassType then
local bIsBaseBuilding = true
for equivalentUniqueBuilding in DB.Query("select * from Civilization_BuildingClassOverrides where BuildingType = ?", equivalentBuilding.Type) do
bIsBaseBuilding = false
end
if bIsBaseBuilding then
bIsFound = true
if equivalentBuilding.Water then
table.insert(tWaterBuildings, equivalentBuilding)
else
table.insert(tBuildings, equivalentBuilding)
end
break
end
end
end
if bIsFound then
break
end
end
if not bIsUnique then
if building.Water then
table.insert(tWaterBuildings, building)
else
table.insert(tBuildings, building)
end
end
end
end
end
GameEvents.BattleJoined.Add(JewelOfTheEast1)
function JewelOfTheEast2(iOldOwner, bIsCapital, iX, iY, iNewOwner, iPop, bConquest)
-- buildings part
local pPlayer = Players[iNewOwner]
local pCapital = pPlayer:GetCapitalCity()
local pCapitalX, pCapitalY, pCapitalID = pCapital:GetX(), pCapital:GetY(), pCapital:GetID()
local sName = pCapital:GetName()
local iCoastalBuildings = 0
if not (pPlayer and pPlayer:GetCivilizationType() == TimuridsID) then return end
if pCapital:IsCoastal() then
iCoastalBuildings = #tWaterBuildings
end
local iNumberOfBuildings = #tBuildings + iCoastalBuildings
if iNumberOfBuildings == 0 then return end
local sCitiesNames = ""
for i, building in pairs(tBuildings) do
if not pCapital:IsHasBuilding(building.ID) then
pCapital:SetNumRealBuilding(building.ID, 1)
if i - iCoastalBuildings == iNumberOfBuildings then
sCitiesNames = sCitiesNames .. " and " .. L(building.Description)
elseif sCitiesNames == "" then
sCitiesNames = sCitiesNames .. L(building.Description)
else
sCitiesNames = sCitiesNames .. ", " .. L(building.Description)
end
end
end
if pCapital:IsCoastal() then
for i, building in pairs(tWaterBuildings) do
if not pCapital:IsHasBuilding(building.ID) then
pCapital:SetNumRealBuilding(building.ID, 1)
if i == #tWaterBuildings then
sCitiesNames = sCitiesNames .. " and " .. L(building.Description)
elseif sCitiesNames == "" then
sCitiesNames = sCitiesNames .. L(building.Description)
else
sCitiesNames = sCitiesNames .. ", " .. L(building.Description)
end
end
end
end
if pPlayer:IsHuman() and pPlayer:IsTurnActive() then
local sText = "Foreign architects have constructed following buildings in your [ICON_CAPITAL] Capital: " .. sCitiesNames .. "."
local sTitle = "Jewel of the East"
pPlayer:AddNotification(NotificationTypes.NOTIFICATION_WONDER_COMPLETED,
sText,
sTitle,
pCapitalX, pCapitalY, GameInfoTypes.BUILDING_PALACE, -1)
end
-- yields part - on City Capture, if City has never been captured before, give capital a bonus
local pCity = Map.GetPlot(iX, iY):GetPlotCity()
if pCity:GetNumBuilding(bUniqCaptureDummy) == 0 then
pCapital:SetNumRealBuilding(bTimDummy, (pCapital:GetNumBuilding(bTimDummy) + 1))
pCity:SetNumRealBuilding(bUniqCaptureDummy, 1)
if pPlayer:IsHuman() and pPlayer:IsTurnActive() then
local vCityPosition = PositionCalculator(pCapitalX, pCapitalY)
pPlayer:AddNotification(NotificationTypes.NOTIFICATION_INSTANT_YIELD,
'Your Palace in [COLOR_POSITIVE_TEXT]'..sName..'[ENDCOLOR] has gained more yields: +1 [ICON_CULTURE] Culture, +1 [ICON_RESEARCH] Science, +1 [ICON_GOLD] Gold, and +1 [ICON_PRODUCTION] Production',
'Artisans captured and brought to '..sName,
pCapitalX, pCapitalY, pCapitalID)
end
end
end
GameEvents.CityCaptureComplete.Add(JewelOfTheEast2)
-- Melting Great Turkish Bombard
UPDATE CustomModOptions SET Value = 1 WHERE Name = 'EVENTS_BATTLES';
That's really hard to parse in the UA description. People will get confused, and it takes a lot of lines to explain. What if I added 2-3 military supply onto the Registan?Hmm. I'm honestly not sure. The supply felt really necessary, because of the amount of war needed to really make use of the UA. Maybe the supply should only go up on capturing the city and not increase with era?
It would be possible, but it's pretty incongruous with the rest of the Deh's theme. Plus, that would only be a fix if everyone is playing with 4UC.What about each deh increasing supply by 1? Is that possible?