﻿#########################################
# Regula Character Interactions (Debug) #
######################################################
# This file has the debug character interactions
# Only useful when in dev mode
##
# Debug Interactions
## regula_expose_covert_character_interaction - Expose the "Spellbound" secret
## regula_gene_mod - Add the flag "dna_change_example_modifier" to this character to test portrait changes
## regula_debug_fascinare_interaction - Instantly makes the target a Mulsa, NOTE does not follow the regular process so might be different to a regular scheme
## regula_debug_servitude_faction_interaction - Instantly makes the target start a servitude faction against their liege.
## regula_consecrate_bloodline_interaction - Forcefully run the Regula consecreate bloodline effect on this character
## regula_set_secret_faith_interaction - Make the target crypto reglua.
## regula_convert_to_secret_faith_interaction - Reveal the target's crypto regula status.
## regula_generate_raid_event_against_target_interaction - Generate a Regula raid event against this target character.
## regula_create_task_contract_interaction - Generate a Regula Task contract on current characters location.
######################################################

#### Debug Interactions ####

#Expose covert secret
regula_expose_covert_character_interaction = {
	category = interaction_debug_main
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes

	interface_priority = -1

	is_shown = {
		debug_only = yes
	}

	on_accept = {
		random_independent_ruler = {
			save_scope_as = rando
		}
		scope:recipient = {
			random_secret = {
				limit = {
					secret_type = regula_covert_conversion
				}
				expose_secret = scope:rando
			}
		}
	}
	auto_accept = yes
}

# Gene testing
regula_gene_mod = {
	category = interaction_debug_main
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes
	is_shown = {
		debug_only = yes
		NOT = { scope:recipient = scope:actor }
	}

	on_accept = {
		scope:recipient = {
			add_character_flag = {
				flag = dna_change_example_modifier
			}
		}
	}

	auto_accept = yes
}

# Instantly Charm the target
regula_debug_fascinare_interaction = {
	category = interaction_debug_main
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes

	is_shown = {
		debug_only = yes
		scope:actor = {
			has_trait = magister_trait_group
		}
		scope:recipient = {
			is_adult = yes
			is_male = no
			is_regula_devoted_trigger = no
		}
	}

	is_valid = {
		NOT = { scope:recipient = scope:actor }
	}

	on_accept = {
		scope:recipient = {
			fascinare_success_effect = { CHARACTER = scope:actor }
			create_memory_fascinare_scheme = { CHARACTER = scope:actor }
		}
	}

	auto_accept = yes

	ai_will_do = {
		base = 0
	}
}

# Instantly make the target character form a servitude faction if possible.
regula_debug_servitude_faction_interaction = {
	category = interaction_debug_main
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes

	is_shown = {
		debug_only = yes
		scope:actor = {
			has_trait = magister_trait_group
		}
		scope:recipient = {
			is_regula_devoted_trigger = yes
		}
	}

	is_valid = {
		scope:actor = {
			has_trait = magister_trait_group
		}

		scope:recipient = {
			is_regula_devoted_trigger = yes
			top_liege ?= {
				NOT = {
					any_targeting_faction = {
						regula_faction_is_servitude_faction_trigger = yes
					}
				}
			}
			can_create_faction ={
				type = regula_servitude_faction
				target = top_liege
			}
		}
	}

	on_accept = {
		scope:recipient = {
			create_faction = {
				type = regula_servitude_faction
				target = top_liege
			}
		}
	}

	auto_accept = yes

	ai_will_do = {
		base = 0
	}
}

# Forcefully run the Regula consecreate bloodline event on this character
regula_consecrate_bloodline_interaction = {
	category = interaction_debug_main
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes

	is_shown = {
		debug_only = yes
		scope:recipient = {
			has_trait = magister_trait_group
		}
	}

	is_valid = {
	}

	on_accept = {
		scope:recipient = {
			trigger_event = regula_holy_bloodline_events.0001
		}
	}

	auto_accept = yes

	ai_will_do = {
		base = 0
	}
}

# Make a character crypto-regula.
regula_set_secret_faith_interaction = {
	category = interaction_debug_main
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes

	is_shown = {
		debug_only = yes
		scope:actor = {
			has_trait = magister_trait_group
		}
		scope:recipient = {
			is_regula_trigger = no
			is_crypto_regula_trigger = no
		}
	}

	is_valid = {
		scope:actor = {
			has_trait = magister_trait_group
		}
		scope:recipient = {
			is_regula_trigger = no
			is_crypto_regula_trigger = no
		}
	}

	on_accept = {
		scope:recipient = {
			convert_to_regula_secretly_effect = {
				FAITH = scope:actor.faith
			}
		}
	}

	auto_accept = yes

	ai_will_do = {
		base = 0
	}
}

# Publicly convert a crypto regula character.
regula_convert_to_secret_faith_interaction = {
	category = interaction_debug_main
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes

	is_shown = {
		debug_only = yes
		scope:actor = {
			has_trait = magister_trait_group
		}
		scope:recipient = {
			is_crypto_regula_trigger = yes
		}
	}

	is_valid = {
		scope:actor = {
			has_trait = magister_trait_group
		}
		scope:recipient = {
			is_crypto_regula_trigger = yes
		}
	}

	on_accept = {
		scope:recipient = {
			regula_force_convert_to_secret_faith_effect = yes
		}
	}

	auto_accept = yes

	ai_will_do = {
		base = 0
	}
}

# Add debug logging for Regula Heresy stories
regula_toggle_heresy_debug_logging = {
	category = interaction_debug_main
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes
	icon = regula_heresy

	desc = {
		triggered_desc = {
			trigger = {
				regula_heresy_debug_enabled_trigger = yes
			}
			desc = regula_toggle_heresy_debug_logging_disable_desc
		}
		triggered_desc = {
			trigger = {
				regula_heresy_debug_enabled_trigger = no
			}
			desc = regula_toggle_heresy_debug_logging_enable_desc
		}
	}

	is_shown = {
		debug_only = yes
		scope:actor = {
			has_trait = magister_trait_group
		}
		scope:recipient = {
			has_trait = magister_trait_group
		}
	}

	is_valid = {
		scope:actor = {
			has_trait = magister_trait_group
		}
		scope:recipient = {
			has_trait = magister_trait_group
		}
	}

	on_accept = {
		regula_heresy_debug_toggle_effect = yes
	}

	auto_accept = yes

	ai_will_do = {
		base = 0
	}
}

# Create a Heresy story cycle
regula_start_heresy_story_cycle = {
	category = interaction_debug_main
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes
	icon = regula_heresy

	desc = regula_start_heresy_story_cycle_desc

	is_shown = {
		debug_only = yes
		scope:actor = {
			has_trait = magister_trait_group
		}
		scope:recipient = {
			has_trait = magister_trait_group
		}
	}

	is_valid = {
		scope:actor = {
			has_trait = magister_trait_group
		}
		scope:recipient = {
			has_trait = magister_trait_group
			regula_heresy_valid_trigger = yes
			regula_heresy_ongoing_trigger = no
		}
	}

	on_accept = {
		scope:recipient = {
			regula_heresy_start_story_cycle_effect = yes
		}
	}

	auto_accept = yes

	ai_will_do = {
		base = 0
	}
}

# Generate a Regula raid event against this target character.
regula_generate_raid_event_against_target_interaction = {
	category = interaction_debug_main
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes
	icon = icon_combat

	is_shown = {
		scope:actor = {
			has_trait = magister_trait_group
		}
		debug_only = yes
		NOT = { scope:recipient = scope:actor }
		scope:recipient = {
			is_landed = yes
		}
	}

	on_accept = {
		scope:actor = {
			trigger_event = regula_raiding.0002
		}
	}

	auto_accept = yes
}

# Create a Regula (Lewd!) contract
regula_create_task_contract_interaction = {
	category = interaction_debug_admin
	use_diplomatic_range = no
	ignores_pending_interaction_block = yes
	icon = icon_contract_modification_single

	interface_priority = -1

	is_shown = {
		debug_only = yes
	}

	send_option = { flag = create_task_contract_interaction_option_1 }
	send_option = { flag = create_task_contract_interaction_option_2 }
	send_option = { flag = create_task_contract_interaction_option_3 }
	send_option = { flag = create_task_contract_interaction_option_4 }
	send_option = { flag = create_task_contract_interaction_option_5 }

	is_valid_showing_failures_only = {
		valid_laamp_basic_trigger = {
			EMPLOYER = scope:recipient
			LAAMP = scope:actor
		}
	}

	on_accept = {
		scope:actor = {
			# Now fire the contract.
			switch = {
				trigger = yes
				scope:create_task_contract_interaction_option_1 = {
					create_task_contract = {
						# Comment/de-comment as appropriate for what you want to fire.
						task_contract_type = laamp_regula_0001
						task_contract_tier = 0
						location = scope:recipient.location
						task_contract_employer = scope:recipient
					}
				}
				scope:create_task_contract_interaction_option_2 = {
					regula_generate_transport_daughter_contracts = yes
				}

				scope:create_task_contract_interaction_option_3 = {
					create_task_contract = {
						# Comment/de-comment as appropriate for what you want to fire.
						task_contract_type = laamp_regula_0001
						task_contract_tier = 0
						location = scope:recipient.location
						task_contract_employer = scope:recipient
					}
				}
				scope:create_task_contract_interaction_option_4 = {
					create_task_contract = {
						# Comment/de-comment as appropriate for what you want to fire.
						task_contract_type = laamp_regula_0001
						task_contract_tier = 0
						location = scope:recipient.location
						task_contract_employer = scope:recipient
					}
				}
				scope:create_task_contract_interaction_option_5 = {
					create_task_contract = {
						# Comment/de-comment as appropriate for what you want to fire.
						task_contract_type = laamp_regula_0001
						task_contract_tier = 0
						location = scope:recipient.location
						task_contract_employer = scope:recipient
					}
				}
			}

		}
	}
	auto_accept = yes
}