--------------------------------------------------------------
-- UA: Négritude - +2 Griot points are earned for your capital when your units kill, or are killed.
-- UU: Gendarmerie - Replaces Infantry. Higher defence. When garrisoned in a city, spy stealing rate reduced 10%, +5 defence and +2 culture for the city.
-- UU: Griot - Replaces Great Musician. Garrisoning them in a city produces +2 happiness, +2 culture and +10% tourism for that city.
----------------------------------------------------------------------------------------------------------------------------
-- GLOBAL VARIABLES
----------------------------------------------------------------------------------------------------------------------------
local senegalID = GameInfoTypes["CIVILIZATION_SENEGAL"]
local specialistGriotID = GameInfoTypes["SPECIALIST_MUSICIAN"]
local gendarmerieID = GameInfoTypes["UNIT_GENDARMERIE"]
local griotID = GameInfoTypes["UNIT_GRIOT"]
local genDummyBID = GameInfoTypes["BUILDING_GENDARMERIE_DUMMY"]
local griDummyBID = GameInfoTypes["BUILDING_GRIOT_DUMMY"]
----------------------------------------------------------------------------------------------------------------------------
---- WilliamHoward's IsCivInPlay
----------------------------------------------------------------------------------------------------------------------------
function IsCivInPlay(iCivType)
for iSlot = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
local iSlotStatus = PreGame.GetSlotStatus(iSlot)
if (iSlotStatus == SlotStatus.SS_TAKEN or iSlotStatus == SlotStatus.SS_COMPUTER) then
if (PreGame.GetCivilization(iSlot) == iCivType) then
return true
end
end
end
return false
end
----------------------------------------------------------------------------------------------------------------------------
-- UA: NÉGRITUDE
----------------------------------------------------------------------------------------------------------------------------
function GriotPointsWhenUnitDie(iPlayer, iKilledPlayer, iKilledUnit)
local pKillingPlayer = Players[iPlayer]
if pKillingPlayer:GetCivilizationType() == senegalID
local griotCity = pKillingPlayer:GetCapitalCity()
local griotPoints = 2
griotCity:ChangeSpecialistGreatPersonProgressTimes100(specialistGriotID, griotPoints*100)
if pKillingPlayer:IsHuman() then
Events.GameplayAlertMessage("Your unit has killed an enemy! Your capital gains 2 [ICON_GREAT_PEOPLE] Great Griot Points!")
end
end
local pKilledPlayer = Players[iKilledPlayer]
if pKilledPlayer:GetCivilizationType() == senegalID then
local griotCity = pKilledPlayer:GetCapitalCity()
local griotPoints = 2
griotCity:ChangeSpecialistGreatPersonProgressTimes100(specialistGriotrID, griotPoints*100)
if pKilledPlayer:IsHuman() then
Events.GameplayAlertMessage("Your unit was killed by an enemy. Your capital gains 2 [ICON_GREAT_PEOPLE] Great Griot Points!")
end
end
end
if (IsCivInPlay(senegalID) == true) then
GameEvents.UnitsKilledInCombat.Add(GriotPointsWhenUnitDie)
end
----------------------------------------------------------------------------------------------------------------------------
-- UU: GENDARMERIE
----------------------------------------------------------------------------------------------------------------------------
function GendarmerieBoosts(iPlayer)
local pPlayer = Players[iPlayer]
if pPlayer:GetCivilizationType() == senegal ID then
for pCity in pPlayer:Cities() do
if pCity:GetGarrisonedUnit() == gendarmerieID then
pCity:SetNumRealBuilding(genDummyBID, 1)
else
pCity:SetNumRealBuilding(genDummyBID, 0)
end
end
end
end
GameEvents.PlayerDoTurn.Add(GendarmerieBoosts)
----------------------------------------------------------------------------------------------------------------------------
-- UU: GRIOT
----------------------------------------------------------------------------------------------------------------------------
function GriotBoosts(iPlayer)
local pPlayer = Players[iPlayer]
if pPlayer:GetCivilizationType() == senegal ID then
for pCity in pPlayer:Cities() do
if pCity:GetGarrisonedUnit() == griotID then
pCity:SetNumRealBuilding(griDummyBID, 1)
else
pCity:SetNumRealBuilding(griDummyBID, 0)
end
end
end
end
GameEvents.PlayerDoTurn.Add(GriotBoosts)