﻿
POD_transmogrify_interaction = {
	category = interaction_category_vampire
	icon = POD_vicissitude_interaction
	desc = POD_transmogrify_interaction_desc

	is_shown = {
		scope:actor != scope:recipient
		scope:actor = { has_vicissitude_trigger = yes }
		scope:actor = { has_perk = malleable_visage_perk }
		# not mental but this will exclude some non-fleshy characters
		POD_hostile_mental_interaction_is_shown = yes
	}

	is_valid_showing_failures_only = {
		scope:actor = { POD_has_enough_blood_for_discipline = { AMOUNT = 1 } }
		scope:recipient = {
			custom_description = {
				text = POD_ruler_not_imprisoned_vicissic_text
				OR = {
					is_imprisoned_by = scope:actor
					is_ruler = no
				}
			}
			POD_is_not_incorporeal_spirit = yes
		}
		POD_interaction_is_valid_showing_failures_only = yes
	}

	on_accept = {
		#costs are in the event
		#scope:actor = { POD_willpower_rouse_check_effect = yes }
		#scope:actor = { POD_discipline_cost_effect = { COUNT = 1 } }
		scope:recipient = { save_scope_as = transmogrifiee }
		scope:actor = { save_scope_as = transmogrifier }
		if = {
			limit = {
				OR = {
					scope:recipient = { is_imprisoned_by = scope:actor }
					scope:recipient = { can_start_single_combat_trigger = no }
					scope:actor = {
						has_hook_of_type = {
							target = scope:recipient
							type = strong_bloodoath_hook
						}
					}
				}
			}
			scope:actor = {
				save_scope_as = transmogrifier
				trigger_event = POD_transmogrify.100
			}
		}
		else = {
			custom_tooltip = POD_overpower_vicissic_tt
			scope:actor = {
				configure_start_single_combat_effect = {
					SC_INITIATOR = scope:actor
					SC_ATTACKER = scope:actor
					SC_DEFENDER = scope:recipient
					FATALITY = no
					FIXED = no
					LOCALE = throne_room
					OUTPUT_EVENT = POD_transmogrify.101
					INVALIDATION_EVENT = tribal.1022
				}
			}
		}
		scope:recipient = {
			add_opinion = {
				target = scope:actor
				modifier = hurt_opinion
				opinion = -40
			}
			progress_towards_rival_effect = {
				CHARACTER = scope:actor
				REASON = rival_cast_spell
				OPINION = 0
			}
		}
	}
	
	auto_accept = yes
	
	ai_will_do = {
		base = 0
	}
}

POD_liquefy_the_mortal_coil_interaction = {
	category = interaction_category_vampire
	icon = POD_vicissitude_interaction
	desc = POD_liquefy_the_mortal_coil_interaction_desc

	is_shown = {
		scope:actor != scope:recipient
		scope:actor = { has_vicissitude_trigger = yes }
		scope:actor = { has_perk = liquefy_the_mortal_coil_perk }
		# not mental but this will exclude some non-fleshy characters
		POD_hostile_mental_interaction_is_shown = yes
	}

	is_valid_showing_failures_only = {
		scope:actor = { POD_has_enough_blood_for_discipline = { AMOUNT = 5 } }
		scope:recipient = {
			POD_is_not_incorporeal_spirit = yes
		}
		POD_interaction_is_valid_showing_failures_only = yes
	}

	send_options_exclusive = no
	
	send_option = {
		is_shown = {
			scope:recipient = { POD_is_trait_not_permanent_trigger = { TRAIT = disfigured } }
		}
		flag = disfigured
		localization = trait_disfigured
	}
	send_option = {
		is_shown = {
			scope:recipient = { POD_is_trait_not_permanent_trigger = { TRAIT = blind } }
		}
		is_valid = {
			scope:one_eyed = no
		}
		flag = blind
		localization = trait_blind
	}
	send_option = {
		is_shown = {
			scope:recipient = { POD_is_trait_not_permanent_trigger = { TRAIT = maimed } }
		}
		flag = maimed
		localization = trait_maimed
	}
	send_option = {
		is_shown = {
			scope:recipient = { POD_is_trait_not_permanent_trigger = { TRAIT = one_legged } }
		}
		flag = one_legged
		localization = trait_one_legged
	}
	send_option = {
		is_shown = {
			scope:recipient = { POD_is_trait_not_permanent_trigger = { TRAIT = one_eyed } }
		}
		is_valid = {
			scope:blind = no
		}
		flag = one_eyed
		localization = trait_one_eyed
	}
	send_option = {
		is_shown = {
			scope:recipient = { POD_is_trait_not_permanent_trigger = { TRAIT = eunuch_1 } }
		}
		flag = eunuch
		localization = trait_eunuch_1
	}

	can_send = {
		custom_description = {
			text = send_option_selected
			OR = {
				scope:disfigured ?= yes
				scope:blind ?= yes
				scope:maimed ?= yes
				scope:one_legged ?= yes
				scope:one_eyed ?= yes
				scope:eunuch ?= yes
			}
		}
	}

	on_accept = {
		scope:actor = {
			POD_discipline_cost_effect = { COUNT = 5 }
		}
		scope:recipient = {
			add_opinion = {
				target = scope:actor
				modifier = hurt_opinion
				opinion = -50
			}
			progress_towards_rival_effect = {
				CHARACTER = scope:actor
				REASON = rival_cast_spell
				OPINION = 0
			}
		}
		scope:actor = {
			duel = {
				skills = { diplomacy intrigue }
				target = scope:recipient
				20 = {
					desc = POD_shared_loca_success
					compare_modifier = {
						value = scope:duel_value
						multiplier = high_positive_duel_skill_multiplier
					}
					if = {
						limit = { scope:disfigured = yes }
						scope:recipient = {
							POD_give_semi_permanent_injury_effect = { TRAIT = disfigured TIME = 10 }
						}
					}
					if = {
						limit = { scope:blind = yes }
						scope:recipient = {
							POD_give_semi_permanent_injury_effect = { TRAIT = blind TIME = 10 }
						}
					}
					if = {
						limit = { scope:maimed = yes }
						scope:recipient = {
							POD_give_semi_permanent_injury_effect = { TRAIT = maimed TIME = 10 }
						}
					}
					if = {
						limit = { scope:one_legged = yes }
						scope:recipient = {
							POD_give_semi_permanent_injury_effect = { TRAIT = one_legged TIME = 10 }
						}
					}
					if = {
						limit = { scope:one_eyed = yes }
						scope:recipient = {
							POD_give_semi_permanent_injury_effect = { TRAIT = one_eyed TIME = 10 }
						}
					}
					if = {
						limit = { scope:eunuch = yes }
						scope:recipient = {
							POD_give_semi_permanent_injury_effect = { TRAIT = eunuch_1 TIME = 10 }
						}
					}
					min = 1
				}
				50 = {
					desc = POD_shared_loca_failure
					compare_modifier = {
						value = scope:duel_value
						multiplier = low_negative_duel_skill_multiplier
					}
					scope:actor = {
						add_stress = medium_stress_impact_gain
						add_piety = medium_piety_loss
					}
					modifier = {
						add = 10
						scope:disfigured = yes
					}
					modifier = {
						add = 20
						scope:blind = yes
					}
					modifier = {
						add = 15
						scope:maimed = yes
					}
					modifier = {
						add = 15
						scope:one_legged = yes
					}
					modifier = {
						add = 10
						scope:one_eyed = yes
					}
					modifier = {
						add = 10
						scope:eunuch = yes
					}
					min = 1
				}
			}
		}
	}
	
	auto_accept = yes
	
	#ai_potential = {
	#	# The basic requirements
	#	is_imprisoned = no
	#	is_landed = yes
	#}
	#ai_targets = {
	#	ai_recipients = primary_war_enemies
	#}
	
	ai_will_do = {
		base = 0
		
		modifier = {
			add = 45
			scope:actor = {
				is_at_war_with = scope:recipient
			}
		}
		modifier = {
			factor = 2
			scope:actor = {
				has_any_bad_relationship_with_character_trigger = {
					CHARACTER = scope:recipient
				}
			}
		}
		modifier = {
			factor = 0
			scope:recipient = {
				is_ai = no
			}
		}
	}
}

POD_will_over_form_interaction = {
	category = interaction_category_vampire
	icon = POD_vicissitude_interaction
	desc = POD_will_over_form_interaction_desc

	is_shown = {
		scope:actor = { has_vicissitude_trigger = yes }
		scope:actor = { has_perk = will_over_form_perk }
		# not mental but this will exclude some non-fleshy characters
		POD_hostile_mental_interaction_is_shown = yes
	}
	
	is_valid_showing_failures_only = {
		scope:recipient = {
			POD_is_not_incorporeal_spirit = yes
		}
		POD_interaction_is_valid_showing_failures_only = yes
	}

	can_send = {
		scope:actor = {
			POD_has_enough_blood_for_discipline = { AMOUNT = POD_will_over_form_interaction_cost }
			trigger_if = {
				limit = { scope:physical_trait ?= yes }
				POD_reweaving_is_valid_showing_failures_only = yes
			}
		}
	}

	send_option = {
		flag = vicissitudeface
		localization = POD_vampshapeshift_interaction_vicissitudeface
	}

	send_option = {
		is_shown = {
			scope:recipient = {
				has_character_flag = had_POD_character_tzimisce_looks
			}
		}
		flag = revertvicissitudeface
		localization = POD_vampshapeshift_interaction_revertvicissitudeface
	}

	send_option = {
		is_shown = {
			scope:recipient = {
				is_immortal = yes
			}
		}
		is_valid = {
			scope:recipient = {
				NOT = { has_character_modifier = baba_yagas_curse_modifier }
			}
		}
		flag = immortal_age
		localization = POD_shapeshift_interaction_immortal_age
	}

	send_option = {
		is_valid = {
			scope:actor = {
				custom_tooltip = {
					text = POD_will_over_form_interaction.physical_trait.tt
					has_variable_list = known_true_name_traits
				}
			}
		}
		flag = physical_trait
		localization = TRAIT_CATEGORY_PHYSICAL
	}

	on_accept = {
		scope:actor = {
			POD_discipline_cost_effect = { COUNT = POD_will_over_form_interaction_cost }
			# Vicissitude Gui #
			if = {
				limit = {
					scope:vicissitudeface = yes
				}
				POD_willpower_rouse_check_effect = yes
				
				if = {
					limit = { scope:actor != scope:recipient }
					scope:actor = { add_piety = -500 }
				}
				set_variable = {
					name = vicissitude_target
					value = scope:recipient
				}
				scope:recipient = {
					POD_moderate_risk_of_increasing_masquerade_exposure = yes
					add_character_flag = had_POD_character_tzimisce_looks
					#POD_shapeshift_vicissitude_face_randomize_effect = yes
				}
			}
			if = {
				limit = {
					scope:revertvicissitudeface = yes
				}
				POD_willpower_rouse_check_effect = yes
				scope:recipient = {
					POD_shapeshift_vicissitude_face_revert_effect = yes
					POD_minimal_chance_of_reducing_masquerade_exposure = yes
					remove_character_flag = had_POD_character_tzimisce_looks
				}
			}
			if = {
				limit = {
					scope:immortal_age = yes
				}
				POD_willpower_rouse_check_effect = yes
				if = {
					limit = { scope:actor != scope:recipient }
					scope:actor = { add_piety = -500 }
				}
				scope:actor = {
					trigger_event = POD_transmogrify.701
				}
			}
			if = {
				limit = {
					scope:physical_trait = yes
				}
				set_variable = {
					name = reweaving_recipient
					value = scope:recipient
				}
				set_variable = {
					name = reweaving_ability
					value = flag:vicissitude
				}
				scope:recipient = {
					add_character_flag = physical_trait_only
				}
			}
			if = {
				limit = { scope:actor != scope:recipient }
				scope:recipient = {
					add_opinion = {
						target = scope:actor
						modifier = hurt_opinion
						opinion = -50
					}
				}
			}
		}
	}
	
	auto_accept = yes
	
	ai_will_do = {
		base = 0
	}
}

POD_study_anatomy_interaction = {
	category = interaction_category_vampire
	icon = POD_vicissitude_interaction
	desc = POD_study_anatomy_interaction_desc

	is_shown = {
		scope:actor != scope:recipient
		scope:actor = { has_trait = vicissitudeadvanced }
		scope:recipient = { NOT = { has_character_flag = is_being_tortured } }
		# not mental but this will exclude some non-fleshy characters
		POD_hostile_mental_interaction_is_shown = yes
	}

	is_valid_showing_failures_only = {
		scope:recipient = {
			is_adult = yes
			is_imprisoned_by = scope:actor
			NOT = { has_character_modifier = recently_tortured }
			custom_tooltip = {
				text = POD_study_anatomy_interaction_trait_requirement
				any_character_trait = {
					POD_can_study_anatomy_trait = { SCHOLAR = scope:actor }
				}
			}
			POD_is_not_incorporeal_spirit = yes
		}
		POD_interaction_is_valid_showing_failures_only = yes
	}

	on_accept = {
		scope:actor = {
			if = {
				# Only one eligible trait? No need to show the selection GUI
				limit = {
					scope:recipient = {
						any_character_trait = {
							POD_can_study_anatomy_trait = { SCHOLAR = scope:actor }
							save_temporary_scope_as = anatomy_trait
							count = 1
						}
					}
				}
				POD_start_anatomy_study_journey_effect = { TRAIT = scope:anatomy_trait }

				POD_torture_interaction_effect = yes
			}
			else = {
				custom_tooltip = {
					text = POD_study_anatomy_interaction_select_traits_tt
					trigger_event = POD_transmogrify.1003
				}
			}
		}
	}
	
	auto_accept = yes
	
	ai_will_do = {
		base = 0
	}
}