# Tlemcen #

# Events copied from AGCEEP in FTG 1.3 to make it likely that Algeria (ALD) appears

#(1511-1523) Arudj and Khayr al-Din Barbarossa
event = {
	id = 51024
	trigger = {
		NOT = {
			event = 51025
			exists = ALD
		}
		OR = {
			event = 50024 # TUR: The Barbarossas (Tunisia)
			event = 50025 # TUR: The Barbarossas (No Tunisia)
		}
	}
	random = no
	country = TLE
	name = "EVENTNAME51024" #Arudj and Khayr al-Din Barbarossa
	desc = "EVENTHIST51024"

	date = { day = 1 month = november year = 1511 }
	offset = 30
	deathdate = { day = 1 month = january year = 1523 }

	action_a = {
		name = "ACTIONNAME51024A" #Curse them!
		command = { type = revolt which = 737 } #Al Djazair
		command = { type = revolt which = 737 } #Al Djazair
		command = { type = revolt which = 738 } #Kabylia
		command = { type = revolt which = 738 } #Kabylia
		command = { type = revolt which = -1 }
		command = { type = province_revoltrisk which = 738 value = 8 } #Kabylia
		command = { type = province_revoltrisk which = 737 value = 8 } #Al Djazair
		command = { type = revoltrisk which = 100 value = 6 }
	}
	action_b = {
		name = "ACTIONNAME51024B" #We shall ready our last defenses
		command = { type = revolt which = 737 } #Al Djazair
		command = { type = revolt which = 737 } #Al Djazair
		command = { type = revolt which = 738 } #Kabylia
		command = { type = revolt which = 738 } #Kabylia
		command = { type = province_revoltrisk which = 738 value = 8 } #Kabylia
		command = { type = province_revoltrisk which = 737 value = 8 } #Al Djazair
		command = { type = inf which = -2 value = 5000 }
		command = { type = inf which = -1 value = 5000 }
		command = { type = treasury value = -300 }
		command = { type = revoltrisk which = 100 value = 8 }
	}
	action_c = {
		name = "ACTIONNAME51024C" #We submit to their power
		command = { type = flagname which = "" }
		command = { type = remove_countryculture which = berber }
		command = { type = addcore_national which = 738 } #Kabylia
		command = { type = country which = ALD }
		command = { type = capital which = 737 } #Al Djazair
		command = { type = revoltrisk which = 120 value = 5 }
		command = { type = revolt which = -1 }
		command = { type = revolt which = -1 }
		command = { type = revolt which = -1 }
	}
}

#(1511-1523) Arudj and Khayr al-Din Barbarossa
event = {
	id = 51025
	trigger = {
		NOT = {
			event = 51024
			exists = ALD
		}
		OR = {
			event = 50024 # TUR: The Barbarossas (Tunisia)
			event = 50025 # TUR: The Barbarossas (No Tunisia)
		}
	}
	random = no
	country = TLE
	name = "EVENTNAME51025" #Arudj and Khayr al-Din Barbarossa
	desc = "EVENTHIST51025"

	date = { day = 2 month = november year = 1511 }
	offset = 30
	deathdate = { day = 1 month = january year = 1523 }

	action_a = {
		name = "ACTIONNAME51025A" #Curse them!
		command = { type = revolt which = 737 } #Al Djazair
		command = { type = revolt which = 738 } #Kabylia
		command = { type = revolt which = -1 }
		command = { type = revolt which = -1 }
		command = { type = province_revoltrisk which = 738 value = 8 } #Kabylia
		command = { type = province_revoltrisk which = 737 value = 8 } #Al Djazair
	}
	action_b = {
		name = "ACTIONNAME51025B" #We shall ready our last defenses
		command = { type = revolt which = 737 } #Al Djazair
		command = { type = revolt which = 738 } #Kabylia
		command = { type = province_revoltrisk which = 738 value = 8 } #Kabylia
		command = { type = province_revoltrisk which = 737 value = 8 } #Al Djazair
		command = { type = revolt which = -1 }
		command = { type = revolt which = -1 }
		command = { type = revolt which = -1 }
		command = { type = inf which = -2 value = 5000 }
		command = { type = inf which = -1 value = 5000 }
		command = { type = treasury value = -150 }
	}
	action_c = {
		name = "ACTIONNAME51025C" #We submit to their power
		command = { type = flagname which = "" }
		command = { type = remove_countryculture which = berber }
		command = { type = addcore_national which = 738 } #Kabylia
		command = { type = country which = ALD }
		command = { type = capital which = 737 } #Al Djazair
		command = { type = revoltrisk which = 120 value = 5 }
		command = { type = revolt which = -1 }
		command = { type = revolt which = -1 }
		command = { type = revolt which = -1 }
	}
}

#(1511-1530) The Barbarossas take Algiers
event = {
	id = 332000
	trigger = {
		control = { province = 737 data = REB }
		control = { province = 738 data = REB }
		OR = {
			event = 51024
			event = 50025 # TUR: The Barbarossas (No Tunisia)
		}
	}
	random = no
	country = TLE
	name = "EVENTNAME332000" #The Barbarossas take Algiers
	desc = "EVENTHIST332000"

	date = { day = 1 month = november year = 1511 }
	offset = 30
	deathdate = { day = 1 month = january year = 1530 }

	action_a = {
		name = "ACTIONNAME332000A" #How horrid!
		command = { type = free which = ALD }
		#command = { type = trigger which = 105000 } #ALD: Emergence of Algiers (not in vanilla)
		command = { type = removecore_national which = 736 } #Aures
		command = { type = removecore_national which = 737 } #Al Djazair
		command = { type = removecore_national which = 738 } #Kabylia
	}
}

#Moor Refugees from Al-Andalus#
event = {

	id = 3652					#Triggered by SPA3150#
	random = no
	country = TLE
	name = "EVENTNAME3652"
	desc = "EVENTHIST3652"

	action_a ={					#Al-Andalus has fallen#
		name = "ACTIONNAME3652A"
		command = { type = populationpercent which = -1 value = 10 }
		command = { type = populationpercent which = -4 value = 10 }
		command = { type = relation which = GRA value = 150 }
		command = { type = relation which = MOR value = 100 }
		command = { type = relation which = FEZ value = 100 }
		command = { type = relation which = SPA value = -100 }
		command = { type = trade value = 800 }
		command = { type = land value = 800 }
		command = { type = treasury value = 500 }
		command = { type = inflation value = -2 }
	}
}

#Moor Exodus from Al-Andalus#
event = {

	id = 3729					#Triggered by SPA3150#
	random = no
	country = TLE
	name = "EVENTNAME3729"
	desc = "EVENTHIST3729"

	action_a ={					#This means Holy War#
		name = "ACTIONNAME3729A"
		command = { type = populationpercent which = -1 value = 15 }
		command = { type = populationpercent which = -4 value = 15 }
		command = { type = relation which = GRA value = 180 }
		command = { type = relation which = MOR value = 150 }
		command = { type = relation which = FEZ value = 150 }
		command = { type = relation which = SPA value = -150 }
		command = { type = trade value = 1200 }
		command = { type = land value = 1200 }
		command = { type = treasury value = 700 }
		command = { type = stability value = 1 }
		command = { type = casusbelli which = SPA value = 36 }
		command = { type = dynastic which = MOR }
		command = { type = dynastic which = GRA }
	}

	action_b ={					#Unfortenantely our hands are bound#
		name = "ACTIONNAME3729B"
		command = { type = populationpercent which = -1 value = 10 }
		command = { type = populationpercent which = -4 value = 10 }
		command = { type = relation which = GRA value = -50 }
		command = { type = relation which = MOR value = -50 }
		command = { type = relation which = FEZ value = -50 }
		command = { type = relation which = SPA value = -50 }
		command = { type = trade value = 1200 }
		command = { type = land value = 1200 }
		command = { type = treasury value = 700 }
		command = { type = stability value = -2 }
		command = { type = inflation value = -3 }
	}
}
