﻿# Mistborn: The Final Empire - Scripted Triggers
# Reusable triggers for checking Allomantic, Feruchemical, and cultural status

# ===== ALLOMANCY TRIGGERS =====

is_allomancer_trigger = {
	OR = {
		has_trait = trait_misting_lurcher       # Iron
		has_trait = trait_misting_coinshot      # Steel
		has_trait = trait_misting_tineye        # Tin
		has_trait = trait_misting_thug          # Pewter
		has_trait = trait_misting_rioter        # Zinc
		has_trait = trait_misting_soother       # Brass
		has_trait = trait_misting_smoker        # Copper
		has_trait = trait_misting_seeker        # Bronze
		has_trait = trait_misting_augur         # Gold
		has_trait = trait_misting_oracle        # Atium
		has_trait = trait_misting_duralumin     # Duralumin
		has_trait = trait_misting_nicroburst    # Nicrosil
		has_trait = trait_mistborn
	}
}

is_mistborn_trigger = {
	has_trait = trait_mistborn
}

has_allomantic_potential_trigger = {
	# Character has dormant Allomantic potential (has NOT snapped yet)
	OR = {
		has_trait = trait_allomantic_potential
		has_trait = trait_mistborn_potential
	}
	NOT = { is_allomancer_trigger = yes }
}

has_any_allomantic_ability_trigger = {
	# Character has any Allomantic ability — dormant potential OR active powers
	OR = {
		has_trait = trait_allomantic_potential
		has_trait = trait_mistborn_potential
		is_allomancer_trigger = yes
	}
}

# Checks for specific Allomantic metal categories
is_physical_allomancer_trigger = {
	OR = {
		has_trait = trait_misting_lurcher       # Iron - pulls metals
		has_trait = trait_misting_coinshot      # Steel - pushes metals
		has_trait = trait_misting_tineye        # Tin - enhanced senses
		has_trait = trait_misting_thug          # Pewter - enhanced body
		has_trait = trait_mistborn
	}
}

is_mental_allomancer_trigger = {
	OR = {
		has_trait = trait_misting_rioter        # Zinc - inflames emotions
		has_trait = trait_misting_soother       # Brass - dampens emotions
		has_trait = trait_misting_smoker        # Copper - hides Allomancy
		has_trait = trait_misting_seeker        # Bronze - detects Allomancy
		has_trait = trait_mistborn
	}
}

is_higher_allomancer_trigger = {
	OR = {
		has_trait = trait_misting_augur         # Gold - sees alternate past self
		has_trait = trait_misting_oracle        # Atium - sees future
		has_trait = trait_misting_duralumin     # Duralumin - enhances current burn
		has_trait = trait_misting_nicroburst    # Nicrosil - enhances others' burn
		has_trait = trait_mistborn
	}
}

# ===== FERUCHEMY TRIGGERS =====

is_feruchemist_trigger = {
	has_trait = trait_feruchemist
}

has_feruchemy_potential_trigger = {
	has_trait = trait_feruchemy_potential
}

has_any_feruchemy_trigger = {
	OR = {
		has_trait = trait_feruchemist
		has_trait = trait_feruchemy_potential
	}
}

is_full_feruchemist_trigger = {
	has_trait = trait_feruchemist # Full Feruchemists can use all metals
}

# ===== HEMALURGY TRIGGERS =====

has_hemalurgic_spike_trigger = {
	OR = {
		has_trait = trait_hemalurgist
		has_trait = trait_hemalurgic_steel
		has_trait = trait_hemalurgic_pewter
		has_trait = trait_hemalurgic_bronze
		has_trait = trait_hemalurgic_atium
		has_trait = trait_kandra
	}
}

is_kandra_trigger = {
	has_trait = trait_kandra
}

has_multiple_spikes_trigger = {
	# Character has 3+ hemalurgic spike traits — eligible for Inquisitor transformation
	calc_true_if = {
		amount >= 3
		has_trait = trait_hemalurgic_steel
		has_trait = trait_hemalurgic_pewter
		has_trait = trait_hemalurgic_bronze
		has_trait = trait_hemalurgic_atium
	}
}

# ===== CULTURAL TRIGGERS =====

is_noble_scadrian_trigger = {
	culture = culture:noble_scadrian
}

is_skaa_trigger = {
	culture = culture:skaa
}

is_terris_trigger = {
	culture = culture:terris
}

# ===== POLITICAL TRIGGERS =====

is_great_house_trigger = {
	# Character belongs to one of the Great Noble Houses
	highest_held_title_tier >= tier_duchy
	culture = culture:noble_scadrian
}

# ===== MISC TRIGGERS =====

has_atium_trigger = {
	OR = {
		has_trait = trait_misting_oracle
		has_trait = trait_mistborn
	}
}

can_snap_trigger = {
	# Character has potential but hasn't snapped yet
	OR = {
		has_trait = trait_allomantic_potential
		has_trait = trait_mistborn_potential
	}
	NOT = { is_allomancer_trigger = yes }
	NOT = { is_mistborn_trigger = yes }
	age >= 10 # Must be old enough
}

# ===== LORD RULER TRIGGERS =====

is_lord_ruler_trigger = {
	this = character:900100
}

is_playable_scadrian_trigger = {
	NOT = { is_lord_ruler_trigger = yes }
}

# ===== GAME MODE TRIGGERS =====

is_narrative_mode_trigger = {
	has_game_rule = mistborn_game_mode_narrative_mode
}

is_sandbox_mode_trigger = {
	has_game_rule = mistborn_game_mode_sandbox_mode
}
