Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local iCulture = GameInfoTypes.YIELD_CULTURE
- function CampismoALoCubano(playerID)
- local player = Players[playerID]
- if (player:IsAlive()) then
- for pUnit in player:Units() do
- if (pUnit:IsHasPromotion(GameInfoTypes.PROMOTION_UC_GUAJIRO)) then
- local uPlot = pUnit:GetPlot();
- if (uPlot and uPlot:GetOwner() == playerID) then
- local plotResource = uPlot:GetResourceType()
- local resourceClassType = GameInfo.Resources[plotResource].ResourceClassType
- if resourceClassType == 'RESOURCECLASS_LUXURY' and uPlot:GetImprovementType() ~= -1 and not uPlot:IsImprovementPillaged() then
- local plotGold = uPlot:GetYield(GameInfoTypes.YIELD_GOLD)
- SetMambiYield(uPlot, iCulture, plotGold)
- else
- SetMambiYield(uPlot, iCulture, 0)
- end
- end
- end
- end
- end
- end
- GameEvents.PlayerDoTurn.Add(CampismoALoCubano)
- GameEvents.UnitSetXY.Add(CampismoALoCubano)
- function SetMambiYield(uPlot, iYield, iDelta)
- iOldDelta = load(uPlot, iYield)
- if iOldDelta == nil then
- Game.SetPlotExtraYield(uPlot:GetX(), uPlot:GetY(), iYield, iDelta)
- else
- Game.SetPlotExtraYield(uPlot:GetX(), uPlot:GetY(), iYield, iDelta - iOldDelta)
- end
- save(uPlot, iYield, iDelta)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement