﻿on_law_checkpoint_success = {
	effect = {
		trigger_event = { id = french_flavor.8 days = 1 popup = yes }
		trigger_event = { id = royalist_restauration.1 days = 1 popup = yes }
		trigger_event = { id = royalist_restauration.2 days = 1 popup = yes }
		trigger_event = { id = royalist_restauration.3 days = 1 popup = yes }
	}
}
on_monthly_pulse_country = {
	events = {
		conquest_of_algeria.1
	}
}
on_character_death = {
	effect = {
		if = {
			limit = {
				is_ruler = yes
				exists = c:FRA
				owner = c:FRA
				has_variable = is_orleanist
				owner = { 
					has_law = law_type:law_orleanist_monarchy 
					NOT = { any_scope_character = { is_heir = yes } }
				}
			}
			owner = { create_random_orleanist_ruler = yes }
		}
		if = {
			limit = {
				is_ruler = yes
				exists = c:FRA
				owner = c:FRA
				has_variable = is_legitimist
				owner = { 
					has_law = law_type:law_legitimist_monarchy 
					NOT = { any_scope_character = { is_heir = yes } }
				}
			}
			owner = { create_random_legitimist_ruler = yes }
		}
		if = {
			limit = {
				is_ruler = yes
				exists = c:FRA
				owner = c:FRA
				has_variable = is_bonapartist
				owner = { 
					has_law = law_type:law_bonapartist_monarchy 
					NOT = { any_scope_character = { is_heir = yes } }
				}
			}
			owner = { create_random_bonapartist_ruler = yes }
		}
	}
}
on_heir_born = {
	effect = {
		if = {
			limit = {
				exists = c:FRA
				owner = c:FRA
				owner = { 
					ruler = { has_variable = is_orleanist }
					has_law = law_type:law_orleanist_monarchy 
				}
			}
			owner = { create_random_orleanist_heir = yes }
		}
		if = {
			limit = {
				exists = c:FRA
				owner = c:FRA
				owner = { 
					ruler = { has_variable = is_legitimist }
					has_law = law_type:law_legitimist_monarchy 
				}
			}
			owner = { create_random_legitimist_heir = yes }
		}
		if = {
			limit = {
				exists = c:FRA
				owner = c:FRA
				owner = { 
					ruler = { has_variable = is_bonapartist }
					has_law = law_type:law_bonapartist_monarchy 
					NOT = { AND = { ruler = { has_variable = is_louis_napoleon } NOT = { has_variable = napoleon_eugene_born } } }
				}
			}
			owner = { create_random_bonapartist_heir = yes }
		}
		if = {
			limit = {
				exists = c:FRA
				owner = c:FRA
				owner = { 
					ruler = { has_variable = is_bonapartist }
					has_law = law_type:law_bonapartist_monarchy 
					AND = { ruler = { has_variable = is_louis_napoleon } NOT = { has_variable = napoleon_eugene_born } }
				}
			}
			owner = { trigger_event = { id = french_flavor.9 popup = yes } }
		}
	}
}

on_law_enactment_started = {
	effect = {
		if = {
			limit = {
				has_law = law_type:law_legitimist_monarchy
				OR = {
					is_enacting_law = law_type:law_presidential_republic
					is_enacting_law = law_type:law_parliamentary_republic
					is_enacting_law = law_type:law_council_republic
				}
			}
			set_variable = {
				name = abolishing_monarchy_var
				value = 0
			}
			add_journal_entry = { type =  je_abolish_legitimist_monarchy }
		}
		if = {
			limit = {
				has_law = law_type:law_orleanist_monarchy
				OR = {
					is_enacting_law = law_type:law_presidential_republic
					is_enacting_law = law_type:law_parliamentary_republic
					is_enacting_law = law_type:law_council_republic
				}
			}
			set_variable = {
				name = abolishing_monarchy_var
				value = 0
			}
			add_journal_entry = { type =  je_abolish_orleanist_monarchy }
		}
		if = {
			limit = {
				has_law = law_type:law_bonapartist_monarchy
				OR = {
					is_enacting_law = law_type:law_presidential_republic
					is_enacting_law = law_type:law_parliamentary_republic
					is_enacting_law = law_type:law_council_republic
				}
			}
			set_variable = {
				name = abolishing_monarchy_var
				value = 0
			}
			add_journal_entry = { type =  je_abolish_bonapartist_monarchy }
		}
	}
}