if player:GetUnitClassCount(GameInfoTypes["UNITCLASS_KNIGHT"]) > 0 then
local Religious = {}
--first remove all instances of the crusader promotion
for unit in player:Units() do
if unit:IsHasPromotion(GameInfoTypes["PROMOTION_CRUSADER"]) then
unit:SetHasPromotion(GameInfoTypes["PROMOTION_CRUSADER"], false)
end
--now check the plots around all your religious units for crusaders, and when there is one, give him the crusader promotion, that has the desired special effect
if unit:GetUnitClassType() == GameInfoTypes["UNITCLASS_MISSIONARY"] or unit:GetUnitClassType() == GameInfoTypes["UNITCLASS_INQUISITOR"] or unit:GetUnitClassType() == GameInfoTypes["UNITCLASS_PROPHET"] then
table.insert(Religious, unit)
end
for key,Reli in pairs(Religious) do
local plot = Reli:GetPlot()
for loopPlot in PlotAreaSweepIterator(plot, 3, SECTOR_NORTH, DIRECTION_CLOCKWISE, DIRECTION_OUTWARDS, CENTRE_INCLUDE) do
for i = 0, loopPlot:GetNumUnits() - 1, 1 do
local otherUnit = loopPlot:GetUnit(i)
if otherUnit and otherUnit:GetOwner() == playerID and otherUnit:GetUnitType() == GameInfoTypes["UNIT_CRUSADER"] then
otherUnit:SetHasPromotion(GameInfoTypes["PROMOTION_CRUSADER"], true)
end
end
end
end
end