﻿# Elope with your close family lover.
# If you want to marry your lover, but your faith forbids it, you cant use ability to Elope with your close family lover and become landless adventurers.
# Your lover will change his/her father and mother so you could marry.(However the real father and mother will remain the same.)
# You'll both get a lot of penalties and it's available only once in a lifetime.

# You can elope even if you are at the same court. But your lover still should not be a ruler.


familyromance_elope_with_family_interaction = {
	icon = icon_scheme_elope
    category = interaction_category_friendly
    
    desc = elope_interaction_desc
    	
	notification_text = elope_interaction_notification
	
	is_shown = {
		has_ep3_dlc_trigger = yes
		
		scope:actor = {
			is_ai = no
			is_adult = yes
			is_playable_character = yes			
			
			# It's available once in a lifetime.
			NOT = { has_character_flag = had_elope_with_family_lover }
						
			OR = {
				has_relation_lover = scope:recipient
				has_relation_soulmate = scope:recipient
				
				#AND = {
				#	is_landless_adventurer = yes
				#	has_perk = accomplished_forger_perk
				#}
			}
	

		}
		scope:recipient = {
						
			NOR = {				
				is_spouse_of = scope:actor
				is_consort_of = scope:actor
			}
						
			OR = {
				is_child_of = scope:actor
				is_sibling_of = scope:actor
				is_parent_of = scope:actor
			}
						
			# You can't marry this character because of your faith...
			
			NOT = { could_marry_character_trigger = { CHARACTER = scope:actor } }
				
			# But you can marry this character if we don't count faith restrictions by consanguinity.
			familyromance_could_marry_no_religion_trigger = { CHARACTER = scope:actor }
			
		}
	}
	
	
	is_valid_showing_failures_only = {
		scope:recipient = {
			is_at_war = no
			is_available_adult = yes
			has_contagious_deadly_disease_trigger = no
			
			## Taken from Elope Core triggers, elope_interaction
			is_courtier = yes
			
			in_diplomatic_range = scope:actor
		}		
		
		scope:actor = {
			is_valid_for_laampdom = yes
			is_at_war = no
			is_available_adult = yes

			has_contagious_deadly_disease_trigger = no
		}		
		
	}
	
	
	ai_accept = {
		base = 0
		
		
		## From 00_marriage_scripted_modifiers.txt
		modifier = {
			NOT = { has_relation_soulmate = scope:actor }
			add = {
				value = -25
				if = {
					limit = {
						is_married = yes
					}
					add = -25
				}
			}
			desc = AI_ELOPE_CONSEQUENCES
		}
		
		modifier = { # A lot of acceptance for yourself - you are likely already married, thus you need motivation to get rid of your spouse to marry someone better
			scope:actor = { has_perk = promising_prospects_perk }
			add = promising_prospects_self_value
			desc = PROMISING_PROSPECTS_PERK_MODIFIER
		}
		modifier = { # Dynasty Glory Perk acceptance,
			exists = scope:actor.dynasty
			scope:actor.dynasty = { has_dynasty_perk = glory_legacy_1 }
			add = glory_legacy_1_marriage_acceptance
			desc = DYNASTY_LEGACY_GLORY_MARRIAGE_ACCEPTANCE_PERK_MODIFIER
		}

		############
		# OPINIONS #
		############
		opinion_modifier = { # More likely to accept if Recipient likes the person the Actor offers for marriage
			who = scope:recipient
			opinion_target = scope:actor
			multiplier = 1
			desc = AI_OPINION_REASON
		}

		opinion_modifier = {
			trigger = { exists = scope:recipient.primary_spouse }
			who = scope:recipient
			opinion_target = scope:recipient.primary_spouse
			multiplier = -1
			desc = AI_SPOUSE_OPINION
		}


		####################
		# TIER DIFFERENCES #
		####################
		modifier = {
			elope_close_family_tiers_acceptance_value != 0
			add = elope_close_family_tiers_acceptance_value
			desc = CLOSE_FAMILY_TIERS_REASON
		}
		
		###########################
		# DYNASTY PRESTIGE LEVELS #
		###########################
		modifier = {
			scope:actor = {
				OR = {
					has_dynasty = no
					scope:actor = {
						has_dynasty = yes
						dynasty.dynasty_prestige_level = 0
					}
				}
			}
			add = -5
			desc = AI_DYNASTY_PRESTIGE_REASON
		}
		modifier = {
			scope:actor = {
				has_dynasty = yes
				dynasty.dynasty_prestige_level >= 2
			}
			add = {
				value = scope:actor.dynasty.dynasty_prestige_level
				multiply = 5
				subtract = 5 #At 0 dynasty prestige level, there should be a penalty
			}
			desc = AI_DYNASTY_PRESTIGE_REASON
		}
		
		## From 00_marriage_scripted_modifiers.txt
		
		
		
	}

	
	on_accept = {
		scope:actor = {
			stress_impact = {
				honest = minor_stress_impact_gain
				just = minor_stress_impact_gain
			}
			show_as_tooltip = {
				elope_success_effect = {
					TARGET = scope:recipient
					OWNER = scope:actor
				}
			}
		}
		
		
		hidden_effect = {
			scope:actor = { trigger_event = elope_familyromance.0001 }
		}
		
	}
	
	
	on_decline = {
		scope:actor = {
			send_interface_toast = {
				type = event_toast_effect_bad
				title = elope_interaction_decline_toast
				left_icon = scope:recipient
			}
		}
	}
	
}
	