unitData.defineCounter("unitRetirementTurn",10000)
unitData.defineCounter("lf1RetirementTurn",10000)
unitData.defineCounter("lf2RetirementTurn",10000)
unitData.defineCounter("lf3RetirementTurn",10000)
unitData.defineCounter("lf4RetirementTurn",10000)
unitData.defineCounter("g1RetirementTurn",10000)
unitData.defineCounter("g2RetirementTurn",10000)
unitData.defineCounter("g3RetirementTurn",10000)
unitData.defineCounter("g4RetirementTurn",10000)
unitData.defineCounter("gladiatorRetirementTurn",10000)
unitData.defineCounter("eruptionRetirementTurn",10000)
unitData.defineCounter("heroRetirementTurn",10000)
discreteEvents.onCityProcessingComplete(function (turn, tribe)
if turn == 120 then
gen.justOnce("EpicPoetryReceivedBy"..tostring(tribe.id),function()
local createdUnits = gen.createUnit(unitAliases.Hero,civ.getCurrentTribe(),{0,0},{count = 1, randomize = false, scatter = false, inCapital = true, veteran = true, homeCity = nil, overrideCanEnter = false, overrideDomain = false, overrideDefender = false})
if createdUnits[1] then
unitData.counterSetValue(createdUnits[1],"heroRetirementTurn",civ.getTurn()+20)
end
if tribe.isHuman then
local dialog = civ.ui.createDialog()
dialog.title = "A Legendary Hero"
dialog.width = 500
dialog:addImage(EpicPoetry)
local multiLineText = "A legendary figure has emerged amongst your people! This hero is\n^devoted to the ideals of your kingdom, yet seeks splendor and glory in\n^far away lands. When this hero's life comes to an end, you are certain\n^many epics will be written of their exploits.\n^\n^^'Be strong, saith my heart;\n^^I am a soldier;\n^^I have seen worse sights than this.'\n^\n^- Homer, The Iliad\n^\n^A Hero unit has been placed in your capital city. This only happens once.\n^Heroes have only 20 turns before they retire. For a full\n^list of what Heroes can do, see the Civliopedia or Readme."
text.addMultiLineTextToDialog(multiLineText,dialog)
dialog:show()
civ.playSound("Druman.wav")
local createdUnits2 = gen.createUnit(unitAliases.Siren,civ.getTribe(0),mythTileOcean1,{count = 1, randomize = false, scatter = false, inCapital = false, veteran = false, homeCity = nil, overrideCanEnter = false, overrideDomain = false, overrideDefender = false})
if createdUnits2[1] then
unitData.counterSetValue(createdUnits2[1],"heroRetirementTurn",civ.getTurn()+20)
end
local createdUnits3 = gen.createUnit(unitAliases.Charybdis,civ.getTribe(0),mythTileOcean2,{count = 1, randomize = false, scatter = false, inCapital = false, veteran = false, homeCity = nil, overrideCanEnter = false, overrideDomain = false, overrideDefender = false})
if createdUnits3[1] then
unitData.counterSetValue(createdUnits3[1],"heroRetirementTurn",civ.getTurn()+20)
end
local createdUnits4 = gen.createUnit(unitAliases.Minotaur,civ.getTribe(0),mythTileMountain,{count = 1, randomize = false, scatter = false, inCapital = false, veteran = false, homeCity = nil, overrideCanEnter = false, overrideDomain = false, overrideDefender = false})
if createdUnits4[1] then
unitData.counterSetValue(createdUnits4[1],"heroRetirementTurn",civ.getTurn()+20)
end
end
for unit in civ.iterateUnits() do
if unit.owner == tribe and unitData.counterGetValue(unit,"heroRetirementTurn") <= turn then
gen.killUnit(unit)
end
end
end)
end
-- Volcano
if math.random() < 0.008 and (civ.getCurrentTribe() == civ.getTribe(0) and turn ~= 1) then
local dialog = civ.ui.createDialog()
dialog.title = "Volcanic Eruption!"
dialog.width = 500
dialog:addImage(VolcanoImage)
local multiLineText = "Rumor has it that a volcano has violently erupted somewhere in the known world.\n^\n^^'The cloud sank down soon afterwards and covered the sea.\n^^I turned around and saw a thick black cloud advancing over the land like a flood.\n^^The darkness spread over us.\n^^But it was not the darkness of a cloudy night,\n^^but was as if the lamps had been put out in a closed room.'\n^\n^- Pliny the Younger"
text.addMultiLineTextToDialog(multiLineText,dialog)
dialog:show()
civ.playSound("Volcano.wav")
local placeEruption = getRandomVolcano()
local createEruption = gen.createUnit(unitAliases.Eruption,civ.getTribe(0),placeEruption,{count = 1, randomize = true, scatter = true, inCapital = false, veteran = true, homeCity = nil, overrideCanEnter = false, overrideDomain = false, overrideDefender = false})
for _,createdUnit in pairs(createEruption) do
unitData.counterSetValue(createdUnit,"eruptionRetirementTurn",civ.getTurn()+2)
end
for unit in civ.iterateUnits() do
if unit.owner == tribe and unitData.counterGetValue(unit,"eruptionRetirementTurn") <= turn then
gen.killUnit(unit)
end
end
end
end)