﻿namespace = holy_order_mod

holy_order_mod.0001 = {
	type = character_event
	title = holy_order_mod.0001.t
	desc = holy_order_mod.0001.desc
	theme = faith
	override_background = {
		reference = courtyard
	}
	left_portrait = scope:recipient

	immediate = {
		scope:actor.faith = {
			random_faith_holy_order = {
				weight = {
					base = 1
					modifier = {
						add = 10
						holy_order_patron = root
					}
				}
				save_scope_as = ho_1
			}
			if = {
				limit = {
					any_faith_holy_order = {
						this != scope:ho_1
					}
				}
				random_faith_holy_order = {
					limit = {
						this != scope:ho_1
					}
					weight = {
						base = 1
						modifier = {
							add = 10
							holy_order_patron = root
						}
					}
					save_scope_as = ho_2
				}
			}
			if = {
				limit = {
					any_faith_holy_order = {
						NOR = {
							this = scope:ho_1
							this = scope:ho_2
						}
					}
				}
				random_faith_holy_order = {
					limit = {
						NOR = {
							this = scope:ho_1
							this = scope:ho_2
						}
					}
					save_scope_as = ho_3
				}
			}
			if = {
				limit = {
					any_faith_holy_order = {
						NOR = {
							this = scope:ho_1
							this = scope:ho_2
							this = scope:ho_3
						}
					}
				}
				random_faith_holy_order = {
					limit = {
						NOR = {
							this = scope:ho_1
							this = scope:ho_2
							this = scope:ho_3
						}
					}
					save_scope_as = ho_4
				}
			}
			if = {
				limit = {
					any_faith_holy_order = {
						NOR = {
							this = scope:ho_1
							this = scope:ho_2
							this = scope:ho_3
							this = scope:ho_4
						}
					}
				}
				random_faith_holy_order = {
					limit = {
						NOR = {
							this = scope:ho_1
							this = scope:ho_2
							this = scope:ho_3
							this = scope:ho_4
						}
					}
					save_scope_as = ho_5
				}
			}
		}
	}

	option = {
		name = holy_order_mod.0001.a
		trigger = { exists = scope:ho_1 }
		appoint_holy_order_leader_effect = {
			CANDIDATE = scope:recipient
			HOLY_ORDER = scope:ho_1
		}
	}

	option = {
		name = holy_order_mod.0001.b
		trigger = { exists = scope:ho_2 }
		appoint_holy_order_leader_effect = {
			CANDIDATE = scope:recipient
			HOLY_ORDER = scope:ho_2
		}
	}

	option = {
		name = holy_order_mod.0001.c
		trigger = { exists = scope:ho_3 }
		appoint_holy_order_leader_effect = {
			CANDIDATE = scope:recipient
			HOLY_ORDER = scope:ho_3
		}
	}

	option = {
		name = holy_order_mod.0001.d
		trigger = { exists = scope:ho_4 }
		appoint_holy_order_leader_effect = {
			CANDIDATE = scope:recipient
			HOLY_ORDER = scope:ho_4
		}
	}

	option = {
		name = holy_order_mod.0001.e
		trigger = { exists = scope:ho_5 }
		appoint_holy_order_leader_effect = {
			CANDIDATE = scope:recipient
			HOLY_ORDER = scope:ho_5
		}
	}

	option = {
		name = holy_order_mod.0001.cancel
	}
}
