﻿namespace = holy_stuff_establish_pilgrim_souvenir_industry_event

##################################################
# Establish Pilgrim Souvenir Industry
##################################################

holy_stuff_establish_pilgrim_souvenir_industry_event.0001 = {
	hidden = yes

	immediate = {
		every_held_title = {
			limit = { 
				tier = tier_county 
			}
			add_to_list = personally_held_counties_list
		}

		ordered_in_list = {
			list = personally_held_counties_list
			max = 15
			order_by = { add = development_level }
			if = {
				limit = {
					NOT = { 
						exists = scope:realmcounty_1 
					}
				}
				save_scope_as = realmcounty_1
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						exists = scope:realmcounty_2
					}
				}
				save_scope_as = realmcounty_2
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						exists = scope:realmcounty_3
					}
				}
				save_scope_as = realmcounty_3
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						exists = scope:realmcounty_4
					}
				}
				save_scope_as = realmcounty_4
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						exists = scope:realmcounty_5
					}
				}
				save_scope_as = realmcounty_5
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						this = scope:realmcounty_5
						exists = scope:realmcounty_6
					}
				}
				save_scope_as = realmcounty_6
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						this = scope:realmcounty_5
						this = scope:realmcounty_6
						exists = scope:realmcounty_7
					}
				}
				save_scope_as = realmcounty_7
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						this = scope:realmcounty_5
						this = scope:realmcounty_6
						this = scope:realmcounty_7
						exists = scope:realmcounty_8
					}
				}
				save_scope_as = realmcounty_8
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						this = scope:realmcounty_5
						this = scope:realmcounty_6
						this = scope:realmcounty_7
						this = scope:realmcounty_8
						exists = scope:realmcounty_9
					}
				}
				save_scope_as = realmcounty_9
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						this = scope:realmcounty_5
						this = scope:realmcounty_6
						this = scope:realmcounty_7
						this = scope:realmcounty_8
						this = scope:realmcounty_9
						exists = scope:realmcounty_10
					}
				}
				save_scope_as = realmcounty_10
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						this = scope:realmcounty_5
						this = scope:realmcounty_6
						this = scope:realmcounty_7
						this = scope:realmcounty_8
						this = scope:realmcounty_9
						this = scope:realmcounty_10
						exists = scope:realmcounty_11
					}
				}
				save_scope_as = realmcounty_11
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						this = scope:realmcounty_5
						this = scope:realmcounty_6
						this = scope:realmcounty_7
						this = scope:realmcounty_8
						this = scope:realmcounty_9
						this = scope:realmcounty_10
						this = scope:realmcounty_11
						exists = scope:realmcounty_12
					}
				}
				save_scope_as = realmcounty_12
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						this = scope:realmcounty_5
						this = scope:realmcounty_6
						this = scope:realmcounty_7
						this = scope:realmcounty_8
						this = scope:realmcounty_9
						this = scope:realmcounty_10
						this = scope:realmcounty_11
						this = scope:realmcounty_12
						exists = scope:realmcounty_13
					}
				}
				save_scope_as = realmcounty_13
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						this = scope:realmcounty_5
						this = scope:realmcounty_6
						this = scope:realmcounty_7
						this = scope:realmcounty_8
						this = scope:realmcounty_9
						this = scope:realmcounty_10
						this = scope:realmcounty_11
						this = scope:realmcounty_12
						this = scope:realmcounty_13
						exists = scope:realmcounty_14
					}
				}
				save_scope_as = realmcounty_14
			}
			else_if = {
				limit = {
					NOR = {
						this = scope:realmcounty_1
						this = scope:realmcounty_2
						this = scope:realmcounty_3
						this = scope:realmcounty_4
						this = scope:realmcounty_5
						this = scope:realmcounty_6
						this = scope:realmcounty_7
						this = scope:realmcounty_8
						this = scope:realmcounty_9
						this = scope:realmcounty_10
						this = scope:realmcounty_11
						this = scope:realmcounty_12
						this = scope:realmcounty_13
						this = scope:realmcounty_14
						exists = scope:realmcounty_15
					}
				}
				save_scope_as = realmcounty_15
			}
		}
		trigger_event = holy_stuff_establish_pilgrim_souvenir_industry_event.0002
	}
}

# First selection event
holy_stuff_establish_pilgrim_souvenir_industry_event.0002 = { 
	title = holy_stuff_establish_pilgrim_souvenir_industry_event.0002.t
	desc = holy_stuff_establish_pilgrim_souvenir_industry_event.0002.desc
	theme = stewardship_domain_focus
	override_background = {
		reference = study
	}
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:realm_steward
		animation = steward
	}

	immediate = {
		play_music_cue = "mx_cue_patronage"

		cp:councillor_steward = {
			save_scope_as = realm_steward
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0002.a
		trigger = {
			exists = scope:realmcounty_1
		}
		scope:realmcounty_1 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0002.b
		trigger = {
			exists = scope:realmcounty_2
		}
		scope:realmcounty_2 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0002.c
		trigger = {
			exists = scope:realmcounty_3
		}
		scope:realmcounty_3 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0002.d
		trigger = {
			exists = scope:realmcounty_4
		}
		scope:realmcounty_4 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0002.e
		trigger = {
			exists = scope:realmcounty_5
		}
		scope:realmcounty_5 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0002.f
		trigger = {
			exists = scope:realmcounty_6
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0003
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0002.g

		remove_decision_cooldown = establish_pilgrim_souvenir_industry_decision
	}
}

# Second selection event
holy_stuff_establish_pilgrim_souvenir_industry_event.0003 = { 
	title = holy_stuff_establish_pilgrim_souvenir_industry_event.0003.t
	desc = holy_stuff_establish_pilgrim_souvenir_industry_event.0003.desc
	theme = stewardship_domain_focus
	override_background = {
		reference = study
	}
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:realm_steward
		animation = steward
	}

	immediate = {
		play_music_cue = "mx_cue_patronage"

		cp:councillor_steward = {
			save_scope_as = realm_steward
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0003.a
		trigger = {
			exists = scope:realmcounty_6
		}
		scope:realmcounty_6 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0003.b
		trigger = {
			exists = scope:realmcounty_7
		}
		scope:realmcounty_7 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0003.c
		trigger = {
			exists = scope:realmcounty_8
		}
		scope:realmcounty_8 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0003.d
		trigger = {
			exists = scope:realmcounty_9
		}
		scope:realmcounty_9 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}


	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0003.e
		trigger = {
			exists = scope:realmcounty_10
		}
		scope:realmcounty_10 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0003.f
		trigger = {
			exists = scope:realmcounty_11
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0004
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0003.g

		remove_decision_cooldown = establish_pilgrim_souvenir_industry_decision
	}
}

# Third selection event
holy_stuff_establish_pilgrim_souvenir_industry_event.0004 = { 
	title = holy_stuff_establish_pilgrim_souvenir_industry_event.0004.t
	desc = holy_stuff_establish_pilgrim_souvenir_industry_event.0004.desc
	theme = stewardship_domain_focus
	override_background = {
		reference = study
	}
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:realm_steward
		animation = steward
	}

	immediate = {
		play_music_cue = "mx_cue_patronage"

		cp:councillor_steward = {
			save_scope_as = realm_steward
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0004.a
		trigger = {
			exists = scope:realmcounty_11
		}
		scope:realmcounty_11 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0004.b
		trigger = {
			exists = scope:realmcounty_12
		}
		scope:realmcounty_12 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0004.c
		trigger = {
			exists = scope:realmcounty_13
		}
		scope:realmcounty_13 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0004.d
		trigger = {
			exists = scope:realmcounty_14
		}
		scope:realmcounty_14 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}


	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0004.e
		trigger = {
			exists = scope:realmcounty_15
		}
		scope:realmcounty_15 = {
            	save_scope_as = pilgrim_souvenir_county
		}
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0005
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0004.f
		trigger_event = {
			id = holy_stuff_establish_pilgrim_souvenir_industry_event.0002
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0004.g

		remove_decision_cooldown = establish_pilgrim_souvenir_industry_decision
	}
}

# Modifier selection event
holy_stuff_establish_pilgrim_souvenir_industry_event.0005 = { 
	title = holy_stuff_establish_pilgrim_souvenir_industry_event.0005.t
	desc = holy_stuff_establish_pilgrim_souvenir_industry_event.0005.desc
	theme = stewardship_domain_focus
	override_background = {
		reference = study
	}
	left_portrait = {
		character = root
		animation = personality_rational
	}
	right_portrait = {
		character = scope:realm_steward
		animation = steward
	}

	immediate = {
		play_music_cue = "mx_cue_patronage"

		cp:councillor_steward = {
			save_scope_as = realm_steward
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0005.a
		scope:pilgrim_souvenir_county = {
            	add_county_modifier = { 
				modifier = pilgrim_badge_production_modifier
				years = 25
	      	}
		}
		root = {
			remove_short_term_gold = pilgrim_souvenier_industry_gold_value
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0005.b
		trigger = {
			culture = {
				has_cultural_era_or_later = culture_era_late_medieval
			}
			capital_province = { geographical_region = holy_stuff_rhineland }
		}
		scope:pilgrim_souvenir_county = {
            	add_county_modifier = { 
				modifier = pilgrim_horn_production_modifier
				years = 25
	      	}
		}
		root = {
			remove_short_term_gold = pilgrim_souvenier_industry_gold_value
		}
	}

	option = { 
		name = holy_stuff_establish_pilgrim_souvenir_industry_event.0005.c
		trigger = {	
			culture = {
				has_cultural_era_or_later = culture_era_late_medieval
			}
		}
		scope:pilgrim_souvenir_county = {
            	add_county_modifier = { 
				modifier = pilgrim_mirror_production_modifier
				years = 25
	      	}
		}
		root = {
			remove_short_term_gold = pilgrim_souvenier_industry_gold_value
		}
	}
}
