--DIALOG EVENTS: An attempt at bringing bilateral choice to the MP game
--THE CUBAN MISSILE CRISIS
if turn >=1 and turn <=135 and civ.hasTech(object.tUSSR, civ.getTech(46)) and tribe == object.tUSSR and (object.cHavana.owner == object.tProEast and object.cSantiagoDeCuba.owner == object.tProEast) and diplomacy.peaceTreatyExists(object.tUSSR,object.tUSA) == true then
justOnce("The Cuban Missile Crisis Begins", function()
if object.tUSSR.isHuman then
dialog = civ.ui.createDialog()
dialog.title = "The Cuban Missile Crisis"
dialog.width = 300
dialog:addText("Cuba has asked Soviet Premier ".. tostring(object.tUSSR.leader.name) .." to install nuclear missiles on the island to deter a future invasion by the United States. If we agree, this will all but certainly evoke a strong response from the Americans. What should we do?")
dialog:addOption("Install the missiles!", 1)
dialog:addOption("Refuse Castro. We can't risk nuclear war with the Americans...", 2)
state.cubanMissileCrisisBegins = dialog:show()
else
local probabilityRoll = math.random()
if (probabilityRoll <= 1 and probabilityRoll >=.25) then
state.cubanMissileCrisisBegins = 1
elseif probabilityRoll < .25 then
state.cubanMissileCrisisBegins = 2
end
end
if state.cubanMissileCrisisBegins==1 then
--A state will be set that will trigger American response on their turn after production.
state.CubaMissileCrisisSovietsInstallMissiles = true
dialog = civ.ui.createDialog()
dialog.title = "Agreement to Install the Missiles!"
dialog.width = 300
dialog:addText("Spy agencies everywhere report that preparations are being made to install Soviet missiles in Cuba!")
dialog:show()
end
if state.cubanMissileCrisisBegins==2 then
--The event ends, because the Soviets didn't push the issue, but this has consequences later. It will set a state where Cuba will revert Pro-West.
state.CubaMissileCrisisSovietsRefusedCastro = true
dialog = civ.ui.createDialog()
dialog.title = "Castro is refused!"
dialog.width = 300
dialog:addText("The Soviets have refused to install nuclear missiles on Cuba! Castro is furious, claiming that without Soviet support, it is only a matter of time before he is overthrown!")
dialog:show()
end
end)
end
--The Crisis Continues if the Soviets choose to install the missiles.
if turn >=1 and turn <=135 and tribe == object.tUSA and (object.cHavana.owner == object.tProEast and object.cSantiagoDeCuba.owner == object.tProEast) and diplomacy.peaceTreatyExists(object.tUSSR,object.tUSA) == true and state.CubaMissileCrisisSovietsInstallMissiles == true then
justOnce("The Cuban Missile Crisis Heats Up", function()
if object.tUSA.isHuman then
dialog = civ.ui.createDialog()
dialog.title = "The Cuban Missile Crisis"
dialog.width = 300
dialog:addText("A U-2 spy plane has confirmed the existence of nuclear missile launch sites being prepared in Cuba! This can only mean that the Soviets intend to install nuclear warheads on the island! It is only 90 miles or so from Miami! How shall we respond to this outrage?")
dialog:addOption("Invoke the Monroe Doctrine!", 1)
dialog:addOption("Do nothing. We can't risk nuclear war with the Soviets...", 2)
state.cubanMissileCrisisHeatsUp = dialog:show()
else
local probabilityRoll = math.random()
if (probabilityRoll <= 1 and probabilityRoll >=.25) then
state.cubanMissileCrisisHeatsUp = 1
elseif probabilityRoll < .25 then
state.cubanMissileCrisisHeatsUp = 2
end
end
if state.cubanMissileCrisisHeatsUp==1 then
--A state will be set that will compel the Soviets to respond.
state.CubaMissileCrisisAmericaInvokesMonroeDoctrine = true
dialog = civ.ui.createDialog()
dialog.title = "The Monroe Doctrine!"
dialog.width = 300
dialog:addText("President ".. tostring(object.tUSA.leader.name) .." has responded to the Cuban Missile Crisis by invoking the 'Monroe Doctrine' and declaring that the Soviet installation of nuclear missile batteries is in direct violation of its guidelines! American warships prepare to intercept Soviet freighters carrying nuclear missiles as the world holds its breath!")
dialog:show()
civlua.createUnit(object.uDestroyer, object.tUSA, {{230,80,0},{230,84,0},{232,86,0},{231,85,0}}, {count=1, randomize=false, veteran=false})
civlua.createUnit(object.uDestroyer, object.tUSA, {{231,85,0},{232,86,0},{230,84,0},{230,80,0}}, {count=1, randomize=false, veteran=false})
civlua.createUnit(object.uFreighter, object.tUSSR, {{232,80,0},{232,82,0},{232,84,0}}, {count=1, randomize=false, veteran=false})
end
if state.cubanMissileCrisisHeatsUp==2 then
--A Soviet Military Base is established in Cuba
dialog = civ.ui.createDialog()
dialog.title = "America Backs Down!"
dialog.width = 300
dialog:addText("Fearing a nuclear war, President ".. tostring(object.tUSA.leader.name) .." backs down! The Soviets install a new military base just 90 miles off the coast of Florida, arming it with nuclear missiles!")
dialog:show()
for unit in civ.iterateUnits() do
if unit.owner ~= object.tUSSR and unit.location.x == 225 and unit.location.y == 89 and unit.location.z == 0 then
civ.deleteUnit(unit)
end
end
local newMissileBase = civ.createCity(object.tUSSR,object.lSovietMissileBase)
newMissileBase.name = "Missile Base"
object.lSovietMissileBase.terrainType = 15
civlua.createUnit(object.uSovietInf, object.tUSSR, {{225,89,0}}, {count=6, randomize=false, veteran=true})
civlua.createUnit(object.uMRBM, object.tUSSR, {{225,89,0}}, {count=2, randomize=false, veteran=false})
end
end)
end
--If the Monroe Doctrine is declared, the Soviets have one chance to avoid a war. If they back off, nothing happens. If they push forward, war is declared between the two powers and the base is established.
if turn >=1 and turn <=135 and tribe == object.tUSSR and (object.cHavana.owner == object.tProEast and object.cSantiagoDeCuba.owner == object.tProEast) and diplomacy.peaceTreatyExists(object.tUSSR,object.tUSA) == true and state.CubaMissileCrisisAmericaInvokesMonroeDoctrine == true then
justOnce("Last Chance for Humanity", function()
if object.tUSSR.isHuman then
dialog = civ.ui.createDialog()
dialog.title = "The Cuban Missile Crisis"
dialog.width = 300
dialog:addText("The Americans have invoked an archaic position known as 'The Monroe Doctrine,' claiming that our installation of missile batteries in Cuba would violate their sphere of influence in the western hemisphere. Several American warships have been sighted heading towards our convoy carrying the missiles. If we push forward, there is a serious risk of nuclear war.")
dialog:addOption("Call the Americans bluff! Push forward!", 1)
dialog:addOption("We can't risk a nuclear holocaust. Back down.", 2)
state.cubanMissileCrisisLastChance = dialog:show()
else
local probabilityRoll = math.random()
if probabilityRoll < .25 then
state.cubanMissileCrisisLastChance = 1
elseif probabilityRoll >= .25 then
state.cubanMissileCrisisLastChance = 2
end
end
if state.cubanMissileCrisisLastChance==1 then
--All hell breaks loose. War declared between USSR and USA. Military base established.
dialog = civ.ui.createDialog()
dialog.title = "The world holds its breath!"
dialog.width = 300
dialog:addText("We have refused to back down to President ".. tostring(object.tUSA.leader.name) .."'s demand that we withdraw our missiles from Cuba! There is a very real possibility that this will spark a nuclear war! The world holds its breath!")
dialog:show()
local newMissileBase = civ.createCity(object.tUSSR,object.lSovietMissileBase)
newMissileBase.name = "Missile Base"
object.lSovietMissileBase.terrainType = 15
civlua.createUnit(object.uSovietInf, object.tUSSR, {{225,89,0}}, {count=6, randomize=false, veteran=true})
civlua.createUnit(object.uMRBM, object.tUSSR, {{225,89,0}}, {count=2, randomize=false, veteran=false})
end
if state.cubanMissileCrisisLastChance==2 then
--Crisis averted. Soviets get some minor backdoor concessions.
dialog = civ.ui.createDialog()
dialog.title = "The world is spared!"
dialog.width = 300
dialog:addText("We have come to the brink of war with the Americans, but have managed to avert a disaster... For now. We have agreed to remove our missile base from Cuba in exchange for some concessions from the Americans.")
dialog:show()
object.tUSSR.money = object.tUSSR.money + 300
end
end)
end
--If the Soviets backed down at the very beginning (not the second time) then Cuba reverts to Pro-West
if turn >=1 and turn <=135 and tribe == object.tUSA and state.CubaMissileCrisisSovietsRefusedCastro == true then
justOnce("Castro is Overthrown", function()
dialog = civ.ui.createDialog()
dialog.title = "Castro is Overthrown!"
dialog.width = 300
dialog:addText("The Soviets have refused to support Fidel Castro's grip on Cuba, calling him an unreliable upstart who risks dragging them into a nuclear war with the United States. Without Soviet assistance, he is overthrown by Nationalist forces.")
dialog:show()
for unit in civ.iterateUnits() do
if unit.owner ~= object.tProWest and unit.location.x == object.cHavana.location.x and unit.location.y == object.cHavana.location.y and unit.location.z == object.cHavana.location.z then
civ.deleteUnit(unit)
end
if unit.owner ~= object.tProWest and unit.location.x == object.cSantiagoDeCuba.location.x and unit.location.y == object.cSantiagoDeCuba.location.y and unit.location.z == object.cSantiagoDeCuba.location.z then
civ.deleteUnit(unit)
end
end
object.cHavana.owner = object.tProWest
object.cSantiagoDeCuba.owner = object.tProWest
civlua.createUnit(object.uLatinNat, object.tProWest, {{228,88,0}}, {count=5, randomize=false, veteran=true})
civlua.createUnit(object.uLatinNat, object.tProWest, {{227,91,0}}, {count=5, randomize=false, veteran=true})
civlua.createUnit(object.uMiG15, object.tProWest, {{228,88,0}}, {count=2, randomize=false, veteran=true})
civlua.createUnit(object.uMiG15, object.tProWest, {{227,91,0}}, {count=2, randomize=false, veteran=true})
end)
end