rapta_maritus = {
	skill = intrigue
	hostile = yes
	icon = icon_scheme_personal


	uses_agents = no
	power_per_skill_point = 50.0
	resistance_per_skill_point = 0
	power_per_agent_skill_point = 5
	
	minimum_progress_chance = 40
	maximum_progress_chance = 95
	minimum_success = 5
	maximum_secrecy = 95
	maximum_success = 95
	
	allow = {
		is_adult = yes
		is_imprisoned = no
		is_married = yes
	}
	
	valid = {
		OR = {
			NOT = { is_parent_of = scope:target }
			has_trait_with_flag = can_murder_own_children
		}
		scope:target = {
			is_imprisoned = no
			exists = location
		}
		# Special AI exceptions
	}

	base_success_chance = {
		base = 25
		
		hostile_scheme_base_chance_modifier = yes
		
		compare_modifier = {
			desc = "sway_my_diplomacy"
			target = scope:owner
			value = intrigue
			multiplier = 5
		}

		# At War
		first_valid = {
			modifier = {
				add = -20
				desc = "SCHEME_AT_WAR"
				scope:target = {
					is_at_war_with = scope:owner
				}
			}
			modifier = {
				add = -15
				scope:target = {
					is_landed = no
					exists = liege
					liege = {
						is_at_war_with = scope:owner
					}
				}
				desc = "SCHEME_AT_WAR_WITH_LIEGE"
			}
			modifier = {
				add = -10
				scope:target = {
					is_landed = yes
					exists = liege
					liege = {
						is_at_war_with = scope:owner
					}
				}
				desc = "SCHEME_AT_WAR_WITH_LIEGE"
			}
		}
	}
		
	cooldown = { years = 3 }
	is_secret = yes
	base_secrecy = 25 # No one expects their own spouse.

	on_ready = {
		scheme_owner = {
			if = {
				limit = {
					has_character_flag = is_in_event_rapta_maritus_outcome_0001
				}
				trigger_event = {
					id = rapta_maritus_outcome.0001
					days = 1
				}
			}
			else = {
				trigger_event = rapta_maritus_outcome.0001
			}
		}
	}

	on_monthly = {
		hostile_scheme_discovery_chance_effect = yes
		if = {
			limit = {
				NOT = { exists = scope:discovery_event_happening }
			}			
			scheme_owner = {
				trigger_event = {
					on_action = rapta_maritus_ongoing
					days = { 1 30 }
				}
			}
		}
	}

	
	on_invalidated = {
		if = {
			limit = {
				scope:target = { is_alive = no }
			}
			global_var:magister_character = {	
				send_interface_toast = {
					title = rapta_maritus_scheme_invalidated_title
					left_icon = scope:owner
					right_icon = scope:target
					custom_description_no_bullet = {
						object = scope:target
						text = scheme_target_died
					}
				}
			}
		}
		else_if = {
			limit = {
				scope:target = {
					is_imprisoned = yes
					imprisoner = scope:owner
				}
				scope:owner = {
					NOT = { has_character_flag = is_in_event_rapta_maritus_outcome_0001 } #You probably abducted them
				}
			}
			global_var:magister_character = {  
				send_interface_message = {
					title = rapta_maritus_scheme_invalidated_title
					type = rapta_maritus_invalidated_i_imprisoned_message
					desc = rapta_maritus_scheme_i_imprisoned_them_message
					left_icon = scope:target
				}
			}
		}
		else_if = {
			limit = {
				scope:target = { is_imprisoned = yes }
			}
			scope:target.imprisoner = {
				save_scope_as = other_imprisoner
			}
			global_var:magister_character = {
				send_interface_toast = {
					title = rapta_maritus_scheme_invalidated_title
					left_icon = scope:target
					right_icon = scope:other_imprisoner
					custom_description_no_bullet = {
						subject = scope:other_imprisoner
						object = scope:target
						text = scheme_target_imprisoned_by_other
					}
				}
			}
		}
		else_if = {
			limit = {
				global_var:magister_character = {
					is_alive = no
				}
			}
			scope:scheme = {
				end_scheme = yes
			}
		}
	}
	
	success_desc = "RAPTA_MARITUS_SUCCESS_DESC"
	discovery_desc = "RAPTA_MARITUS_DISCOVERY_DESC"
}