[GS] Checking if a city has a wonder building

ChrisWJN

Chieftain
Joined
Mar 12, 2019
Messages
43
Location
Canada
The goal is to grant the civ a production boost towards wonders it is constructing when liberating a city that has a constructed wonder. I'm a bit lost at the moment, LUA isn't very intuitive to me. Any help would be greatly appreciated. The following is the current pseudocode I have written.
Code:
function GrantProduction(_playerID, _cityID)
    local pPlayer = Players[_playerID]
    if pPlayer:TypeName() == "CWJN_LEADER_CECILIA" then
        local pCity = Cities[_cityID]
        for building in pCity:GetBuildings() do
            if building:HasWonder() then
                for city in pPlayer:GetCities() do
                    if city:GetProduction():isWonder() do
                        city:GrantBonusProduction(20)
                    end
                end
            end
        end
    end
end
Events.CityLiberated.Add(GrantProduction)
 
Top Bottom