﻿
namespace =  utc_decision_events

utc_decision_events.0001 = {
	type = character_event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:restored_caliphate
				}
				desc = utc_decision_events.0001.t.restored_caliphate
			}
			triggered_desc = {
				trigger = {
					exists = scope:new_caliphate
				}
				desc = utc_decision_events.0001.t.new_caliphate
			}
			triggered_desc = {
				desc = utc_decision_events.0001.t
			}
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:restored_caliphate
				}
				desc = utc_decision_events.0001.desc.restored_caliphate
			}
			triggered_desc = {
				trigger = {
					exists = scope:new_caliphate
				}
				desc = utc_decision_events.0001.desc.new_caliphate
			}
			triggered_desc = {
				desc = utc_decision_events.0001.desc
			}
		}
	}
	theme = faith
	override_background = { reference = throne_room_scope }
	left_portrait = {
		character = scope:caliph
		triggered_animation = {
			trigger = { exists = scope:new_caliphate }
			animation = sword_coup_degrace
		}
		animation = personality_honorable
	}
	right_portrait = {
		character = scope:old_caliph
		animation = anger
	}

	immediate = {
		scope:caliph = {
			save_scope_as = background_throne_room_scope
		}
	}

	option = {
		name = {
			trigger = { NOT = { exists = scope:new_caliphate } }
			text = utc_decision_events.0001.a.usurpation
		}
		name = {
			trigger = { exists = scope:new_caliphate }
			text = utc_decision_events.0001.a
		}
		trigger = {
			this = scope:caliph
		}
		if = {
			limit = {
				exists = scope:new_caliphate
				this = scope:caliph
			}
			dynasty = {
				add_dynasty_prestige = 1500
			}
		}
		add_legitimacy = monumental_legitimacy_gain
	}
	option = {
		name = {
			trigger = { this = scope:old_caliph }
			text = utc_decision_events.0001.b.old_caliph
		}
		name = {
			trigger = { this != scope:old_caliph }
			text = utc_decision_events.0001.b
		}
		trigger = {
			OR = {
				this = scope:old_caliph
				AND = {
					exists = scope:new_caliphate
					dynasty = scope:old_caliph.dynasty
				}
			}
		}
		if = {
			limit = {
				this = scope:old_caliph
			}
			scope:caliph = {
				hidden_effect = {
					every_held_title = {
						limit = {
							tier > tier_barony
							NOT = { scope:old_caliph = { has_strong_claim_on = prev } }
							this != scope:caliph.faith.religious_head_title
						}
						scope:old_caliph = {
							add_pressed_claim = prev
						}
					}
				}
			}
			custom_tooltip = {
				text = utc_caliph_claims_tt
			}
			add_legitimacy = monumental_legitimacy_loss
		}
		if = {
			limit = {
				exists = scope:new_caliphate
				NOT = { has_game_rule = utc_0_years_usurpation_cooldown }
			}
			custom_tooltip = {
				text = utc_old_dynasty_grace_tt
			}
		}
	}
	option = {
		name = {
			trigger = {
				dynasty = scope:caliph.dynasty
			}
			text = utc_decision_events.0001.c.new_dynasty
		}
		name = {
			trigger = {
				dynasty != scope:caliph.dynasty
				faith.religious_head_title != scope:caliph.faith.religious_head_title
			}
			text = utc_decision_events.0001.c.infidels
		}
		name = {
			trigger = {
				dynasty != scope:caliph.dynasty
				faith.religious_head_title = scope:caliph.faith.religious_head_title
			}
			text = utc_decision_events.0001.c
		}
		trigger = {
			exists = scope:new_caliphate
			NOR = {
				this = scope:caliph
				this = scope:old_caliph
			}
		}
	}
	option = {
		name = utc_decision_events.0001.d
		trigger = {
			NOT = { exists = scope:new_caliphate }
			NOR = {
				this = scope:caliph
				this = scope:old_caliph
			}
		}
	}
}
