﻿#leftovers from a much earlier build. May reimplement one day
namespace = achaemenid_pulse

achaemenid_pulse.0001 = { #a Zoroastrian Scholar comes to court, but brings conversions with him
	type = character_event
	title = achaemenid_pulse.0001.t
	desc = achaemenid_pulse.0001.desc
	theme = culture_change
	left_portrait = root
	right_portrait = scope:zoroastrian_scholar
	
	trigger = {
		NOT = { has_character_flag = recent_avestan_event }
		culture = { has_cultural_pillar = heritage_iranian }
	}
	
	weight_multiplier = {
		base = 1
	}
	
	immediate = {
		add_character_flag = { 
			flag = recent_avestan_event
			months = 6
		}
		random_realm_county = {
			limit = {
				NOT = { faith = faith:mazdayasna }
				culture = { has_cultural_pillar = heritage_iranian }
			}
			set_county_faith = faith:mazdayasna
			add_county_modifier = zoroastrian_scholar_county_modifier
			save_scope_as = converted_county
		}
		create_character = {
			save_scope_as = zoroastrian_scholar
			age = { 30 60 }
			random_traits_list = {
				count = 1
				education_learning_2 = {}
				education_learning_3 = {}
				education_learning_4 = {}
			}
			random_traits = yes
			trait = gathas_scholar
			trait = diligent
	
			faith = faith:mazdayasna
			culture = culture:persian
			gender = male
			learning = { 14 22 }
			employer = root

			after_creation = {
				add_character_flag = {
					flag = need_priest_outfit
				}
				add_character_flag = {
					flag = is_zoroastrian_scholar
				}
				add_trait_xp = {
					trait = gathas_scholar
					track = scholar
					value = 100
				}
				random = {
					chance = 50
					add_trait = ambitious
				}
			}
		}
	}
	
	option = {
		name = achaemenid_pulse.0001.a
		custom_label = achaemenid_pulse.0001.a.county_conversion_custom
		add_character_modifier = {
			modifier = zoroastrian_scholar_character_modifier
			years = 5
		}
		root.capital_county = {
			if = {
				limit = {
					root.capital_county = {
						NOT = { faith = faith:mazdayasna }
					}
				}
				random = {
					chance = 50
					set_county_faith = faith:mazdayasna
				}
				add_county_modifier = {
					modifier = zoroastrian_scholar_county_modifier
					years = 5
				}
			}
			if = {
				limit = {
					root.capital_county = {
						faith = faith:mazdayasna
					}
				}
				add_county_modifier = {
					modifier = zoroastrian_scholar_county_modifier_powerful
					years = 5
				}
			}
		}
		send_interface_toast = {
			title = achaemenid_pulse.0001.a.recruit.scholar
			left_icon = scope:zoroastrian_scholar
		}
		ai_chance = {
			base = 100
		}
	}
	option = {
		name = achaemenid_pulse.0001.b
		if = {
			limit = {
				NOT = { root.faith = faith:mazdayasna }
			}
			add_piety = 50
		}
		else = {
			add_piety = -50
		}
	}
	option = {
		trigger = {
			NOT = { root.faith = faith:mazdayasna }
		}
		name = achaemenid_pulse.0001.c
		scope:converted_county = {
			set_county_faith = root.faith
			add_county_modifier = {
				modifier = zoroastrian_scholar_county_modifier_forced_conversion
				years = 5
			}
		}
	}
	option = {
		name = achaemenid_pulse.0001.d
		trigger = {
			AND = {
				root = {
					has_trait = zealous
				}
				NOT = { root.faith = faith:mazdayasna }
			}
		}
		exclusive = yes
		scope:converted_county = {
			set_county_faith = root.faith
			add_county_modifier = {
				modifier = zoroastrian_scholar_county_modifier_forced_conversion_extreme
				years = 5
			}
		}
		hidden_effect = {
			every_realm_county = {
				limit = {
					religion = religion:zoroastrianism_religion
				}
				add_county_modifier = {
					modifier = zoroastrian_scholar_county_modifier_upset
					years = 5
				}
			}
		}
		if = {
			limit = {
				NOT = {
					scope:converted_county.culture = root.culture
				}
			}
			scope:converted_county.culture = {
				change_cultural_acceptance = {
					target = root.culture
					value = -3
					desc = cultural_acceptance_historical_relations
				}
			}
		}
		custom_label = zoroastrian_scholar_burn_them_all_custom
		custom_label = zoroastrian_scholar_county_modifier_upset_tooltip_custom
		add_piety = 250
	}
}

achaemenid_pulse.0002 = { #Zoroastrian Scholar wants you to land him
	type = character_event
	title = achaemenid_pulse.0002.t
	desc = achaemenid_pulse.0002.desc
	theme = culture_change
	left_portrait = root
	right_portrait = scope:zoroastrian_scholar
	
	trigger = {
		any_courtier_or_guest = {
			AND = {
				has_character_flag = is_zoroastrian_scholar
				has_trait = ambitious
			}
		}
	}	
	
	immediate = {
		random_vassal_or_below = {
			limit = {
				culture = {
					NOT = { has_cultural_pillar = heritage_iranian }
				}
				any_held_title = {
					OR = {
						tier = tier_duchy
						tier = tier_kingdom
					}
				}
			}
			add_character_flag = chosen_guest
			save_scope_as = chosen_vassal
		}
		random_courtier_or_guest = {
			limit = {
				AND = {
					has_character_flag = is_zoroastrian_scholar
					has_trait = ambitious
				}
			}
			save_scope_as = ambitious_scholar
		}
	}
	
	option = {
		name = achaemenid_pulse.0002.a
		scope:chosen_vassal = {
			create_title_and_vassal_change = {
				type = usurped
				save_scope_as = change
				add_claim_on_loss = yes
			}
			every_held_title = {
				change_title_holder_include_vassals = {
					holder = scope:ambitious_scholar
					change = scope:change
				}
			}
			resolve_title_and_vassal_change = scope:change
			remove_character_flag = chosen_guest
			set_relation_rival = {
				target = root
				reason = stole_land_for_scholar
			}
			set_relation_rival = {
				target = scope:ambitious_scholar
				reason = thieving_scholar
			}
		}
		scope:ambitious_scholar = {
			add_character_modifier = zoroastrian_scholar_land_demand_success
			set_relation_friend = {
				target = root
				reason = granted_scholar_land
			}
		}
		root = {
			add_tyranny = 30
		}
	}
	
	option = {
		name = achaemenid_pulse.0002.b
		scope:ambitious_scholar = {
			add_character_flag = scorned_scholar
			remove_character_flag = ambitious_scholar
			set_relation_rival = {
				target = root
				reason = refused_to_steal_land_for_scholar
			}
		}
		scope:root = {
			remove_character_modifier = zoroastrian_scholar_character_modifier
			add_trait_xp = {
				trait = gathas_scholar
				track = scholar
				value = -25
			}
			add_trait_xp = {
				trait = gathas_scholar
				track = avestan
				value = -25
			}
			custom_tooltip = {
				text = scholar_steals_notes_custom
			}
		}
		scope:chosen_vassal = {
			add_opinion = {
				modifier = grateful_opinion
				opinion = 25
				years = 5
				target = root
			}
		}
	}
}
		
		