###################################
#
# Anti-Caliph Events
#
###################################

namespace = ICA

#Written by:
#Sergei Ivanov

#I have become caliph
#character_event = {
#	id = ICA.100
#	desc = EVTDESCICA.100
#	picture = GFX_evt_feast
#	
#	notification = yes	
#	major = yes
#	
#	is_triggered_only = yes
#	hide_from = yes
#	
#	major_trigger = {
#		religion_group = FROM
#	}
#	option = {
#		name = OK 
#	}
#}
#anti-caliph been deposed
#character_event = {
#	id = ICA.101
#	desc = EVTDESCICA.101
#	picture = GFX_evt_feast
#	
#	notification = yes	
#	major = yes
#	
#	is_triggered_only = yes
#	hide_from = yes
#	
#	major_trigger = {
#		religion_group = FROM
#	}
#	option = {
#		name = OK 
#	}
#}
#death of anti-caliph, cleanup
character_event = {
	id = ICA.102
	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		has_character_flag = anti_caliph
	}
	
	immediate = {
		if = {
			limit = {
				NOT = {
					any_independent_ruler = {
						has_claim = persistent_event_target:base_caliphate
						has_character_flag = anti_caliph
					}
				}
			}
			
			religion_scope = {
				set_can_have_antipopes = no
			}
			character_event = { id = ICA.101 }
		}
	}
}
#conversion of anti-caliph, cleanup. the FROM scope has the old religion.
character_event = {
	id = ICA.103
	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		has_character_flag = anti_caliph
	}
	
	immediate = {
		if = {
			limit = {
				NOT = {
					any_independent_ruler = {
						has_claim = persistent_event_target:base_caliphate
						has_character_flag = anti_caliph
					}
				}
			}
			
			FROM = {
				set_can_have_antipopes = no
			}
		}
	}
}
#anticaliph pressed claims and succ
character_event = {
	id = ICA.104
	hide_window = yes
	
	is_triggered_only = yes
	
	trigger = {
		persistent_event_target:base_caliphate = {
			FROM = { title = PREV }
		}
    }
	
	immediate = {
		if = {
			limit = {
				NOT = {
					any_independent_ruler = {
						has_claim = persistent_event_target:base_caliphate
						has_character_flag = anti_caliph
					}
				}
			}
			
			religion_scope = {
				set_can_have_antipopes = no
			}
		}
		FROMFROM = {
			if = {
				limit = {
					independent = yes
				}
				
				FROM = {
					make_tributary = {
						who = PREV tributary_type = permanent
					}
				}
			}
		}
	}
}