--------------------------------------------------------------------------------------------------------------------------
-- An Account of Corsica
--------------------------------------------------------------------------------------------------------------------------
local Event_AccountOfCorsica = {}
Event_AccountOfCorsica.Name = "TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA"
Event_AccountOfCorsica.Desc = "TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA_DESC"
Event_AccountOfCorsica.Weight = 20
Event_AccountOfCorsica.CanFunc = (
function(pPlayer)
[COLOR="Lime"]if load(pPlayer, "Event_AccountOfCorsica") == true then return false end[/COLOR]
if pPlayer:GetCivilizationType() ~= GameInfoTypes["CIVILIZATION_DMS_CORSICA"] then return false end
local iGoldCost = math.ceil(600 * iMod)
if pPlayer:GetGold() < iGoldCost then return false end
if pPlayer:GetCurrentEra() < GameInfoTypes["ERA_RENAISSANCE"] then return false end
Event_AccountOfCorsica.Desc = Locale.ConvertTextKey("TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA_DESC", iGoldCost)
return true
end
)
Event_AccountOfCorsica.Outcomes = {}
--=========================================================
-- Outcome 1
--=========================================================
Event_AccountOfCorsica.Outcomes[1] = {}
Event_AccountOfCorsica.Outcomes[1].Name = "TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA_OUTCOME_1"
Event_AccountOfCorsica.Outcomes[1].Desc = "TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA_OUTCOME_RESULT_1"
Event_AccountOfCorsica.Outcomes[1].Weight = 15
Event_AccountOfCorsica.Outcomes[1].CanFunc = (
function(pPlayer)
local iGoldCost = math.ceil(600 * iMod)
Event_AccountOfCorsica.Outcomes[1].Desc = Locale.ConvertTextKey("TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA_OUTCOME_RESULT_1", iGoldCost)
return true
end
)
Event_AccountOfCorsica.Outcomes[1].DoFunc = (
function(pPlayer)
local iGoldCost = math.ceil(600 * iMod)
pPlayer:ChangeGold(-iGoldCost)
pPlayer:InitUnit(GameInfoTypes["UNIT_CORSICA_WRITER_BOSWELL"], pPlayer:GetCapitalCity():GetX(), pPlayer:GetCapitalCity():GetY())
[COLOR="lime"]save(pPlayer, "Event_AccountOfCorsica", true)[/COLOR]
-- save(pPlayer, "Event_AccountOfCorsica", false) -- for testing
JFD_SendNotification(pPlayer:GetID(), "NOTIFICATION_GENERIC", Locale.ConvertTextKey("TXT_KEY_AN_ACCOUNT_OF_CORSICA_OUTCOME_RESULT_1_NOTIFICATION"), Locale.ConvertTextKey("TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA"))
end
)
--=========================================================
-- Outcome 2
--=========================================================
Event_AccountOfCorsica.Outcomes[2] = {}
Event_AccountOfCorsica.Outcomes[2].Name = "TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA_OUTCOME_2"
Event_AccountOfCorsica.Outcomes[2].Desc = "TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA_OUTCOME_RESULT_2"
Event_AccountOfCorsica.Outcomes[2].Weight = 5
Event_AccountOfCorsica.Outcomes[2].CanFunc = (
function(pPlayer)
Event_AccountOfCorsica.Outcomes[2].Desc = Locale.ConvertTextKey("TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA_OUTCOME_RESULT_2")
return true
end
)
Event_AccountOfCorsica.Outcomes[2].DoFunc = (
function(pPlayer)
-- nothing
[COLOR="lime"]save(pPlayer, "Event_AccountOfCorsica", true)[/COLOR]
-- save(pPlayer, "Event_AccountOfCorsica", false) -- for testing
JFD_SendNotification(pPlayer:GetID(), "NOTIFICATION_GENERIC", Locale.ConvertTextKey("TXT_KEY_AN_ACCOUNT_OF_CORSICA_OUTCOME_RESULT_2_NOTIFICATION"), Locale.ConvertTextKey("TXT_KEY_EVENT_AN_ACCOUNT_OF_CORSICA"))
end
)
Events_AddCivilisationSpecific(GameInfoTypes["CIVILIZATION_DMS_CORSICA"], "Event_AccountOfCorsica", Event_AccountOfCorsica)