﻿############################################
# Mistborn: The Final Empire - Inquisitor Events
# Events for the Steel Inquisitor holy order and court Inquisitor
############################################

namespace = mistborn_inquisitor

# ============================================================
# 0001 — Inquisitor Holy Order Hired
# Fires when the Steel Inquisitor holy order is hired
# ============================================================
mistborn_inquisitor.0001 = {
	type = character_event
	title = mistborn_inquisitor.0001.t
	desc = mistborn_inquisitor.0001.desc
	theme = faith
	override_background = { reference = throne_room }

	immediate = {
		# Terror spreads through the court
		every_courtier = {
			limit = {
				NOT = { has_character_modifier = steel_inquisitor_power }
			}
			add_stress = 10
		}
	}

	option = {
		name = mistborn_inquisitor.0001.a
		# The Lord Ruler's will be done
		add_piety = 50
		custom_tooltip = inquisitor_order_hired_tt
	}
}

# ============================================================
# 0010 — Inquisitor Arrives at Court (Request Decision)
# An Inquisitor comes to serve (and watch) your court
# ============================================================
mistborn_inquisitor.0010 = {
	type = character_event
	title = mistborn_inquisitor.0010.t
	desc = mistborn_inquisitor.0010.desc
	theme = faith
	override_background = { reference = throne_room }

	immediate = {
		# Generate an Inquisitor courtier
		create_character = {
			name = "Inquisitor"
			age = { 35 55 }
			gender = male
			culture = culture:noble_scadrian
			faith = faith:steel_ministry
			trait = trait_hemalurgist
			trait = trait_hemalurgic_steel
			trait = trait_hemalurgic_pewter
			trait = trait_hemalurgic_bronze
			trait = disfigured
			trait = callous
			trait = sadistic
			dynasty = none
			save_scope_as = new_inquisitor
		}
		scope:new_inquisitor = {
			add_character_modifier = steel_inquisitor_power
			add_character_flag = is_court_inquisitor
		}
		add_character_flag = inquisitor_at_court
	}

	option = {
		name = mistborn_inquisitor.0010.a
		# Welcome the Inquisitor — gain piety but court is terrified
		add_piety = 30
		every_courtier = {
			limit = {
				NOT = { has_character_flag = is_court_inquisitor }
				NOT = { this = root }
			}
			add_stress = 15
			add_opinion = {
				target = root
				modifier = opinion_angry
				opinion = -10
			}
		}
		custom_tooltip = inquisitor_arrives_tt
	}

	option = {
		name = mistborn_inquisitor.0010.b
		# Accept reluctantly
		add_stress = 20
		custom_tooltip = inquisitor_arrives_reluctant_tt
	}
}

# ============================================================
# 0015 — Inquisitor Reports to the Canton (yearly)
# 15% chance: the Inquisitor reports your activities
# ============================================================
mistborn_inquisitor.0015 = {
	type = character_event
	title = mistborn_inquisitor.0015.t
	desc = mistborn_inquisitor.0015.desc
	theme = intrigue
	override_background = { reference = throne_room }

	trigger = {
		has_character_flag = inquisitor_at_court
		is_ruler = yes
	}

	immediate = {
		increase_lord_ruler_attention_effect = yes
	}

	option = {
		name = mistborn_inquisitor.0015.a
		# Nothing to be done — they serve the Lord Ruler
		add_stress = 10
		custom_tooltip = inquisitor_reports_tt
	}

	option = {
		name = mistborn_inquisitor.0015.b
		# Try to bribe the Inquisitor (futile but reduces stress)
		trigger = { gold >= 100 }
		remove_short_term_gold = 100
		add_stress = -5
		custom_tooltip = inquisitor_bribe_tt
	}
}

# ============================================================
# 0020 — Investigate Heresy (interaction result)
# The Inquisitor investigates a courtier for hidden faith or powers
# ============================================================
mistborn_inquisitor.0020 = {
	type = character_event
	title = mistborn_inquisitor.0020.t
	desc = mistborn_inquisitor.0020.desc
	theme = intrigue
	override_background = { reference = throne_room }

	immediate = {
		# Intrigue check against target
	}

	# Success — something found
	option = {
		name = mistborn_inquisitor.0020.a
		trigger = {
			scope:investigation_target = {
				OR = {
					NOT = { faith = root.faith }
					is_allomancer_trigger = yes
					has_character_flag = keeper_initiate
					has_character_flag = keeper_identity
				}
			}
		}
		# Reveal the target's secrets
		scope:investigation_target = {
			expose_secret = yes
		}
		add_piety = 30
		custom_tooltip = investigate_heresy_success_tt
	}

	# Failure — nothing found but target is terrorized
	option = {
		name = mistborn_inquisitor.0020.b
		scope:investigation_target = {
			add_stress = 20
		}
		custom_tooltip = investigate_heresy_failure_tt
	}
}

# ============================================================
# 0030 — Hunt Allomancers (interaction result)
# The Inquisitor searches a vassal's domain for hidden Allomancers
# ============================================================
mistborn_inquisitor.0030 = {
	type = character_event
	title = mistborn_inquisitor.0030.t
	desc = mistborn_inquisitor.0030.desc
	theme = intrigue
	override_background = { reference = terrain }

	immediate = {
		# Check for hidden Allomancers among the vassal's courtiers
	}

	# Success — Allomancer discovered and captured
	option = {
		name = mistborn_inquisitor.0030.a
		random_list = {
			60 = {
				# Found a hidden Allomancer
				scope:recipient = {
					random_courtier = {
						limit = {
							is_allomancer_trigger = yes
						}
						save_scope_as = captured_allomancer
						imprison = {
							target = root
							type = dungeon
						}
					}
				}
				add_piety = 50
				custom_tooltip = hunt_allomancers_success_tt
			}
			40 = {
				# No Allomancers found
				custom_tooltip = hunt_allomancers_none_found_tt
			}
		}
	}

	# Call off the hunt — too much disruption
	option = {
		name = mistborn_inquisitor.0030.b
		add_stress = -10
		scope:recipient = {
			add_opinion = {
				target = root
				modifier = opinion_grateful
				opinion = 10
			}
		}
		custom_tooltip = hunt_allomancers_cancelled_tt
	}
}

# ============================================================
# 0040 — Interrogate Prisoner (interaction result)
# The Inquisitor brutally interrogates a prisoner
# ============================================================
mistborn_inquisitor.0040 = {
	type = character_event
	title = mistborn_inquisitor.0040.t
	desc = mistborn_inquisitor.0040.desc
	theme = intrigue
	override_background = { reference = dungeon }

	immediate = {
		scope:recipient = {
			save_scope_as = prisoner
		}
	}

	# Success — prisoner breaks and confesses
	option = {
		name = mistborn_inquisitor.0040.a
		scope:prisoner = {
			add_trait = tortured
			expose_secret = yes
		}
		# Gain a strong hook on the prisoner
		add_hook = {
			target = scope:prisoner
			type = strong_hook
		}
		# Compassionate courtiers disapprove
		every_courtier = {
			limit = {
				has_trait = compassionate
			}
			add_opinion = {
				target = root
				modifier = opinion_angry
				opinion = -30
			}
		}
		custom_tooltip = interrogate_success_tt
	}

	# Show mercy — stop the interrogation
	option = {
		name = mistborn_inquisitor.0040.b
		add_piety = -20
		add_stress = -20
		# The Inquisitor reports your mercy to the Canton
		increase_lord_ruler_attention_effect = yes
		custom_tooltip = interrogate_mercy_tt
	}
}

# ============================================================
# 0050 — Inquisitor Senses a Keeper (tension event)
# When an Inquisitor and a Keeper are in the same court
# ============================================================
mistborn_inquisitor.0050 = {
	type = character_event
	title = mistborn_inquisitor.0050.t
	desc = mistborn_inquisitor.0050.desc
	theme = intrigue
	override_background = { reference = throne_room }

	trigger = {
		has_character_flag = inquisitor_at_court
		any_courtier = {
			OR = {
				has_character_flag = keeper_initiate
				has_character_flag = keeper_identity
			}
		}
	}

	weight_multiplier = {
		base = 1
		modifier = {
			factor = 2.5
			# Heightened detection chance (25% instead of 10%)
			any_courtier = {
				has_character_flag = keeper_identity
			}
		}
	}

	immediate = {
		random_courtier = {
			limit = {
				OR = {
					has_character_flag = keeper_initiate
					has_character_flag = keeper_identity
				}
			}
			save_scope_as = hidden_keeper
		}
	}

	# The Inquisitor probes with bronze Allomancy
	option = {
		name = mistborn_inquisitor.0050.a
		# Allow the investigation — risky for the Keeper
		random_list = {
			25 = {
				# Keeper discovered!
				scope:hidden_keeper = {
					remove_character_flag = keeper_initiate
					remove_character_flag = keeper_identity
					add_character_flag = keeper_exposed
					imprison = {
						target = root
						type = dungeon
					}
				}
				increase_lord_ruler_attention_effect = yes
				custom_tooltip = inquisitor_finds_keeper_tt
			}
			75 = {
				# Keeper stays hidden
				custom_tooltip = inquisitor_misses_keeper_tt
			}
		}
	}

	# Distract the Inquisitor — use your influence
	option = {
		name = mistborn_inquisitor.0050.b
		trigger = { intrigue >= 12 }
		add_stress = 15
		# Inquisitor is redirected, Keeper is safe for now
		custom_tooltip = distract_inquisitor_tt
	}
}
