############################################
# Mistborn Mod - Decisions
############################################

# Host a Noble Ball - social event for the Great Houses
host_a_ball_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_feast.dds" }

	desc = host_a_ball_decision_desc
	selection_tooltip = host_a_ball_decision_tooltip

	ai_check_interval = 120

	is_shown = {
		is_ruler = yes
		culture = culture:noble_scadrian
	}

	is_valid = {
		is_ruler = yes
		prestige >= 200
		gold >= 100
		NOT = { has_character_flag = recently_hosted_ball }
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		gold = 100
		prestige = 50
	}

	cooldown = { years = 3 }

	effect = {
		add_prestige = 200
		add_character_flag = {
			flag = recently_hosted_ball
			years = 3
		}
		trigger_event = mistborn_ball.0001
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 50
	}
}

# Subject Heir to Snapping - force a traumatic event to awaken Allomantic potential
subject_heir_to_snapping_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_personal_religious.dds" }

	desc = subject_heir_to_snapping_decision_desc
	selection_tooltip = subject_heir_to_snapping_decision_tooltip

	ai_check_interval = 60

	is_shown = {
		is_ruler = yes
		any_child = {
			OR = {
				has_trait = trait_allomantic_potential
				has_trait = trait_mistborn_potential
			}
		}
	}

	is_valid = {
		is_ruler = yes
		gold >= 50
		any_child = {
			OR = {
				has_trait = trait_allomantic_potential
				has_trait = trait_mistborn_potential
			}
			age >= 10
			NOT = { has_character_flag = recently_snapped }
		}
		NOT = { has_character_flag = recently_attempted_snapping }
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		gold = 50
	}

	cooldown = { years = 1 }

	effect = {
		add_stress = 100
		add_character_flag = {
			flag = recently_attempted_snapping
			years = 1
		}
		# Target a child with potential - event will handle the actual Snapping
		random_child = {
			limit = {
				OR = {
					has_trait = trait_allomantic_potential
					has_trait = trait_mistborn_potential
				}
				age >= 10
				NOT = { has_character_flag = recently_snapped }
			}
			save_scope_as = snapping_target
			add_character_flag = {
				flag = recently_snapped
				years = 2
			}
		}
		trigger_event = mistborn_snapping.0010
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 80
	}
}

# Breed for Allomancy - focus bloodline efforts on strengthening Allomantic traits
breed_for_allomancy_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_dynasty_house.dds" }

	desc = breed_for_allomancy_decision_desc
	selection_tooltip = breed_for_allomancy_decision_tooltip

	ai_check_interval = 120

	is_shown = {
		is_ruler = yes
		OR = {
			has_trait = trait_mistborn
			has_trait = trait_misting_coinshot
			has_trait = trait_misting_lurcher
			has_trait = trait_misting_thug
			has_trait = trait_misting_tineye
			has_trait = trait_misting_soother
			has_trait = trait_misting_rioter
			has_trait = trait_misting_smoker
			has_trait = trait_misting_seeker
			has_trait = trait_misting_augur
			has_trait = trait_misting_oracle
			has_trait = trait_misting_duralumin
			has_trait = trait_misting_nicroburst
			any_child = {
				OR = {
					has_trait = trait_allomantic_potential
					has_trait = trait_mistborn_potential
				}
			}
		}
	}

	is_valid = {
		is_ruler = yes
		prestige >= 150
		NOT = { has_character_modifier = breeding_for_allomancy_modifier }
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		prestige = 150
	}

	cooldown = { years = 10 }

	effect = {
		add_character_modifier = {
			modifier = breeding_for_allomancy_modifier
			years = 10
		}
		# Increases the chance that matchmaking will prioritize Allomantic bloodlines
		add_prestige = 50
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 40
	}
}

# Hire a Kandra - engage one of the shapeshifting immortals for espionage
hire_kandra_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_skulduggery.dds" }

	desc = hire_kandra_decision_desc
	selection_tooltip = hire_kandra_decision_tooltip

	ai_check_interval = 180

	is_shown = {
		is_ruler = yes
		gold >= 500
	}

	is_valid = {
		is_ruler = yes
		gold >= 500
		NOT = { has_character_flag = kandra_contract_active }
		NOT = { has_character_flag = recently_hired_kandra }
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		gold = 500
	}

	cooldown = { years = 5 }

	effect = {
		add_character_flag = {
			flag = recently_hired_kandra
			years = 5
		}
		add_character_flag = {
			flag = kandra_contract_active
			years = 3
		}
		add_character_flag = {
			flag = hired_kandra
		}
		trigger_event = mistborn_misc.0001
	}

	ai_potential = {
		gold >= 1000
	}

	ai_will_do = {
		base = 30
	}
}

# Commission a Hemalurgic Spike - the dark art of stealing Allomantic power
commission_hemalurgic_spike_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_execution.dds" }

	desc = commission_hemalurgic_spike_decision_desc
	selection_tooltip = commission_hemalurgic_spike_decision_tooltip

	ai_check_interval = 240

	is_shown = {
		has_trait = trait_knows_hemalurgy
	}

	is_valid = {
		has_trait = trait_knows_hemalurgy
		gold >= 200
		intrigue >= 10
		NOT = { has_character_flag = recently_commissioned_spike }
		# Must know of an Allomancer to target
		any_courtier = {
			OR = {
				has_trait = trait_misting_coinshot
				has_trait = trait_misting_lurcher
				has_trait = trait_misting_thug
				has_trait = trait_misting_tineye
				has_trait = trait_misting_soother
				has_trait = trait_misting_rioter
				has_trait = trait_misting_smoker
				has_trait = trait_misting_seeker
				has_trait = trait_misting_augur
				has_trait = trait_misting_oracle
			}
		}
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		gold = 200
		piety = -500
		prestige = -200
	}

	cooldown = { years = 3 }

	effect = {
		add_character_flag = {
			flag = recently_commissioned_spike
			years = 3
		}
		# Massive stress and tyranny for this dark act
		add_stress = 200
		add_tyranny = 30
		# Trigger the Hemalurgy event chain
		trigger_event = mistborn_hemalurgy.0001  # events/hemalurgy_events.txt
	}

	ai_potential = {
		has_trait = trait_knows_hemalurgy
	}

	ai_will_do = {
		base = 5
		modifier = {
			factor = 3
			has_trait = ambitious
		}
		modifier = {
			factor = 2
			has_trait = sadistic
		}
	}
}

# Smuggle Atium - acquire the most precious metal in the Final Empire
smuggle_atium_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_skulduggery.dds" }

	desc = smuggle_atium_decision_desc
	selection_tooltip = smuggle_atium_decision_tooltip

	ai_check_interval = 180

	is_shown = {
		is_ruler = yes
		intrigue >= 12
	}

	is_valid = {
		is_ruler = yes
		intrigue >= 12
		gold >= 300
		NOT = { has_character_flag = recently_smuggled_atium }
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		gold = 300
	}

	cooldown = { years = 5 }

	effect = {
		add_character_flag = {
			flag = recently_smuggled_atium
			years = 5
		}
		# Risk: increase Lord Ruler's attention
		if = {
			limit = {
				var:lord_ruler_attention >= 25
			}
			# Already being watched - higher risk
			random_list = {
				30 = {
					trigger_event = mistborn_atium.0001  # Success
				}
				70 = {
					trigger_event = mistborn_atium.0002  # Caught
				}
			}
		}
		else = {
			random_list = {
				70 = {
					trigger_event = mistborn_atium.0001  # Success
				}
				30 = {
					trigger_event = mistborn_atium.0002  # Caught
				}
			}
		}
	}

	ai_potential = {
		intrigue >= 15
	}

	ai_will_do = {
		base = 20
		modifier = {
			factor = 2
			has_trait = greedy
		}
		modifier = {
			factor = 0
			var:lord_ruler_attention >= 25
		}
	}
}

# Crack Down on Skaa - suppress the skaa population through force
crack_down_on_skaa_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_realm.dds" }

	desc = crack_down_on_skaa_decision_desc
	selection_tooltip = crack_down_on_skaa_decision_tooltip

	ai_check_interval = 60

	is_shown = {
		is_ruler = yes
		any_held_title = {
			tier >= tier_county
		}
	}

	is_valid = {
		is_ruler = yes
		gold >= 50
		NOT = { has_character_flag = recently_cracked_down_skaa }
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		gold = 50
	}

	cooldown = { years = 2 }

	effect = {
		add_character_flag = {
			flag = recently_cracked_down_skaa
			years = 2
		}
		add_tyranny = 15
		add_dread = 20
		# Reduce unrest but build long-term resentment
		every_held_title = {
			limit = {
				tier = tier_county
			}
			change_county_control = 20
		}
		# Hidden rebellion score increases - tracked by events
		trigger_event = mistborn_skaa.0001
	}

	ai_potential = {
		always = yes
	}

	ai_will_do = {
		base = 30
		modifier = {
			factor = 2
			has_trait = callous
		}
		modifier = {
			factor = 0.5
			has_trait = compassionate
		}
	}
}

# Improve Skaa Conditions - a risky act of compassion
improve_skaa_conditions_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_misc.dds" }

	desc = improve_skaa_conditions_decision_desc
	selection_tooltip = improve_skaa_conditions_decision_tooltip

	ai_check_interval = 120

	is_shown = {
		is_ruler = yes
		any_held_title = {
			tier >= tier_county
		}
	}

	is_valid = {
		is_ruler = yes
		gold >= 150
		NOT = { has_character_flag = recently_improved_skaa_conditions }
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		gold = 150
		prestige = 100
	}

	cooldown = { years = 3 }

	effect = {
		add_character_flag = {
			flag = recently_improved_skaa_conditions
			years = 3
		}
		# Benefits: reduce rebellion risk, gain development
		every_held_title = {
			limit = {
				tier = tier_county
			}
			change_development_level = 1
		}
		# Risks: Lord Ruler may notice
		increase_lord_ruler_attention_effect = yes
		# Other nobles disapprove
		every_vassal = {
			add_opinion = {
				target = root
				modifier = disapproves_skaa_mercy
			}
		}
		trigger_event = mistborn_skaa.0010
	}

	ai_potential = {
		has_trait = compassionate
	}

	ai_will_do = {
		base = 10
		modifier = {
			factor = 3
			has_trait = compassionate
		}
		modifier = {
			factor = 0
			has_trait = callous
		}
	}
}

# Recruit a Skaa Allomancer - secretly bring a skaa with powers into your service
recruit_skaa_allomancer_decision = {
	picture = { reference = "gfx/interface/illustrations/decisions/decision_skulduggery.dds" }

	desc = recruit_skaa_allomancer_decision_desc
	selection_tooltip = recruit_skaa_allomancer_decision_tooltip

	ai_check_interval = 120

	is_shown = {
		is_ruler = yes
		has_character_flag = discovered_skaa_allomancer
	}

	is_valid = {
		is_ruler = yes
		has_character_flag = discovered_skaa_allomancer
		gold >= 100
		intrigue >= 8
		NOT = { has_character_flag = recently_recruited_skaa_allomancer }
	}

	is_valid_showing_failures_only = {
		is_available_adult = yes
	}

	cost = {
		gold = 100
	}

	cooldown = { years = 3 }

	effect = {
		add_character_flag = {
			flag = recently_recruited_skaa_allomancer
			years = 3
		}
		remove_character_flag = discovered_skaa_allomancer
		# Generate a powerful courtier with a random Allomantic trait
		trigger_event = mistborn_skaa_allomancer.0001
		# Risk of discovery by the Steel Ministry
		random_list = {
			80 = {
				# Safe for now
				custom_tooltip = recruit_skaa_allomancer_safe_tt
			}
			20 = {
				# Steel Ministry investigates
				add_character_modifier = {
					modifier = steel_ministry_displeasure
					years = 3
				}
				trigger_event = mistborn_skaa_allomancer.0002
			}
		}
	}

	ai_potential = {
		has_character_flag = discovered_skaa_allomancer
	}

	ai_will_do = {
		base = 40
		modifier = {
			factor = 2
			intrigue >= 15
		}
		modifier = {
			factor = 0.5
			has_character_modifier = steel_ministry_displeasure
		}
	}
}
