﻿je_stand_free_stand_together = {
	icon = "gfx/interface/icons/event_icons/event_map.dds"
	
	group = je_group_historical_content
	
	immediate = {
		set_variable = {
			name = show_stand_free_stand_together_var
			value = yes
		}
	}

	scripted_button = laristan_payment_button
	scripted_button = ally_with_khiva_button
	scripted_button = unite_afghanistan_button
	scripted_button = unite_baluchistan_button
	scripted_button = unite_transcaucasia_button
	
	scripted_button = council_of_tehran_button
	scripted_button = total_recognition_button
	
	complete = {
		scope:journal_entry = {
			is_goal_complete = yes
			}
	}

	on_complete = {
		trigger_event = {
			id = 02_persia_events.13
		}
		set_variable = {
		name = stand_free_stand_together_complete_var
		value = yes
		}
		custom_tooltip = {
		text = grand_alliance_tt
		set_global_variable = grand_alliance_var
				}
	}

	current_value = {
		value = var:stand_free_stand_together_var
	}

	goal_add_value = {
		add = 5
		}

	progressbar = yes

	weight = 10000
	
	should_be_pinned_by_default = yes
}

je_laristan_payment = {
	icon = "gfx/interface/icons/event_icons/event_map.dds"
	
	group = je_group_historical_content
	
	on_monthly_pulse = {
		effect = {
			change_variable = {
				name = oman_payment_var
				add = 1
			}
		}
	}

	complete = {
		scope:journal_entry = { is_goal_complete = yes }
	}

	on_complete = {		
		trigger_event = { id = 02_persia_events.5 }
	}

	current_value = {
		value = root.var:oman_payment_var
	}

	goal_add_value = {
		value = 24
	}

	progressbar = yes

	weight = 10

	should_be_pinned_by_default = yes
}

je_baluchistan_navy = {
	icon = "gfx/interface/icons/event_icons/event_portrait.dds"

	group = je_group_historical_content
	
	immediate = {
		set_variable = {
			name = baluchistan_navy_var
			value = 0
		}	
		s:STATE_BALUCHISTAN.region_state:BLH = {
			save_scope_as = baluchi_state
		}
	}
	
		on_monthly_pulse = {
		effect = {
			
				change_variable = {
					name = baluchistan_navy_var
					add = 1
				}
			}
		}
	
	
	complete = {
		scope:journal_entry = {
			is_goal_complete = yes
			}			
	}

	on_complete = {
	scope:baluchi_state = {
			create_building={
 				building="building_naval_base"
 				level=20
 				reserves=1
 			}
		}
	scope:baluchi_state = {
			create_building={
 				building="building_university"
 				level=1
 				reserves=1
 			}
		}
	}

	current_value = {
		value = var:baluchistan_navy_var
	}

	goal_add_value = {
		add = 12
		}

	progressbar = yes

	weight = 10

	should_be_pinned_by_default = yes
}

je_baluchistan_ports = {
	icon = "gfx/interface/icons/event_icons/event_portrait.dds"

	group = je_group_historical_content
	
	immediate = {
		set_variable = {
			name = baluchistan_ports_var
			value = 0
		}
	s:STATE_BALUCHISTAN.region_state:BLH = {
			save_scope_as = baluchi_state
		}
	}
	
		on_monthly_pulse = {
		effect = {
			
				change_variable = {
					name = baluchistan_ports_var
					add = 1
				}
			}
		}
	
	
	complete = {
		scope:journal_entry = {
			is_goal_complete = yes
			}			
	}

	on_complete = {
	scope:baluchi_state = {
			create_building={
 				building="building_port"
 				level=4
 				reserves=1
 			}
		}
	}

	current_value = {
		value = var:baluchistan_ports_var
	}

	goal_add_value = {
		add = 12
		}

	progressbar = yes
	

	weight = 10

	should_be_pinned_by_default = yes
}

je_transcaucasia_navy = {
	icon = "gfx/interface/icons/event_icons/event_portrait.dds"

	group = je_group_historical_content
	
	immediate = {
		set_variable = {
			name = transcaucasia_navy_var
			value = 0
		}	
		s:STATE_GREATER_CAUCASUS.region_state:CAU = {
			save_scope_as = caucas_state
		}
	}
	
		on_monthly_pulse = {
		effect = {
			
				change_variable = {
					name = transcaucasia_navy_var
					add = 1
				}
			}
		}
	
	
	complete = {
		scope:journal_entry = {
			is_goal_complete = yes
			}			
	}

	on_complete = {
	scope:caucas_state = {
			create_building={
 				building="building_naval_base"
 				level=20
 				reserves=1
 			}
		}
	scope:caucas_state = {
			create_building={
 				building="building_university"
 				level=1
 				reserves=1
 			}
		}
	}

	current_value = {
		value = var:transcaucasia_navy_var
	}

	goal_add_value = {
		add = 12
		}

	progressbar = yes
	

	weight = 10

	should_be_pinned_by_default = yes
}

je_the_crescent = {
	icon = "gfx/interface/icons/event_icons/event_map.dds"

	group = je_group_historical_content

	complete = {
		has_technology_researched = academia
		has_technology_researched = mass_communication
		has_building = building_university
	    is_power_bloc_leader = yes
	}

	
	on_complete = {
	custom_tooltip = je_stand_free_stand_together_advance
		trigger_event = { id = 02_persia_events.400 popup = yes }		
			add_journal_entry = {
		type = je_the_crescent_takes_root
		}			
						#custom_tooltip = {
			#text = crescent_unrest_tt
			#}		
					#set_variable = {
		#name = name_the_crescent_var
		#value = yes		
			#}
						change_variable = {
			name = stand_free_stand_together_var
			add = 1
		}									
		
			add_modifier = {
			name = the_crescent_leader_modifier
					}
					
		
	}
		
		
	weight = 100
	
	should_be_pinned_by_default = yes
}

je_the_crescent_takes_root = {
	icon = "gfx/interface/icons/event_icons/event_map.dds"
	
	group = je_group_historical_content
	
	
	complete = {
		has_technology_researched = nationalism
	}

	
	on_complete = {
		trigger_event = { id = 02_persia_events.4 popup = yes }		
		add_journal_entry = {
		type = je_crescent_values
		}
		add_journal_entry = {
		type = je_free_the_crescent
		}
		hidden_effect = {
		add_journal_entry = {
		type = je_free_iraq
		}
		add_journal_entry = {
		type = je_free_syria
		}
		add_journal_entry = {
		type = je_arabian_dream
		}
	}
						custom_tooltip = {
			text = crescent_unrest_tt
			}		
					set_variable = {
		name = name_the_crescent_var
		value = yes		
			}
									
				
	}
		
		
	weight = 100

	should_be_pinned_by_default = yes
}


je_crescent_values = {
	icon = "gfx/interface/icons/event_icons/event_map.dds"
	
	group = je_group_historical_content
	
	complete = {				
		has_law = law_type:law_slavery_banned
		has_law = law_type:law_cultural_exclusion
		has_law = law_type:law_no_tax
		NOT = {
		has_law = law_type:law_state_religion
		}
	}

	
	on_complete = {
	custom_tooltip = je_stand_free_stand_together_advance
		trigger_event = { id = 02_persia_events.17 popup = yes }			
												
							
	}			
	
	weight = 100
	
	should_be_pinned_by_default = yes
}

je_arabian_dream = {
	icon = "gfx/interface/icons/event_icons/event_map.dds"
	
	group = je_group_historical_content

	complete = {
	

	c:JAB = {
		is_subject = no
		}	
	c:NEJ = {
		is_subject = no
		}	
	c:BHN = {
		is_subject = no
		}	
	c:ABU = {
		is_subject = no
		}		
	c:HDJ = {
		is_subject = no
		}		
	c:OMA = {
		is_subject = no
		}	
	c:ZAI = {
		is_subject = no
		}	
	c:LAH = {
		is_subject = no
		}	
	c:KAT = {
		is_subject = no
		}
	c:MAH = {
		is_subject = no
		}		
	}		

		
	weight = 100
	
	on_complete = {
	custom_tooltip = je_stand_free_stand_together_advance
						change_variable = {
			name = stand_free_stand_together_var
			add = 1
			}
			trigger_event = { id = 02_persia_events.12 popup = yes }
			create_country = {
    tag = ARA
    origin = c:NEJ
    state = s:STATE_HEDJAZ.region_state:HDJ
	state = s:STATE_HAIL.region_state:JAB
	state = s:STATE_NEJD.region_state:NEJ
	state = s:STATE_HAIL.region_state:NEJ
    state = s:STATE_ABU_DHABI.region_state:BHN
	state = s:STATE_ABU_DHABI.region_state:ABU
	state = s:STATE_ABU_DHABI.region_state:OMA
	state = s:STATE_OMAN.region_state:OMA
	state = s:STATE_YEMEN.region_state:ZAI
	state = s:STATE_YEMEN.region_state:LAH
	state = s:STATE_YEMEN.region_state:KAT
	state = s:STATE_YEMEN.region_state:MAH
			}
			
							c:ARA = { 
			save_scope_as = arabia_scope
			}
			hidden_effect = {
						change_relations = {
			country = scope:arabia_scope
			value = 50
			}
		}
		
	c:PER = {
			add_leverage = { target = c:ARA value = 100 }			
		}
	
			c:ARA = {
			add_modifier = {
				name = the_crescent_modifier
			}	
		}
	}
	should_be_pinned_by_default = yes
}

je_free_iraq = {
	icon = "gfx/interface/icons/event_icons/event_military.dds"
	
	group = je_group_historical_content
	
	complete = {
		
		c:IRQ = {
				custom_tooltip = {
			text = iraq_at_peace_tt
		is_at_war = no
					NOT = {
		any_diplomatic_play = {
			any_scope_play_involved = { this = c:IRQ }
				}
			}
		}
	}
							OR = {
				has_diplomatic_pact = {
					who = c:IRQ
					type = customs_union
				}
				has_diplomatic_pact = {
					who = c:IRQ
					type = defensive_pact
				}
							has_diplomatic_pact = {
					who = c:IRQ
					type = alliance
				}
			}
	}

	on_complete = {
		trigger_event = { id = 02_persia_events.22 popup = yes }
	
		
			
	c:PER = {
			add_leverage = { target = c:IRQ value = 100 }			
		}
	
			c:IRQ = {
			add_modifier = {
				name = the_crescent_modifier
			}	
		}				
				
	}
			
	weight = 100

	should_be_pinned_by_default = yes
}

je_free_syria = {
	icon = "gfx/interface/icons/event_icons/event_military.dds"
	
	group = je_group_historical_content
	
	complete = {
		
		c:SYR = {
				custom_tooltip = {
			text = syria_at_peace_tt
		is_at_war = no
					NOT = {
		any_diplomatic_play = {
			any_scope_play_involved = { this = c:SYR }
				}
			}
		}
	}
							OR = {
				has_diplomatic_pact = {
					who = c:SYR
					type = customs_union
				}
				has_diplomatic_pact = {
					who = c:SYR
					type = defensive_pact
				}
							has_diplomatic_pact = {
					who = c:SYR
					type = alliance
				}
			}
	}

	on_complete = {
		trigger_event = { id = 02_persia_events.23 popup = yes }
						
	
	c:PER = {
			add_leverage = { target = c:SYR value = 100 }			
		}
	
			c:SYR = {
			add_modifier = {
				name = the_crescent_modifier
			}	
		}			
	}
		
		
	weight = 100

	should_be_pinned_by_default = yes
}

je_free_the_crescent = {
	icon = "gfx/interface/icons/event_icons/event_military.dds"
	
	group = je_group_historical_content
	
	scripted_button = ottoman_unrest_button
	scripted_button = russia_unrest_button
	scripted_button = egypt_unrest_button
	
	
	complete = {
		custom_tooltip = {
			text = iraq_at_peace_tt
		c:IRQ = {

		is_at_war = no
					NOT = {
		any_diplomatic_play = {
			any_scope_play_involved = { this = c:IRQ }
					
				}
			}
		
	}
							OR = {
				has_diplomatic_pact = {
					who = c:IRQ
					type = customs_union
				}
				has_diplomatic_pact = {
					who = c:IRQ
					type = defensive_pact
				}
							has_diplomatic_pact = {
					who = c:IRQ
					type = alliance
				}
			}
		}
		custom_tooltip = {
			text = syria_at_peace_tt
		c:SYR = {
		is_at_war = no
					NOT = {
		any_diplomatic_play = {
			any_scope_play_involved = { this = c:SYR }
				}
			}
		
	}
							OR = {
				has_diplomatic_pact = {
					who = c:SYR
					type = customs_union
				}
				has_diplomatic_pact = {
					who = c:SYR
					type = defensive_pact
				}
							has_diplomatic_pact = {
					who = c:SYR
					type = alliance
				}
			}
		}
		custom_tooltip = {
			text = transcaucasia_at_peace_tt	
			c:CAU = {
		is_at_war = no
					NOT = {
		any_diplomatic_play = {
			any_scope_play_involved = { this = c:CAU }
				}
			}
	}

							OR = {
				has_diplomatic_pact = {
					who = c:CAU
					type = customs_union
				}
				has_diplomatic_pact = {
					who = c:CAU
					type = defensive_pact
				}
				has_diplomatic_pact = {
					who = c:CAU
					type = alliance
				}
				
			}
		}

	}

	on_complete = {
	custom_tooltip = je_stand_free_stand_together_advance
									change_variable = {
			name = stand_free_stand_together_var
			add = 1
		}
				add_journal_entry = {
			type = je_soothe_the_beasts
		}
			
					set_variable = {
		name = free_the_crescent_var
		value = yes		
			}	

			trigger_event = { id = 02_persia_events.7 popup = yes }						
	}
		
		
	weight = 100

	should_be_pinned_by_default = yes
}

je_ottoman_unrest = {
	icon = "gfx/interface/icons/event_icons/event_protest.dds"
	
	group = je_group_historical_content
	
	immediate = {
		set_variable = {
			name = ottoman_unrest_var
			value = 0
		}
	}

	on_monthly_pulse = {
		effect = {
			change_variable = {
				name = ottoman_unrest_var
				add = 1
			}
		}
	}

	complete = {
		scope:journal_entry = { is_goal_complete = yes }
	}

	on_complete = {
		trigger_event = { id = 02_persia_events.14 }
	}

	current_value = {
		value = root.var:ottoman_unrest_var
	}

	goal_add_value = {
		value = 12
	}

	progressbar = yes

	weight = 10

	should_be_pinned_by_default = yes
}

je_russian_unrest = {
	icon = "gfx/interface/icons/event_icons/event_protest.dds"
	
	group = je_group_historical_content
	
	immediate = {
		set_variable = {
			name = russian_unrest_var
			value = 0
		}
	}

	on_monthly_pulse = {
		effect = {
			change_variable = {
				name = russian_unrest_var
				add = 1
			}
		}
	}

	complete = {
		scope:journal_entry = { is_goal_complete = yes }
	}

	on_complete = {		
		trigger_event = { id = 02_persia_events.15 }
	}

	current_value = {
		value = root.var:russian_unrest_var
	}

	goal_add_value = {
		value = 12
	}

	progressbar = yes

	weight = 10

	should_be_pinned_by_default = yes
}

je_egyptian_unrest = {
	icon = "gfx/interface/icons/event_icons/event_protest.dds"
	
	group = je_group_historical_content
	
	immediate = {
		set_variable = {
			name = egyptian_unrest_var
			value = 0
		}
	}

	on_monthly_pulse = {
		effect = {
			change_variable = {
				name = egyptian_unrest_var
				add = 1
			}
		}
	}

	complete = {
		scope:journal_entry = { is_goal_complete = yes }
	}

	on_complete = {		
		trigger_event = { id = 02_persia_events.16 }
	}

	current_value = {
		value = root.var:egyptian_unrest_var
	}

	goal_add_value = {
		value = 12
	}

	progressbar = yes

	weight = 10

	should_be_pinned_by_default = yes
}

je_soothe_the_beasts = {
	icon = "gfx/interface/icons/event_icons/event_military.dds"	
	
	group = je_group_historical_content
		
	complete = {
		NOT = {
		has_journal_entry = je_arabian_dream
		}
		OR = {
			has_law = law_type:law_presidential_republic
			has_law = law_type:law_parliamentary_republic

				}
		c:TUR = {
			OR = {
			has_law = law_type:law_presidential_republic
			has_law = law_type:law_parliamentary_republic
			}
			
		}
				c:EGY = {
			OR = {
			has_law = law_type:law_presidential_republic
			has_law = law_type:law_parliamentary_republic
			}
		}
	}
	weight = 100
	
	on_complete = {
	custom_tooltip = je_stand_free_stand_together_advance
						change_variable = {
			name = stand_free_stand_together_var
			add = 1
			}
								set_variable = {
		name = soothe_the_beasts_var
		value = yes		
			}
			trigger_event = { id = 02_persia_events.2 popup = yes }
		
		
		c:PER = {
			add_leverage = { target = c:EGY value = 150 }			
		}
	
			c:EGY = {
			add_modifier = {
				name = the_crescent_modifier
			}	
		}
		
		
		c:PER = {
			add_leverage = { target = c:TUR value = 150 }			
		}
	
			c:TUR = {
			add_modifier = {
				name = the_crescent_modifier
			}	
		}
	}
	
	should_be_pinned_by_default = yes
}

je_the_kurdistan_quandary = {
	icon = "gfx/interface/icons/event_icons/event_protest.dds"
	
	group = je_group_historical_content
		
	is_shown_when_inactive = {
		this = c:PER
		has_variable = name_the_crescent_var
		}
	
		possible = {
		owns_entire_state_region = STATE_LURISTAN
		#owns_entire_state_region = STATE_MOSUL
		}
	

	on_monthly_pulse = {
		random_events = {
			100 = 0
			90 = 02_persia_events.25 #Kurdistan's Big Ask
			2 = 02_persia_events.24 #Kurds Protest
					}
				}
				
	complete = {
		
		c:KUR = {
				custom_tooltip = {
			text = kurdistan_is_free_tt
		is_at_war = no
					NOT = {
		any_diplomatic_play = {
			any_scope_play_involved = { this = c:KUR }
				}
			}
		}
	}
	c:KUR = {
		owns_entire_state_region = STATE_LURISTAN
		owns_entire_state_region = STATE_DEIR_EZ_ZOR
		owns_entire_state_region = STATE_MOSUL
		owns_entire_state_region = STATE_DIYARBAKIR
	}
							OR = {
				has_diplomatic_pact = {
					who = c:KUR
					type = customs_union
				}
				has_diplomatic_pact = {
					who = c:KUR
					type = defensive_pact
				}
							has_diplomatic_pact = {
					who = c:KUR
					type = alliance
				}
			}

	}

	on_complete = {
		trigger_event = { id = 02_persia_events.8 popup = yes }	
			
			
	c:PER = {
			add_leverage = { target = c:KUR value = 100 }			
		}
	
			c:KUR = {
			add_modifier = {
				name = the_crescent_modifier
			}	
		}
						
						if = {
			limit = {
					c:PER = {
					has_variable = diplomacy_focus_var
					}
				}
			add_modifier = diplomacy_focus_modifier			
			}			
			if = {
			limit = {
					c:PER = {
					has_variable = trade_focus_var
					}
				}
			add_modifier = trade_focus_modifier			
			}
			if = {
			limit = {
					c:PER = {
					has_variable = defense_focus_var
					}
				}
			add_modifier = defense_focus_modifier			
				}
								
			}	
			
		
				
		timeout = 10950

	on_timeout = {
		trigger_event = { id = 02_persia_events.1 popup = yes }
		}
	
		
		
	weight = 100
	
	should_be_pinned_by_default = yes
}

je_build_democratic_institutions = {
	icon = "gfx/interface/icons/event_icons/event_election.dds"
	
	group = je_group_historical_content
	
	on_monthly_pulse = {
		effect = {
			change_variable = {
				name = build_democratic_institutions_var
				add = 1
			}
		}
	}

	complete = {
		scope:journal_entry = { is_goal_complete = yes }
	}

	on_complete = {		
		trigger_event = { id = 02_persia_events.10 popup = yes }
		change_variable = {
			name = stand_free_stand_together_var
			add = 1
		}		
				set_variable = {
		name = complete_build_democratic_institutions_var
		value = yes		
			}
	hidden_effect = {		
	c:BLH = {	
		if = {			
			limit = {
			has_law = law_type:law_monarchy
					}
				activate_law = law_type:law_parliamentary_republic
				activate_law = law_type:law_census_voting		
					
			}
		}			
	c:AFG = {	
		if = {			
			limit = {
			has_law = law_type:law_monarchy
					}
				activate_law = law_type:law_parliamentary_republic
				activate_law = law_type:law_census_voting		
					
			}
		}	
	c:KHI = {	
		if = {			
			limit = {
			has_law = law_type:law_monarchy
					}
				activate_law = law_type:law_parliamentary_republic
				activate_law = law_type:law_census_voting		
					
			}
		}
	c:IRQ = {	
		if = {			
			limit = {
			has_law = law_type:law_monarchy
					}
				activate_law = law_type:law_parliamentary_republic
				activate_law = law_type:law_census_voting		
					
			}
		}
	c:SYR = {	
		if = {			
			limit = {
			has_law = law_type:law_monarchy
					}
				activate_law = law_type:law_parliamentary_republic
				activate_law = law_type:law_census_voting		
					
			}
		}
	c:CAU = {	
		if = {			
			limit = {
			has_law = law_type:law_monarchy
					}
				activate_law = law_type:law_parliamentary_republic
				activate_law = law_type:law_census_voting		
					
			}
		}
			c:KUR = {	
		if = {			
			limit = {
			has_law = law_type:law_monarchy
					}
				activate_law = law_type:law_parliamentary_republic
				activate_law = law_type:law_census_voting		
				}	
			}
			
			c:ARA = {	
		if = {			
			limit = {
			has_law = law_type:law_monarchy
					}
				activate_law = law_type:law_parliamentary_republic
				activate_law = law_type:law_census_voting		
				}	
			}
		}			
		
	}

	current_value = {
		value = root.var:build_democratic_institutions_var
	}

	goal_add_value = {
		value = 24
	}

	progressbar = yes

	weight = 10

	should_be_pinned_by_default = yes
}