Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. local tBuilding = {}
  2. local tYield = {}
  3.  
  4. tYield[GameInfoTypes.YIELD_FOOD] = GameInfoTypes.BUILDING_KADA_FOOD
  5. tYield[GameInfoTypes.YIELD_PRODUCTION] = GameInfoTypes.BUILDING_KADA_PRODUCTION
  6. tYield[GameInfoTypes.YIELD_GOLD] = GameInfoTypes.BUILDING_KADA_1_GOLD
  7. tYield[GameInfoTypes.YIELD_SCIENCE] = GameInfoTypes.BUILDING_KADA_SCIENCE_1
  8. tYield[GameInfoTypes.YIELD_CULTURE] = GameInfoTypes.BUILDING_KADA_CULTURE_1
  9. tYield[GameInfoTypes.YIELD_FAITH] = GameInfoTypes.BUILDING_KADA_FAITH
  10.  
  11. function InitTable()
  12. for pRow in GameInfo.Building_YieldChanges() do
  13. local id = GameInfoTypes[pRow.BuildingType]
  14. --The Gameinfos is the first thing, the Buildings is the row, the [id] is getting THE row, the .cost is the column
  15. if GameInfo.Buildings[id].Cost ~= -1 then
  16. tBuilding[id] = {}
  17. --the second [] is the second entry
  18. tBuilding[id][#tBuilding[id] + 1] = GameInfoTypes[pRow.YieldType]
  19. end
  20. end
  21. for iBuilding,pYield in ipairs(tBuilding) do
  22. for iKey,spYield in ipairs(pYield) do
  23. print(GameInfo.Buildings[iBuilding].Type)
  24. print(GameInfo.Yields[spYield].Type)
  25. end
  26. end
  27. end
  28. InitTable()
  29.  
  30. function ExtraPower(iPlayer)
  31. local pPlayer = Players[iPlayer];
  32. for pCity in pPlayer:Cities() do
  33. if pCity:IsHasBuilding(GameInfoTypes.BUILDING_KADA_HOOVER_DAM) then
  34. for iYield,iDummy in ipairs(tYield) do
  35. pCity:SetNumRealBuilding(iDummy, 0)
  36. end
  37. for iBuilding,pYield in ipairs(tBuilding) do
  38. if pCity:IsHasBuilding(iBuilding) then
  39. for iKey,spYield in ipairs(pYield) do
  40. print(GameInfo.Buildings[iBuilding].Type .. " " .. GameInfo.Yields[spYield].Type)
  41. pCity:SetNumRealBuilding(tYield[spYield], pCity:GetNumBuildings(tYield[spYield]) + 1)
  42. end
  43. end
  44. end
  45. end
  46. break
  47. end
  48. end
  49. GameEvents.PlayerDoTurn.Add(ExtraPower)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement