#Tunis (TUN)

#See AGCEEP_Alt_Iberia.txt for Alternative events involving Portugal

#-----------------------------------------------------------------------------------------------
#(1419-1574) Hafsid Dynasty Flag
#by YodaMaster
event = {
	id = 300006
	trigger = { NOT = { flag = [TUN_Hafsids] } }
	random = no
	country = TUN
	name = "EVENTNAME300006" #The Hafsid Emir
	desc = "EVENTHIST300006"
	#-#A large revolt has finally chased out the tyrant and the independence has been definitively gained. The Hafsid dynasty is back on the throne.

	date = { day = 0 month = january year = 1419 }
	offset = 1
	deathdate = { day = 0 month = january year = 1434 }

	action_a = {
		name = "GOOD"
		command = { type = setflag which = [TUN_Hafsids] }
		command = { type = flagname which = "Hafsids" }
		command = { type = treasury value = 50 }
		command = { type = INF which = 739 value = 2000 } #Tunisia
	}
}
event = {
	id = 300007
	trigger = { NOT = { flag = [TUN_Hafsids] } }
	random = no
	country = TUN
	name = "EVENTNAME300006" #The Hafsid Emir
	desc = "EVENTHIST300006"
	#-#A large revolt has finally chased out the tyrant and the independence has been definitively gained. The Hafsid dynasty is back on the throne.

	date = { day = 0 month = january year = 1434 }
	offset = 1
	deathdate = { day = 0 month = january year = 1454 }

	action_a = {
		name = "GOOD"
		command = { type = setflag which = [TUN_Hafsids] }
		command = { type = flagname which = "Hafsids" }
		command = { type = treasury value = 50 }
		command = { type = INF which = 739 value = 2000 } #Tunisia
	}
}
event = {
	id = 300008
	trigger = { NOT = { flag = [TUN_Hafsids] } }
	random = no
	country = TUN
	name = "EVENTNAME300006" #The Hafsid Emir
	desc = "EVENTHIST300006"
	#-#A large revolt has finally chased out the tyrant and the independence has been definitively gained. The Hafsid dynasty is back on the throne.

	date = { day = 0 month = january year = 1454 }
	offset = 1
	deathdate = { day = 0 month = january year = 1474 }

	action_a = {
		name = "GOOD"
		command = { type = setflag which = [TUN_Hafsids] }
		command = { type = flagname which = "Hafsids" }
		command = { type = treasury value = 50 }
		command = { type = INF which = 739 value = 2000 } #Tunisia
	}
}
event = {
	id = 300009
	trigger = { NOT = { flag = [TUN_Hafsids] } }
	random = no
	country = TUN
	name = "EVENTNAME300006" #The Hafsid Emir
	desc = "EVENTHIST300006"
	#-#A large revolt has finally chased out the tyrant and the independence has been definitively gained. The Hafsid dynasty is back on the throne.

	date = { day = 0 month = january year = 1474 }
	offset = 1
	deathdate = { day = 0 month = january year = 1494 }

	action_a = {
		name = "GOOD"
		command = { type = setflag which = [TUN_Hafsids] }
		command = { type = flagname which = "Hafsids" }
		command = { type = treasury value = 50 }
		command = { type = INF which = 739 value = 2000 } #Tunisia
	}
}
event = {
	id = 300010
	trigger = { NOT = { flag = [TUN_Hafsids] } }
	random = no
	country = TUN
	name = "EVENTNAME300006" #The Hafsid Emir
	desc = "EVENTHIST300006"
	#-#A large revolt has finally chased out the tyrant and the independence has been definitively gained. The Hafsid dynasty is back on the throne.

	date = { day = 0 month = january year = 1494 }
	offset = 1
	deathdate = { day = 0 month = january year = 1514 }

	action_a = {
		name = "GOOD"
		command = { type = setflag which = [TUN_Hafsids] }
		command = { type = flagname which = "Hafsids" }
		command = { type = treasury value = 50 }
		command = { type = INF which = 739 value = 2000 } #Tunisia
	}
}
event = {
	id = 300011
	trigger = { NOT = { flag = [TUN_Hafsids] } }
	random = no
	country = TUN
	name = "EVENTNAME300006" #The Hafsid Emir
	desc = "EVENTHIST300006"
	#-#A large revolt has finally chased out the tyrant and the independence has been definitively gained. The Hafsid dynasty is back on the throne.

	date = { day = 0 month = january year = 1514 }
	offset = 1
	deathdate = { day = 0 month = january year = 1534 }

	action_a = {
		name = "GOOD"
		command = { type = setflag which = [TUN_Hafsids] }
		command = { type = flagname which = "Hafsids" }
		command = { type = treasury value = 50 }
		command = { type = INF which = 739 value = 2000 } #Tunisia
	}
}
event = {
	id = 300012
	trigger = { NOT = { flag = [TUN_Hafsids] } }
	random = no
	country = TUN
	name = "EVENTNAME300006" #The Hafsid Emir
	desc = "EVENTHIST300006"
	#-#A large revolt has finally chased out the tyrant and the independence has been definitively gained. The Hafsid dynasty is back on the throne.

	date = { day = 0 month = january year = 1534 }
	offset = 1
	deathdate = { day = 0 month = january year = 1554 }

	action_a = {
		name = "GOOD"
		command = { type = setflag which = [TUN_Hafsids] }
		command = { type = flagname which = "Hafsids" }
		command = { type = treasury value = 50 }
		command = { type = INF which = 739 value = 2000 } #Tunisia
	}
}
event = {
	id = 300013
	trigger = { NOT = { flag = [TUN_Hafsids] } }
	random = no
	country = TUN
	name = "EVENTNAME300006" #The Hafsid Emir
	desc = "EVENTHIST300006"
	#-#A large revolt has finally chased out the tyrant and the independence has been definitively gained. The Hafsid dynasty is back on the throne.

	date = { day = 0 month = january year = 1554 }
	offset = 1
	deathdate = { day = 0 month = january year = 1574 }

	action_a = {
		name = "GOOD"
		command = { type = setflag which = [TUN_Hafsids] }
		command = { type = flagname which = "Hafsids" }
		command = { type = treasury value = 50 }
		command = { type = INF which = 739 value = 2000 } #Tunisia
	}
}
event = {
	id = 300014
	trigger = { flag = [TUN_Hafsids] }
	random = no
	country = TUN
	name = "EVENTNAME300014" #The End of the Hafsid Dynasty
	desc = "EVENTHIST300014"
	#-#The last Hafsid Emir is gone...

	date = { day = 0 month = january year = 1574 }
	offset = 1
	deathdate = { year = 1820 }

	action_a = {
		name = "ACTIONNAME300014A" #Sad news?
		command = { type = clrflag which = [TUN_Hafsids] }
		command = { type = flagname which = "" }
		#in order to avoid TUN_300013 firing after this event even with right deathdate:
		command = { type = sleepevent which = 300013 } #TUN: The Hafsid Emir
		command = { }
	}
}
#-----------------------------------------------------------------------------------------------

#(1424) Tlemcen submits
#by Fodoron
event = {
	id = 300002 #triggered by TLE_332006 A
	random = no
	country = TUN
	name = "EVENTNAME300002" #Tlemcen submits
	desc = "EVENTHIST300002"
	#-#Once the Marinid power declined in Morocco, Tunis became a powerful Kingdom under the Hafsid dynasty. Taking advantage of the weakness of her neighbor, in 1424 Abu Faris Abd al-Aziz invaded Tlemcen, and after dethroning Abu Malik Abd al-Wahid, substituted him with Abu Abd Allah Muhammad, as his vassal.

	action_a = {
		name = "ACTIONNAME300002A" #We rule
		command = { type = stability value = 1 }
		command = { type = vassal which = TLE }
	}
}
#(1424) Tlemcen resists
#by Fodoron
event = {
	id = 300003 #triggered by TLE_332006 B
	random = no
	country = TUN
	name = "EVENTNAME300003" #Tlemcen resists
	desc = "EVENTHIST300002"
	#-#Once the Marinid power declined in Morocco, Tunis became a powerful Kingdom under the Hafsid dynasty. Taking advantage of the weakness of her neighbor, in 1424 Abu Faris Abd al-Aziz invaded Tlemcen, and after dethroning Abu Malik Abd al-Wahid, substituted him with Abu Abd Allah Muhammad, as his vassal.

	action_a = {
		name = "ACTIONNAME300003A" #Crush them
		command = { type = relation which = TLE value = -50 }
		command = { type = casusbelli which = TLE value = 48 }
	}
}

#(1435) Abu Amr Uthman comes to rule
event = {
	id = 51026
	random = no
	country = TUN
	name = "EVENTNAME51026" #Abu Amr Uthman comes to rule
	desc = "EVENTHIST51026"
	#-#During the rule of Abu Amr Uthman, the Hafsid state emerged as the preeminent power in North Africa. The Zayyanids became little more than vassals, and the Wattasids of Morocco even recognized Hafsid suzerainty.

	date = { day = 1 month = january year = 1435 }
	offset = 20
	deathdate = { day = 29 month = december year = 1435 }

	action_a = {
		name = "ACTIONNAME51026A" #The Hafsid dynasty ascends!
		command = { type = diplomats value = 2 }
		command = { type = inflation value = -5 }
		command = { type = infra value = 50 }
		command = { type = dynastic which = MOR }
		command = { type = relation which = TLE value = 50 }
		command = { type = relation which = MOR value = 75 }
		command = { type = setflag which = [tlemcen] }
	}
}

#(1466-1475) Tlemcen submits
#by Fodoron
event = {
	id = 300004 #triggered by TLE_332008 A
	random = no
	country = TUN
	name = "EVENTNAME300002" #Tlemcen submits
	desc = "EVENTHIST300002"
	#-#Once the Marinid power declined in Morocco, Tunis became a powerful Kingdom under the Hafsid dynasty. Taking advantage of the weakness of her neighbor, in 1424 Abu Faris Abd al-Aziz invaded Tlemcen, and after dethroning Abu Malik Abd al-Wahid, substituted him with Abu Abd Allah Muhammad, as his vassal.

	action_a = {
		name = "ACTIONNAME300002A" #We rule
		command = { type = stability value = 1 }
		command = { type = vassal which = TLE }
	}
}
#(1466-1475) Tlemcen resists
#by Fodoron
event = {
	id = 300005 #triggered by TLE 332008 B
	random = no
	country = TUN
	name = "EVENTNAME300003" #Tlemcen resists
	desc = "EVENTHIST300002"
	#-#Once the Marinid power declined in Morocco, Tunis became a powerful Kingdom under the Hafsid dynasty. Taking advantage of the weakness of her neighbor, in 1424 Abu Faris Abd al-Aziz invaded Tlemcen, and after dethroning Abu Malik Abd al-Wahid, substituted him with Abu Abd Allah Muhammad, as his vassal.

	action_a = {
		name = "ACTIONNAME300003A" #Crush them
		command = { type = relation which = TLE value = -50 }
		command = { type = casusbelli which = TLE value = 48 }
	}
}

#(1488) Death of Abu Amr Uthman
#modified by Garbon
event = {
	id = 51027
	random = no
	country = TUN
	name = "EVENTNAME51027" #Death of Abu Amr Uthman
	desc = "EVENTHIST51027"
	#-#Upon his death, Hafsid authority crumbled. The royal family grew to bickering and eventually fueding that damage the position of the Hafisd dynasty. Clearly, the golden age of the Hafsid dynasty was over. No longer could the sultan of Tunis exercise control over the Zayyanids and Tripoli.

	date = { day = 1 month = january year = 1488 }
	offset = 20
	deathdate = { day = 29 month = december year = 1488 }

	action_a = {
		name = "ACTIONNAME51027A" #The Hafsid dynasty descends!
		command = { type = cedeprovince which = TLE value = 737 } #Al Djazair
		command = { type = diplomats value = -2 }
		command = { type = infra value = -50 }
		command = { type = breakvassal which = TLE }
		command = { type = independence which = TRI }
		command = { type = revolt which = 738 } #Kabylia
		command = { type = revolt which = 740 } #Tripolitania
		command = { type = relation which = TLE value = -25 }
		command = { type = relation which = MOR value = -50 }
		command = { type = stability value = -2 }
		command = { type = revoltrisk which = 72 value = 14 }
		command = { type = trigger which = 51028 } #TRI: Independence of Tripoli
		command = { type = clrflag which = [tlemcen] }
	}
	action_b = {
		name = "ACTIONNAME51027B" #We shall never give up!
		command = { type = breakvassal which = TLE }
		command = { type = relation which = TLE value = -100 }
		command = { type = relation which = MOR value = -100 }
		command = { type = stability value = -4 }
		command = { type = revolt which = 738 } #Kabylia
		command = { type = revolt which = 738 } #Kabylia
		command = { type = revolt which = 740 } #Tripolitania
		command = { type = revolt which = 740 } #Tripolitania
		command = { type = revoltrisk which = 72 value = 15 }
	}
}

#(1492-1550) The Moriscos Request Aid
event = {
	id = 300000
	trigger = {
		event = 301000 #TUR: Recognition of the Moriscos
		exists = SPA
		NOT = { exists = GRA }
	}
	random = no
	country = TUN
	name = "EVENTNAME300000" #The Moriscos Request Aid
	desc = "EVENTHIST300000"
	#-#Prior to its fall, the Muslim Kingdom of Granada routinely asked its Muslim brothers for support. After its fall, many Moriscos still held out hope that the Ottoman Empire would liberate them. However, surely, the Moriscos would not have become agitated had the sultan of Tunis came to their aid.

	date = { day = 1 month = january year = 1492 }
	offset = 1800
	deathdate = { day = 29 month = december year = 1550 }

	action_a = {
		name = "ACTIONNAME300000A" #We have other concerns
		command = { type = merchants value = 1 }
		command = { type = diplomats value = 1 }
	}
	action_b = {
		name = "ACTIONNAME300000B" #We must help them!
		command = { type = cav which = -1 value = 150 }
		command = { type = warships which = 739 value = 2 } #Tunisia
		command = { type = stability value = -2 }
		command = { type = casusbelli which = SPA value = 24 }
		command = { type = manpower value = 5 }
	}
}

#(1509-1520) The Barbarossas
event = {
	id = 51023 #triggered by TUR_50024 A/B
	random = no
	country = TUN
	name = "EVENTNAME51023" #The Barbarossas
	desc = "EVENTHIST51023"
	#-#In the 16th century, Spain occupied various ports in North Africa. Algiers was blockaded and forced to pay tribute. Other ports were captured outright. The desperate Muslims called for help from the Ottoman sultan, then the caliph of all Islam. Two corsair brothers, the Barbarossas petitioned the sultan to send them with a fleet to North Africa. The brothers planned to use the city of Tunis as a launching point for piracy operations and attacks on Algiers. To convince the sultan of Tunisia, they gifted him with sumptuous presents.

	action_a = {
		name = "ACTIONNAME51023A" #Let them use Tunis as a base of operations
		command = { type = sleepevent which = 51025 } #TLE: Arudj and Khayr al-Din Barbarossa
		command = { type = treasury value = 75 }
	}
	action_b = {
		name = "ACTIONNAME51023B" #We feel like laughing
		command = { type = sleepevent which = 51024 } #TLE: Arudj and Khayr al-Din Barbarossa
	}
}

#(1527-1572) Tunis under attack from Barbarossa
#by Fodoron
event = {
	id = 300001 #triggered by ALD_105001 A
	random = no
	country = TUN
	name = "EVENTNAME300001" #Tunis under attack from Barbarossa
	desc = "EVENTHIST300001"
	#-#Under the rule of Khayr ad-Din Barbarossa, Al-Djazaîr accepted the overlordship of the Ottoman empire and continued the fight against the Spaniards, the Hafsids of Tunis and the Zayyanids of Tlemcen. He conquered Tunis in 1534. The deposed Hafsid pasha, al-Hassan, asked for help from Carlos of Spain, who sent a powerful fleet and recaptured Tunis, restoring al-Hassan as his vassal.

	action_a = {
		name = "ACTIONNAME300001A" #Request help from Spain
		command = { type = treasury value = 50 }
		command = { type = stability value = -1 }
		command = { type = trigger which = 285128 } #SPA: The Pasha of Tunis requests our help
		command = { type = trigger which = 111044 } #ARG: The Pasha of Tunis requests our help
		command = { type = trigger which = 260911 } #POR: The Pasha of Tunis requests our help
		command = { type = relation which = TUR value = -50 }
		command = { type = breakvassal which = TUR }
		command = { type = breakvassal which = MAM }
	}
	action_b = {
		name = "ACTIONNAME300001B" #Better death than submission to a Christian
		command = { type = stability value = 1 }
	}
}

#(1703-1710) The Tunisian Rebellion
event = {
	id = 300015 #triggered by TUR_3391 A
	random = no
	country = TUN
	name = "EVENTNAME3391" #The Tunisian Rebellion
	desc = "EVENTHIST3391"
	#-#In the first decades of the 18th century the Beys and Deys (Janissary leaders) of Northern Africa were in a rebellious mood in the wake of the Peace of Carlowitz between the Ottoman Empire and the Holy League. In 1705, Hussein bin Ali Agha of Cretan origin staged a coup and founded the Husseinic dynasty which ruled Tunisia until 1957. Tunisia did not become truly autonomous at once, but it gained a large measure of independence.

	action_a = {
		name = "GOOD"
		command = { type = relation which = TUR value = -100 }
		command = { type = breakvassal which = TUR }
	}
}

#-----------------------------------------------------------------------------------------------

#First free id: 300016
