# Anglois Path
je_dual_integration = {
	icon = "gfx/interface/icons/event_icons/event_portrait.dds"

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

	on_complete = {
		trigger_event = { id = dvg_dua.2 }
	}

	fail = {
		custom_tooltip = {
			text = dua_global_revolted_tooltip
			OR = {
				has_global_variable = dua_global_revolted
				AND = {
					is_diplomatic_play_committed_participant = no
					is_at_war = no
					has_revolution = no
					OR = {
						exists = c:ENG
						exists = c:FRA
					}
				}
			}
		}
	}
	
	on_timeout = {
		set_global_variable = dua_timeout
	}

	on_monthly_pulse = {
		random_events = {
			30 = 0
			20 = dvg_dua.110 # Patron
			20 = dvg_dua.111 # Publication of "Histoire de la France depuis ses origines"
			20 = dvg_dua.112 # Publication of "Saxon Poetry"
			20 = dvg_dua.113 # The Great Travel of the Dauphin
			20 = dvg_dua.114 # The 'Immortals'
			20 = dvg_dua.120 # Radical IG
			20 = dvg_dua.115 # Celebration of the German Revolution
			30 = dvg_dua.118 # Springtime 1848
			30 = dvg_dua.119 # Valois subversion
			30 = dvg_dua.121 # Scottish subversion
			50 = dvg_dua.122 # Anglois resilience 1855
			50 = dvg_dua.123 # Anglois resilience 1860 
			50 = dvg_dua.124 # Anglois resilience 1865
			50 = dvg_dua.125 # Anglois resilience 1870
			30 = dvg_dua.126 # Anglois failure 1855
			30 = dvg_dua.127 # Anglois failure 1860
		}
	}

	current_value = {
		value = root.var:anglois_acc
	}

	goal_add_value = {
		add = 8
	}

	progressbar = yes

	timeout = 12775

	weight = 10000
	should_be_pinned_by_default = yes
}

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

	status_desc = {
		first_valid = {
			triggered_desc = {
				desc = eng_revolt_tension_high
				trigger = {
					any_scope_state = {
						is_incorporated = yes
						is_capital = no
						state_region = { 
							OR = {
								is_homeland = cu:french
								is_homeland = cu:occitan
							}
						}
						turmoil > 0.5
					}
				}
			}
			triggered_desc = {
				desc = eng_revolt_tension_med
				trigger = {
					any_scope_state = {
						is_incorporated = yes
						is_capital = no
						state_region = { 
							OR = {
								is_homeland = cu:french
								is_homeland = cu:occitan
							}
						}
						turmoil > 0.25
					}
				}
			}
			triggered_desc = {
				desc = eng_revolt_tension_low
			}
		}
	}

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

	on_complete = {
		trigger_event = { id = dvg_dua.4 }
	}

	fail = {

	}

	#on_fail = {
	#	trigger_event = { id = dvg_dua.3 }
	#}
	
	#on_timeout = {
	#	set_global_variable = dua_timeout
	#}

	on_monthly_pulse = {
		random_events = {
			30 = 0
			20 = dvg_dua.211 #St Louis Speech
			20 = dvg_dua.212 #The great travel
			20 = dvg_dua.213 #Sons of Harold
			20 = dvg_dua.214 #Sorbonne
		}
		effect = {
			if = {
				limit = {
					NOT = {
						cu:french = {
							culture_secession_progress = {
								target = ROOT
								value > 0.5
							}
						}
						cu:occitan = {
							culture_secession_progress = {
								target = ROOT
								value > 0.5
							}
						}
						cu:british = {
							culture_secession_progress = {
								target = ROOT
								value > 0.5
							}
						}
					}
				}
				change_variable = {
					name = french_acc
					add = 0.08
				}
			}
			if = {
				limit = {
					coa_controls_part_of_england = no
				}
				change_variable = {
					name = french_acc
					add = 0.1
				}
			}
		}
	}

	current_value = {
		value = root.var:french_acc
	}

	goal_add_value = {
		add = 20
	}

	progressbar = yes

	#timeout = 12775

	weight = 10000
	should_be_pinned_by_default = yes
}

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

	status_desc = {
		first_valid = {
			triggered_desc = {
				desc = occ_revolt_tension_high
				trigger = {
					any_scope_state = {
						is_incorporated = yes
						is_capital = no
						state_region = { 
							OR = {
								is_homeland = cu:british
							}
						}
						turmoil > 0.50
					}
				}
			}
			triggered_desc = {
				desc = occ_revolt_tension_med
				trigger = {
					any_scope_state = {
						is_incorporated = yes
						is_capital = no
						state_region = { 
							OR = {
								is_homeland = cu:british
							}
						}
						turmoil > 0.25
					}
				}
			}
			triggered_desc = {
				desc = occ_revolt_tension_low
			}
		}
	}

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

	on_complete = {
		trigger_event = { id = dvg_dua.6 }
	}

	fail = {

	}

	#on_fail = {
	#	trigger_event = { id = dvg_dua.3 }
	#}
	
	#on_timeout = {
	#	set_global_variable = dua_timeout
	#}

	on_monthly_pulse = {
		random_events = {
			30 = 0
			20 = dvg_dua.311 #The great travel
			20 = dvg_dua.312 #Sons of St-Louis
		}
		effect = {
			if = {
				limit = {
					NOT = {
						cu:french = {
							culture_secession_progress = {
								target = ROOT
								value > 0.5
							}
						}
						cu:occitan = {
							culture_secession_progress = {
								target = ROOT
								value > 0.5
							}
						}
						cu:british = {
							culture_secession_progress = {
								target = ROOT
								value > 0.5
							}
						}
					}
				}
				change_variable = {
					name = english_acc
					add = 0.08
				}
			}
			if = {
				limit = {
					coa_controls_part_of_france = no
				}
				change_variable = {
					name = french_acc
					add = 0.1
				}
			}
		}
	}

	current_value = {
		value = root.var:english_acc
	}

	goal_add_value = {
		add = 20
	}

	progressbar = yes

	#timeout = 12775

	weight = 10000
	should_be_pinned_by_default = yes
}

# Bureaucractic Reform
je_dua_bureaucracy = {
	icon = "gfx/interface/icons/event_icons/event_scales.dds"

	complete = {
		NOR = { 
			has_law = law_type:law_hereditary_bureaucrats 
			has_law = law_type:law_land_based_taxation
			has_law = law_type:law_consumption_based_taxation
		}
		bureaucracy >= 0 
		approaching_bureaucracy_shortage = no
	}

	on_complete = {
		remove_modifier = outmoded_bureaucracy
	}

	inheritable = no

	weight = 5000
}

je_total_revolution = {
	icon = "gfx/interface/icons/event_icons/event_skull.dds"

	complete = {
		custom_tooltip = {
			text = anglois_accepted_tooltip
			has_global_variable = anglois_accepted
		}
	}

	on_complete = {
		#trigger_event = {
		#	id = dvg_dua.2
		#}
	}

	fail = {
		OR = {
			custom_tooltip = {
				text = dvg_dua_timeout
				has_variable = dua_timeout
			}
			custom_tooltip = {
				text = dvg_dua_control_lost
				AND = {
					NOT = { has_variable = occ_revolted }
					NOT = { has_variable = eng_revolted }
					OR = {
						exists = c:OCC
						exists = c:FRA
						exists = c:ENG
						exists = c:IRE
					}
					is_diplomatic_play_committed_participant = no
					is_at_war = no
					has_revolution = no
				}
			}
			custom_tooltip = {
				text = dvg_dua_total_revolt_reached
				root.var:dua_total_revolution_revolt >= 22
			}
		}
	}

	on_fail = {
		set_global_variable = dua_global_revolted
		trigger_event = {
			id = dvg_dua.500
		}
	}

	on_weekly_pulse = {
		effect = {
			set_variable = {
				name = dua_total_revolution_revolt
				value = 0
			}
			if = {
				limit = {
					root.var:occ_revolt <= 11
				}
				change_variable = {
					name = dua_total_revolution_revolt
					add = root.var:occ_revolt
				}
			} else = {
				change_variable = {
					name = dua_total_revolution_revolt
					add = 11
				}
			}
			if = {
				limit = {
					root.var:eng_revolt <= 11
				}
				change_variable = {
					name = dua_total_revolution_revolt
					add = root.var:eng_revolt
				}
			} else = {
				change_variable = {
					name = dua_total_revolution_revolt
					add = 11
				}
			}
		}
	}

	current_value = {
		value = root.var:dua_total_revolution_revolt
	}

	goal_add_value = {
		value = 22
	}

	progressbar = yes

	weight = 10000
	should_be_pinned_by_default = yes
}

je_midi_revolution = {
	icon = "gfx/interface/icons/event_icons/event_skull.dds"

	complete = {
		custom_tooltip = {
			text = dvg_complete_midi_revolution_tt
			OR = {
				has_global_variable = dua_global_revolted
				has_global_variable = anglois_accepted
				has_global_variable = english_accepted
			}
		}
	}

	on_complete = {
	}

	fail = {
		OR = {
			exists = c:OCC
		}
	}

	on_fail = {
	}

	on_monthly_pulse = {
		effect = {
			if = {
				limit = {
					has_journal_entry = je_english_integration
					root.var:occ_revolt < 14
				}
				change_variable = {
					name = occ_revolt
					add = 0.18
				}
			}
			if = {
				limit = {
					NOT = {
						any_scope_state = {
							is_incorporated = yes
							is_capital = no
							state_region = { 
								OR = {
									is_homeland = cu:french 
									is_homeland = cu:occitan 
								}
							}
							turmoil > 0.75
						}
					}
				}
				if = {
					limit = {
						has_journal_entry = je_english_integration
						NOT = { has_variable = eng_revolted }
						NOT = { has_global_variable = dua_global_revolted}
						root.var:eng_revolt >= 3
					}
		
					add_radicals = {
						value = 0.01
						culture = cu:french
					}
			
					add_radicals = {
						value = 0.01
						culture = cu:occitan
					}
				}
				if = {
					limit = {
						has_journal_entry = je_english_integration
						NOT = { has_variable = occ_revolted }
						NOT = { has_global_variable = dua_global_revolted}
						root.var:occ_revolt >= 6
					}
		
					add_radicals = {
						value = 0.01
						culture = cu:french
					}
			
					add_radicals = {
						value = 0.01
						culture = cu:occitan
					}
				}
				if = {
					limit = {
						NOT = { has_variable = occ_revolted }
						NOT = { has_global_variable = dua_global_revolted}
						root.var:occ_revolt >= 11
					}
		
					add_radicals = {
						value = 0.01
						culture = cu:french
					}
			
					add_radicals = {
						value = 0.01
						culture = cu:occitan
					}
				}
			}
		}
	}

	invalid = {
	}

	current_value = {
		value = root.var:occ_revolt
	}

	goal_add_value = {
		value = 14
	}

	progressbar = yes

	weight = 10000
	should_be_pinned_by_default = yes
}

je_english_revolution = {
	icon = "gfx/interface/icons/event_icons/event_skull.dds"
	
	complete = {
		custom_tooltip = {
			text = dvg_complete_english_revolution_tt
			OR = {
				has_global_variable = dua_global_revolted
				has_global_variable = anglois_accepted
				has_global_variable = french_accepted
			}
		}
	}

	on_complete = {
	}

	fail = {
		OR = {
			exists = c:ENG
		}
	}

	on_fail = {
	}

	on_monthly_pulse = {
		effect = {
			if = {
				limit = {
					has_journal_entry = je_french_integration
					root.var:eng_revolt < 14
				}
				change_variable = {
					name = eng_revolt
					add = 0.18
				}
			}
			if = {
				limit = {
					NOT = {
						any_scope_state = {
							is_incorporated = yes
							is_capital = no
							state_region = { 
								OR = {
									is_homeland = cu:british
								}
							}
							turmoil > 0.75
						}
					}
				}
				
				if = {
					limit = {
						has_journal_entry = je_french_integration
						NOT = { has_variable = eng_revolted }
						NOT = { has_global_variable = dua_global_revolted}
						root.var:eng_revolt >= 3
					}

					add_radicals = {
						value = 0.01
						culture = cu:british
					}
				}
				if = {
					limit = {
						has_journal_entry = je_french_integration
						NOT = { has_variable = eng_revolted }
						NOT = { has_global_variable = dua_global_revolted}
						root.var:eng_revolt >= 6
					}

					add_radicals = {
						value = 0.01
						culture = cu:british
					}
				}
				if = {
					limit = {
						NOT = { has_variable = eng_revolted }
						NOT = { has_global_variable = dua_global_revolted}
						root.var:eng_revolt >= 11
					}

					add_radicals = {
						value = 0.01
						culture = cu:british
					}
				}
			}
		}
	}

	current_value = {
		value = root.var:eng_revolt
	}

	goal_add_value = {
		value = 14
	}

	progressbar = yes

	weight = 10000
	should_be_pinned_by_default = yes
}
