function C15_Senshi_SeaResources(playerID, plotX, plotY)
local player = Players[playerID]
if (not player:IsAlive()) then return end
if (not HasTrait(player, traitCajunID)) then return end
local plot = Map.GetPlot(plotX, plotY)
local city = plot:GetPlotCity()
local tPlots = {}
for adjacentPlot in PlotAreaSweepIterator(plot, 3, SECTOR_NORTH, DIRECTION_CLOCKWISE, DIRECTION_OUTWARDS, CENTRE_EXCLUDE) do
if (adjacentPlot:GetOwner() == -1 or adjacentPlot:GetOwner() == player:GetID()) then
if ((adjacentPlot:IsCoastalLand() and adjacentPlot:GetFeatureType() == GameInfoTypes.FEATURE_MARSH) or (adjacentPlot:GetTerrainType() == GameInfoTypes["TERRAIN_COAST"] and adjacentPlot:GetFeatureType() == -1) or adjacentPlot:GetFeatureType() == GameInfoTypes["FEATURE_LAKE_VICTORIA"]) and adjacentPlot:GetResourceType() == -1 then
table.insert(tPlots, adjacentPlot)
end
end
end
if #tPlots > 0 then
local tRandom = {1,2,2,2,2,2,3,3}
local iRandom = tRandom[JFD_GetRandom(1, #tRandom)]
if iRandom > #tPlots then iRandom = #tPlots end
for iNum = 1, iRandom do
local iPlot = JFD_GetRandom(1, #tPlots)
local plot = tPlots[iPlot]
plot:SetResourceType(resourceShrimpID, 1)
table.remove(tPlots, iPlot)
if player:IsHuman() then
local sResource = Locale.ConvertTextKey("TXT_KEY_RESOURCE_SHRIMP")
local sCity = city:GetName()
local sTooltip = Locale.ConvertTextKey("TXT_KEY_MISC_YOU_DISCOVERED_RESOURCE", sResource, sCity)
local sTitle = Locale.ConvertTextKey("TXT_KEY_NOTIFICATION_SUMMARY_FOUND_RESOURCE", sResource)
player:AddNotification(NotificationTypes.NOTIFICATION_DISCOVERED_LUXURY_RESOURCE, sTooltip, sTitle, plot:GetX(), plot:GetY(), resourceShrimpID, -1)
end
end
end
end
GameEvents.PlayerCityFounded.Add(C15_Senshi_SeaResources)