Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------
- --Basic Data
- ----------------------------------------------------
- local iCiv = GameInfoTypes.CIVILIZATION_RBRUNEI;
- local eOilTradeBuilding = GameInfoTypes.BUILDING_RBRUNEI_DUMMY_OIL;
- local sImprov = GameInfoTypes.IMPROVEMENT_RBRUNEI_MOD;
- local uCargo = GameInfoTypes.UNIT_CARGO_SHIP;
- ----------------------------------------------------
- --OilTradeGold
- ----------------------------------------------------
- function OilTradeGold(iPlayer)
- local pPlayer = Players[iPlayer]
- if pPlayer:GetCivilizationType() == iCiv then
- for pCity in pPlayer:Cities() do
- local oilTradeAmount = 0
- local iNumPlots = pCity:GetNumCityPlots()
- for i = 0, iNumPlots - 1 do
- local pPlot = pCity:GetCityIndexPlot(i)
- if pCity:IsWorkingPlot(pPlot) and pPlot:GetResourceType() == ResourceTypes.RESOURCE_OIL then
- oilTradeAmount = oilTradeAmount + 1
- end
- end
- pCity:SetNumRealBuilding(eOilTradeBuilding, oilTradeAmount)
- end
- end
- end
- GameEvents.PlayerDoTurn.Add(OilTradeGold)
- ----------------------------------------------------
- --CargoShipBonus
- ----------------------------------------------------
- function CargoShipBonus(iPlayer, pPlayer, pcCity)
- for mPlayer=0, GameDefines.MAX_MAJOR_CIVS-1 do
- local mPlayer = Players[mPlayer];
- if (mPlayer:IsAlive()) then
- for mUnit in mPlayer:Units() do
- if mUnit:GetUnitType() == uCargo then
- local uPlot = mUnit:GetPlot()
- -- Steal Gold Function
- CargoShipStealGold(iPlayer, pPlayer, mPlayer, mUnit, uPlot, pcCity)
- local plotX = uPlot:GetX();
- local plotY = uPlot:GetY();
- local iRange = 1;
- for iDX = -iRange, iRange do
- for iDY = -iRange, iRange do
- local pTargetPlot = Map.PlotXYWithRangeCheck(plotX, plotY, iDX, iDY, iRange);
- if pTargetPlot then
- if pTargetPlot:GetImprovementType() == sImprov then
- local nPlayer = Players[mUnit:GetOwner()];
- if (nPlayer:IsAlive()) then
- pPlayer:ChangeGold(1); -- 1 Default
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- CargoShipBonus(pPlayer, iPlayer, pcCity)
- end
Advertisement
Add Comment
Please, Sign In to add comment