Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tBuilding = {}
- local tYield = {}
- tYield[GameInfoTypes.YIELD_FOOD] = GameInfoTypes.BUILDING_KADA_FOOD
- tYield[GameInfoTypes.YIELD_PRODUCTION] = GameInfoTypes.BUILDING_KADA_PRODUCTION
- tYield[GameInfoTypes.YIELD_GOLD] = GameInfoTypes.BUILDING_KADA_1_GOLD
- tYield[GameInfoTypes.YIELD_SCIENCE] = GameInfoTypes.BUILDING_KADA_SCIENCE_1
- tYield[GameInfoTypes.YIELD_CULTURE] = GameInfoTypes.BUILDING_KADA_CULTURE_1
- tYield[GameInfoTypes.YIELD_FAITH] = GameInfoTypes.BUILDING_KADA_FAITH
- function InitTable()
- for pRow in GameInfo.Building_YieldChanges() do
- local id = GameInfoTypes[pRow.BuildingType]
- --The Gameinfos is the first thing, the Buildings is the row, the [id] is getting THE row, the .cost is the column
- if GameInfo.Buildings[id].Cost ~= -1 then
- tBuilding[id] = {}
- --the second [] is the second entry
- tBuilding[id][#tBuilding[id] + 1] = GameInfoTypes[pRow.YieldType]
- end
- end
- for iBuilding,pYield in ipairs(tBuilding) do
- for iKey,spYield in ipairs(pYield) do
- print(GameInfo.Buildings[iBuilding].Type)
- print(GameInfo.Yields[spYield].Type)
- end
- end
- end
- InitTable()
- function ExtraPower(iPlayer)
- local pPlayer = Players[iPlayer];
- for pCity in pPlayer:Cities() do
- if pCity:IsHasBuilding(GameInfoTypes.BUILDING_KADA_HOOVER_DAM) then
- for iYield,iDummy in ipairs(tYield) do
- pCity:SetNumRealBuilding(iDummy, 0)
- end
- for iBuilding,pYield in ipairs(tBuilding) do
- if pCity:IsHasBuilding(iBuilding) then
- for iKey,spYield in ipairs(pYield) do
- print(GameInfo.Buildings[iBuilding].Type .. " " .. GameInfo.Yields[spYield].Type)
- pCity:SetNumRealBuilding(tYield[spYield], pCity:GetNumBuildings(tYield[spYield]) + 1)
- end
- end
- end
- end
- break
- end
- end
- GameEvents.PlayerDoTurn.Add(ExtraPower)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement