﻿namespace = regula_take_initiates_from_holy_order

# Regula Take Initiates From Holy Order events
# 0001 - Three Initiates
# 0002 - Five Initiates

regula_take_initiates_from_holy_order.0001 = {
	type = character_event

	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					regula_num_holy_order_counties < 15
				}
				desc = regula_take_initiates_from_holy_order_common.title
			}
			triggered_desc = {
				trigger = {
					regula_num_holy_order_counties < 30
				}
				desc = regula_take_initiates_from_holy_order_noble.title
			}
			desc = regula_take_initiates_from_holy_order_royal.title
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					regula_num_holy_order_counties < 15
				}
				desc = regula_take_initiates_from_holy_order_common.desc
			}
			triggered_desc = {
				trigger = {
					regula_num_holy_order_counties < 30
				}
				desc = regula_take_initiates_from_holy_order_noble.desc
			}
			desc = regula_take_initiates_from_holy_order_royal.desc
		}
	}

	theme = realm
	override_background = {
		reference = temple
	}

	left_portrait = {
		character = scope:initiate1
		animation = personality_bold
	}
	right_portrait = {
		character = scope:initiate2
		animation = personality_zealous
		outfit_tags = { regula_priestess }
	}
	lower_left_portrait = {
		character = scope:initiate3
	}

	# Create our initiates
	immediate = {

		# Now pick the right option
		# could use switch statement?
		if = {
			limit = {
				regula_num_holy_order_counties < 15
			}

			regula_create_initiate_effect = { WHO = root initiate_type = 1 initiate_rarity = 1}
			scope:created_character = { save_scope_as = initiate1 }

			regula_create_initiate_effect = { WHO = root initiate_type = 2 initiate_rarity = 1}
			scope:created_character = { save_scope_as = initiate2 }

			regula_create_initiate_effect = { WHO = root initiate_type = 3 initiate_rarity = 1}
			scope:created_character = { save_scope_as = initiate3 }
		}
		else_if = {
			limit = {
				regula_num_holy_order_counties < 30
				regula_num_holy_order_counties >= 15
			}

			regula_create_initiate_effect = { WHO = root initiate_type = 1 initiate_rarity = 2}
			scope:created_character = { save_scope_as = initiate1 }

			regula_create_initiate_effect = { WHO = root initiate_type = 2 initiate_rarity = 2}
			scope:created_character = { save_scope_as = initiate2 }

			regula_create_initiate_effect = { WHO = root initiate_type = 3 initiate_rarity = 2}
			scope:created_character = { save_scope_as = initiate3 }
		}
		else_if = {
			limit = {
				regula_num_holy_order_counties >= 30
			}

			regula_create_initiate_effect = { WHO = root initiate_type = 1 initiate_rarity = 3}
			scope:created_character = { save_scope_as = initiate1 }

			regula_create_initiate_effect = { WHO = root initiate_type = 2 initiate_rarity = 3}
			scope:created_character = { save_scope_as = initiate2 }

			regula_create_initiate_effect = { WHO = root initiate_type = 3 initiate_rarity = 3}
			scope:created_character = { save_scope_as = initiate3 }
		}
	}


	# Now choose
	# 1. Choose first Intitate
	# 2. Choose second Intitate
	# 3. Choose third Intitate
	option = {
		name = regula_take_initiates_from_holy_order.a
		add_courtier = scope:initiate1
		# Remove others
		hidden_effect = {
			scope:initiate2 = {
				death = {
					death_reason = death_disappearance
				}
			}
			scope:initiate3 = {
				death = {
					death_reason = death_disappearance
				}
			}
		}
	}

	option = {
		name = regula_take_initiates_from_holy_order.b
		add_courtier = scope:initiate2
		# Remove others
		hidden_effect = {
			scope:initiate1 = {
				death = {
					death_reason = death_disappearance
				}
			}
			scope:initiate3 = {
				death = {
					death_reason = death_disappearance
				}
			}
		}
	}

	option = {
		name = regula_take_initiates_from_holy_order.c
		add_courtier = scope:initiate3
		# Remove others
		hidden_effect = {
			scope:initiate1 = {
				death = {
					death_reason = death_disappearance
				}
			}
			scope:initiate2 = {
				death = {
					death_reason = death_disappearance
				}
			}
		}
	}
}

regula_take_initiates_from_holy_order.0002 = {
	type = character_event

	# set title and description based on "power" of event
	title = {
		first_valid = {
			triggered_desc = {
				trigger = {
					regula_num_holy_order_counties < 15
				}
				desc = regula_take_initiates_from_holy_order_common.title
			}
			triggered_desc = {
				trigger = {
					regula_num_holy_order_counties < 30
				}
				desc = regula_take_initiates_from_holy_order_noble.title
			}
			desc = regula_take_initiates_from_holy_order_royal.title
		}
	}
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					regula_num_holy_order_counties < 15
				}
				desc = regula_take_initiates_from_holy_order_common.desc
			}
			triggered_desc = {
				trigger = {
					regula_num_holy_order_counties < 30
				}
				desc = regula_take_initiates_from_holy_order_noble.desc
			}
			desc = regula_take_initiates_from_holy_order_royal.desc
		}
	}

	theme = faith
	override_background = {
		reference = temple
	}

	left_portrait = {
		character = scope:initiate1
		animation = personality_bold
	}
	right_portrait = {
		character = scope:initiate2
		animation = personality_zealous
		outfit_tags = { regula_priestess }
	}
	lower_left_portrait = {
		character = scope:initiate3
	}
	lower_center_portrait = {
		character = scope:initiate4
	}
	lower_right_portrait = {
		character = scope:initiate5
	}

	# Create our initiates
	# Each initiate is specialised
	# 1. The Solider - Giant, Strong style traits, good martial and prowess
	# 2. The Priestess - High Learning, Zealous
	# 3. The Lady - decent stats all around, content, good vassal/wife
	# 4. The Spy - High Intrigue, prowess
	# 5. The Breeder - Good congential traits, chance for pure blooded, not so great stat line
	# Just create them in order, no need for random list

	# initiate_rarity can be 1,2,3 (common,noble,royal)
	# depends on number of counties owned by regula holy orders
	# 0+ counties for common, 15+ counties for noble, 30+ for royal

	# num_leased_titles holy order

	# Common
	immediate = {

		# Now pick the right option
		# could use switch statement?
		if = {
			limit = {
				regula_num_holy_order_counties < 15
			}

			regula_create_initiate_effect = { WHO = root initiate_type = 1 initiate_rarity = 1}
			scope:created_character = { save_scope_as = initiate1 }

			regula_create_initiate_effect = { WHO = root initiate_type = 2 initiate_rarity = 1}
			scope:created_character = { save_scope_as = initiate2 }

			regula_create_initiate_effect = { WHO = root initiate_type = 3 initiate_rarity = 1}
			scope:created_character = { save_scope_as = initiate3 }

			regula_create_initiate_effect = { WHO = root initiate_type = 4 initiate_rarity = 1}
			scope:created_character = { save_scope_as = initiate4 }

			regula_create_initiate_effect = { WHO = root initiate_type = 5 initiate_rarity = 1}
			scope:created_character = { save_scope_as = initiate5 }
		}
		else_if = {
			limit = {
				regula_num_holy_order_counties < 30
				regula_num_holy_order_counties >= 15
			}

			regula_create_initiate_effect = { WHO = root initiate_type = 1 initiate_rarity = 2}
			scope:created_character = { save_scope_as = initiate1 }

			regula_create_initiate_effect = { WHO = root initiate_type = 2 initiate_rarity = 2}
			scope:created_character = { save_scope_as = initiate2 }

			regula_create_initiate_effect = { WHO = root initiate_type = 3 initiate_rarity = 2}
			scope:created_character = { save_scope_as = initiate3 }

			regula_create_initiate_effect = { WHO = root initiate_type = 4 initiate_rarity = 2}
			scope:created_character = { save_scope_as = initiate4 }

			regula_create_initiate_effect = { WHO = root initiate_type = 5 initiate_rarity = 2}
			scope:created_character = { save_scope_as = initiate5 }
		}
		else_if = {
			limit = {
				regula_num_holy_order_counties >= 30
			}

			regula_create_initiate_effect = { WHO = root initiate_type = 1 initiate_rarity = 3}
			scope:created_character = { save_scope_as = initiate1 }

			regula_create_initiate_effect = { WHO = root initiate_type = 2 initiate_rarity = 3}
			scope:created_character = { save_scope_as = initiate2 }

			regula_create_initiate_effect = { WHO = root initiate_type = 3 initiate_rarity = 3}
			scope:created_character = { save_scope_as = initiate3 }

			regula_create_initiate_effect = { WHO = root initiate_type = 4 initiate_rarity = 3}
			scope:created_character = { save_scope_as = initiate4 }

			regula_create_initiate_effect = { WHO = root initiate_type = 5 initiate_rarity = 3}
			scope:created_character = { save_scope_as = initiate5 }
		}
	}


	# Now choose
	option = {
		name = regula_take_initiates_from_holy_order.a
		add_courtier = scope:initiate1
		# Remove others
		hidden_effect = {
			scope:initiate2 = {	death = {death_reason = death_disappearance}}
			scope:initiate3 = {	death = {death_reason = death_disappearance}}
			scope:initiate4 = {	death = {death_reason = death_disappearance}}
			scope:initiate5 = {	death = {death_reason = death_disappearance}}
		}
	}

	option = {
		name = regula_take_initiates_from_holy_order.b
		add_courtier = scope:initiate2
		# Remove others
		hidden_effect = {
			scope:initiate1 = {	death = {death_reason = death_disappearance}}
			scope:initiate3 = {	death = {death_reason = death_disappearance}}
			scope:initiate4 = {	death = {death_reason = death_disappearance}}
			scope:initiate5 = {	death = {death_reason = death_disappearance}}
		}
	}

	option = {
		name = regula_take_initiates_from_holy_order.c
		add_courtier = scope:initiate3
		# Remove others
		hidden_effect = {
			scope:initiate1 = {	death = {death_reason = death_disappearance}}
			scope:initiate2 = {	death = {death_reason = death_disappearance}}
			scope:initiate4 = {	death = {death_reason = death_disappearance}}
			scope:initiate5 = {	death = {death_reason = death_disappearance}}
		}
	}

	option = {
		name = regula_take_initiates_from_holy_order.d
		add_courtier = scope:initiate4
		# Remove others
		hidden_effect = {
			scope:initiate1 = {	death = {death_reason = death_disappearance}}
			scope:initiate2 = {	death = {death_reason = death_disappearance}}
			scope:initiate3 = {	death = {death_reason = death_disappearance}}
			scope:initiate5 = {	death = {death_reason = death_disappearance}}
		}
	}

	option = {
		name = regula_take_initiates_from_holy_order.e
		add_courtier = scope:initiate5
		# Remove others
		hidden_effect = {
			scope:initiate1 = {	death = {death_reason = death_disappearance}}
			scope:initiate2 = {	death = {death_reason = death_disappearance}}
			scope:initiate3 = {	death = {death_reason = death_disappearance}}
			scope:initiate4 = {	death = {death_reason = death_disappearance}}
		}
	}
}
