

namespace = union_of_churches

country_event = { #Startup event
    id = union_of_churches.1
    title = union_of_churches.1.t
    desc = union_of_churches.1.d
    picture = RELIGIOUS_TURMOIL_eventPicture
	
    is_triggered_only = yes
        
	mean_time_to_happen = {
		days = 1
	}
    major = yes
    
    immediate = {
        hidden_effect = {
			change_religion = catholic #Byzantium is at least Catholic for the duration of this disaster
            set_country_flag = had_byz_church_crisis
            add_stability = -3
            random_owned_province = {
                limit = {
                    area = thrace_area
                }
                spawn_rebels = {
                    type = orthodox_rebels
                    size = 3
                }
            }
			random_owned_province = {
                limit = {
                    area = morea_area
                }
                spawn_rebels = {
                    type = orthodox_rebels
                    size = 2
                }
            }  
			random_owned_province = {
                limit = {
                    area = macedonia_area
                }
                spawn_rebels = {
                    type = catholic_rebels
                    size = 2
                }
            } 
			random_owned_province = {
                limit = {
                    area = eastern_macedonia_area
                }
                spawn_rebels = {
                    type = catholic_rebels
                    size = 1
                }
            }    
        }
    }
    
    option = {
        name = union_of_churches.1.a #Troubling times are ahead of us...
		custom_tooltip = union_of_churches.1.a.tt
    }
}

#Catholics receive Papal Support!
country_event = {
    id = union_of_churches.2
    title = union_of_churches.2.t
    desc = union_of_churches.2.d
    picture = POPE_PREACHING_eventPicture
    
    trigger = { 
		any_owned_province = {
			religion = orthodox
			NOT = { is_capital = yes }
		}
        NOT = { num_of_rebel_armies = 4 } #Hard limit
    }
    
    is_triggered_only = yes
        
	mean_time_to_happen = {
		days = 1
	}
    
    #fire_only_once = yes
    
	immediate = {
        hidden_effect = {
			random_owned_province = {
				limit = {
					religion = orthodox
					NOT = { is_capital = yes }
				}
				save_event_target_as = byz_catholic_province
				if = {
					limit = {
						calc_true_if = {
							all_owned_province = {
								religion = catholic
							}
							amount = 10
						}
					}
					spawn_rebels = {
						type = catholic_rebels
						size = 1
						win = yes
					}
				}
				else = {
					spawn_rebels = {
						type = catholic_rebels
						size = 1
					}
				}
			}
        }
    }
	
    option = {
        name = union_of_churches.2.aa
		trigger = {
			NOT = {
				calc_true_if = {
					all_owned_province = {
						religion = catholic
					}
					amount = 10
				}
			}
		}
		tooltip = {
			event_target:byz_catholic_province = {
				spawn_rebels = {
					type = catholic_rebels
					size = 1
				}
			}
		}
    }
    
    option = {
        name = union_of_churches.2.ab
		trigger = {
			calc_true_if = {
				all_owned_province = {
					religion = catholic
				}
				amount = 10
			}
		}
		tooltip = {
			event_target:byz_catholic_province = {
				spawn_rebels = {
					type = catholic_rebels
					size = 1
				}
			}
		}
    }
}

#The Local Populace supports the Patriarch!
country_event = {
    id = union_of_churches.3
    title = union_of_churches.3.t
    desc = union_of_churches.3.d
    picture = ORTHODOX_eventPicture
    
    trigger = { 
		any_owned_province = {
			religion = orthodox
			NOT = { is_capital = yes }
		}
		religion = catholic #Orthodox rebel events stop happening once Byzantium has converted to Orthodox
        NOT = { num_of_rebel_armies = 4 } #Hard limit
    }
    
    is_triggered_only = yes
        
	mean_time_to_happen = {
		days = 1
	}
    
    #fire_only_once = yes
    
	immediate = {
        hidden_effect = {
			random_owned_province = {
				limit = {
					religion = orthodox
					NOT = { is_capital = yes }
				}
				save_event_target_as = byz_orthodox_province
				spawn_rebels = {
					type = orthodox_rebels
					size = 1
				}
			}
        }
    }
	
    option = {
        name = union_of_churches.3.aa
		trigger = {
			NOT = {
				calc_true_if = {
					all_owned_province = {
						religion = catholic
					}
					amount = 10
				}
			}
		}
		tooltip = {
			event_target:byz_orthodox_province = {
				spawn_rebels = {
					type = orthodox_rebels
					size = 1
				}
			}
		}
    }
    
    option = {
        name = union_of_churches.3.ab
		trigger = {
			calc_true_if = {
				all_owned_province = {
					religion = catholic
				}
				amount = 10
			}
		}
		tooltip = {
			event_target:byz_orthodox_province = {
				spawn_rebels = {
					type = orthodox_rebels
					size = 1
				}
			}
		}
    }
}

#Catholicism in [byz_catholic_province_convert.GetName]!
country_event = {
    id = union_of_churches.4
    title = union_of_churches.4.t
    desc = union_of_churches.4.d
    picture = POPE_PREACHING_eventPicture
	
    trigger = { 
		any_owned_province = {
			religion = orthodox
			NOT = { is_capital = yes }
		}
		religion = catholic #This event requires you not having converted to Orthodox
        NOT = { num_of_rebel_armies = 4 } #Hard limit
    }
    
    is_triggered_only = yes
        
	mean_time_to_happen = {
		days = 1
	}
    
    #fire_only_once = yes
    
	immediate = {
        hidden_effect = {
			random_owned_province = {
				limit = {
					religion = orthodox
					NOT = { is_capital = yes }
				}
				save_event_target_as = byz_catholic_province_convert
				change_religion = catholic
			}
        }
    }
	
    option = {
        name = union_of_churches.4.aa
		trigger = {
			NOT = {
				calc_true_if = {
					all_owned_province = {
						religion = catholic
					}
					amount = 10
				}
			}
		}
		tooltip = {
			event_target:byz_orthodox_province = {
				change_religion = catholic
			}
		}
    }
    
    option = {
        name = union_of_churches.4.ab
		trigger = {
			calc_true_if = {
				all_owned_province = {
					religion = catholic
				}
				amount = 10
			}
		}
		tooltip = {
			event_target:byz_orthodox_province = {
				change_religion = catholic
			}
		}
    }
}

#Orthodox neighbours support the [Root.Monarch.GetTitle]!
country_event = {
    id = union_of_churches.5
    title = union_of_churches.5.t
    desc = union_of_churches.5.d
    picture = GOOD_WITH_MONARCH_eventPicture
    
    trigger = { 
		any_country = {
			religion = orthodox
			NOT = { tag = ROOT }
		}
        NOT = { num_of_rebel_armies = 4 } #Hard limit
		OR = {
			religion = orthodox
			AND = {
				religion = catholic #This event requires you not having converted to Orthodox
				NOT = { #Orthodox need to be winning
					calc_true_if = {
						all_owned_province = {
							religion = catholic
						}
						amount = 10
					}
				}
			}
		}
    }
    
    is_triggered_only = yes
        
	mean_time_to_happen = {
		days = 1
	}
    
    #fire_only_once = yes
    
	immediate = {
        hidden_effect = {
			random_country = {
				limit = {
					religion = orthodox
					NOT = { tag = ROOT }
				}
				save_event_target_as = byz_orthodox_supporter
			}
        }
    }
	
    option = {
        name = union_of_churches.5.a
		add_treasury = 50
    }
}

#Restoration of Orthodoxy in [byz_restored_orthodox_province.GetName]!
country_event = {
    id = union_of_churches.6
    title = union_of_churches.6.t
    desc = union_of_churches.6.d
    picture = ORTHODOX_eventPicture
    
    trigger = {		
        NOT = { num_of_rebel_armies = 4 } #Hard limit
		religion = orthodox #Happens when you've converted
		any_owned_province = {
			religion = catholic
			NOT = { is_capital = yes }
		}
    }
    
    is_triggered_only = yes
        
	mean_time_to_happen = {
		days = 1
	}
    
    #fire_only_once = yes
    
	immediate = {
        hidden_effect = {
			random_owned_province = {
				limit = {
					religion = catholic
					NOT = { is_capital = yes }
				}
				save_event_target_as = byz_restored_orthodox_province
				change_religion = orthodox
			}
        }
    }
	
    option = {
        name = union_of_churches.6.a
		tooltip = {
			event_target:byz_restored_orthodox_province = {
				change_religion = orthodox
			}
		}
    }
}

#An End to the Religious Turmoil in [Root.GetName]!
country_event = {
    id = union_of_churches.100
    title = union_of_churches.100.t
    desc = {
		trigger = { religion = orthodox }
		desc = union_of_churches.100.da
	}
    desc = {
		trigger = { religion = catholic }
		desc = union_of_churches.100.db
	}
	
    picture = {
		trigger = { religion = orthodox }
		picture = ORTHODOX_eventPicture
	}
	
    picture = {
		trigger = { religion = picture }
		picture = POPE_PREACHING_eventPicture
	}
	
    
    trigger = {
    }
    
    is_triggered_only = yes
        
	mean_time_to_happen = {
		days = 1
	}
    
    fire_only_once = yes
    
	immediate = {
    }
	
    option = {
        name = union_of_churches.100.aa #Orthodoxy has been restored!
		trigger = { religion = orthodox }
		add_stability = 2
		increase_religious_currency_effect = yes
		if = {
			limit = {
				ruler_religion = catholic
			}
			set_ruler_religion = orthodox
		}
		if = {
			limit = {
				heir_religion = catholic
			}
			set_heir_religion = orthodox
		}
		custom_tooltip = union_of_churches.100.tt
    }
	
    option = {
        name = union_of_churches.100.ab #The Pope shall remain supreme!
		trigger = { religion = catholic }
		add_stability = 2
		increase_religious_currency_effect = yes
		if = {
			limit = {
				ruler_religion = orthodox
			}
			set_ruler_religion = catholic
		}
		if = {
			limit = {
				heir_religion = orthodox
			}
			set_heir_religion = catholic
		}
		custom_tooltip = union_of_churches.100.tt
    }
}