namespace = CIML

##############################
###   Crisis event chain   ###
##############################

### 
# Beginning of 70 year crisis
narrative_event = {
	id = CIML.750
	title = EVTNAMECIML.750
	desc = EVTDESCCIML.750

	picture = GFX_evt_christian_exodus
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.750
		trigger = {
			religion = catholic
			NOT = { has_secret_religion = yes }
		}
	}
	
	option = {
		name = EVTOPTBCIML.750
		trigger = {
			OR = {
				AND = {
					religion = catholic
					has_secret_religion = yes
				}
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}				
		}
	}
	
	option = {
		name = EVTOPTCCIML.750
		trigger = {
			NOR = {
				religion = catholic
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}
		}
	}
	
	option = {
		name = EVTOPTDCIML.750
		tooltip_info = cynical
		trigger = {
			trait = cynical
		}
	}

	after = {
		narrative_event = { id = CIML.751 years = 50 }
	}
} 

# Preparation for the end of Crisis, new orders of monks and devout catholics unite
narrative_event = {
	id = CIML.751
	title = EVTNAMECIML.751
	desc = EVTDESCCIML.751

	picture = GFX_evt_christian_exodus
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.751
		trigger = {
			religion = catholic
			NOT = { has_secret_religion = yes }
		}
	}
	
	option = {
		name = EVTOPTBCIML.751
		trigger = {
			OR = {
				AND = {
					religion = catholic
					has_secret_religion = yes
				}
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}				
		}
	}
	
	option = {
		name = EVTOPTCCIML.751
		trigger = {
			NOR = {
				religion = catholic
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}
		}
	}
	
	option = {
		name = EVTOPTDCIML.751
		tooltip_info = cynical
		trigger = {
			trait = cynical
		}
	}

	after = {
		narrative_event = { id = CIML.752 years = 20 }
		any_playable_ruler = {
			limit = {
				religion = catholic
				controls_religion = yes
			}
			narrative_event = { id = CIML.753 }
		}
	}
} 

# A Council end the Crisis, theologically refuting heresies and enforcing stricter dicipline to fight corruption
narrative_event = {
	id = CIML.752
	title = EVTNAMECIML.752
	desc = EVTDESCCIML.752

	picture = GFX_evt_pope
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.752
		trigger = {
			religion = catholic
			NOT = { has_secret_religion = yes }
		}
	}
	
	option = {
		name = EVTOPTBCIML.752
		trigger = {
			OR = {
				AND = {
					religion = catholic
					has_secret_religion = yes
				}
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}				
		}
	}
	
	option = {
		name = EVTOPTCCIML.752
		trigger = {
			NOR = {
				religion = catholic
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}
		}
	}
	
	option = {
		name = EVTOPTDCIML.752
		tooltip_info = cynical
		trigger = {
			trait = cynical
		}
	}

	after = {
		set_global_flag = ciml_catholic_crisis_over
		clr_global_flag = ciml_catholic_crisis_ongoing
	}
} 

# Resurgent faith MA, goes to the pope and has no localisations
narrative_event = {
	id = CIML.753
	title = EVTNAMECIML.753
	desc = EVTDESCCIML.753

	picture = GFX_evt_pope
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.753
		if = { 
			limit = { 
				trait = slothful
			}
			remove_trait = slothful
		}
		if = { 
			limit = { 
				religion_authority < 0.4
			}
			religion_authority = {
				modifier = resurgent_faith
				years = 20
			}
		}
	}

	after = {
	}
} 

# Defender of the Faith
narrative_event = {
	id = CIML.754
	title = EVTNAMECIML.754
	desc = EVTDESCCIML.754

	picture = GFX_evt_mounted_knights_hf
	
	only_playable = yes
	only_capable = yes
	
	trigger = {
		primary_title = { higher_tier_than = COUNT }
		independent = yes
		religion = catholic
		OR = {
			has_global_flag = ciml_catholic_crisis_ongoing
			AND = {
				has_global_flag = ciml_catholic_crisis_over
				is_heretic = no
				religion_authority < 0.33
			}
		}
		piety = 100
		prestige = 100
		is_adult = yes
		calc_true_if = { 
			amount = 3
			trait = chaste
			trait = temperate
			trait = charitable
			trait = diligent
			trait = patient
			trait = kind
			trait = humble
			trait = zealous
			trait = brave
			trait = just
			learning = 18
		}
		NOR = {
			government = theocracy_government
			has_focus = focus_intrigue
			has_focus = focus_seduction
			trait = ciml_defender_of_the_faith
			trait = lunatic
			trait = possessed
			trait = cynical
			trait = excommunicated
			trait = in_hiding
			trait = travelling
			trait = crusader_king
			trait = crusader_queen
			has_character_modifier = accused_apostate
			has_character_modifier = annoyed_religious
			has_character_modifier = defied_church
			has_character_modifier = voice_of_jesus
			has_character_modifier = voice_of_satan
			has_character_modifier = slept_in_church
			has_character_modifier = speaking_in_tounges
			has_character_modifier = known_sodomite
			has_character_modifier = known_satanist
			has_character_modifier = known_secret_society_member
			has_character_modifier = rampant_sinner_christian
			has_character_modifier = under_suspicion
			has_character_modifier = highly_suspect
			has_character_modifier = caught_red_handed
			has_character_modifier = caught_stealing_artifact_penance
			has_character_modifier = divine_spirit_alliance
			has_character_modifier = demon_alliance
			has_character_modifier = divine_summoning_failed
			has_character_modifier = divine_summoning_succeeded
			has_character_modifier = published_theorem
			has_character_modifier = endorsed_theorem
			has_character_modifier = uncrowned_modifier
			has_character_modifier = cowardly_infanticide
			has_character_modifier = aborted_child
			has_character_modifier = demon_horns
			calc_true_if = { 
				amount = 4
				trait = lustful
				trait = gluttonous
				trait = greedy
				trait = slothful
				trait = wroth
				trait = envious
				trait = proud
				trait = arbitrary
				trait = cruel
				trait = deceitful
			}
		}
	}
	
	mean_time_to_happen = {	months = 100 }
	
	option = {
		name = EVTOPTACIML.754
		add_trait = ciml_defender_of_the_faith
		trigger = {
			NOT = {
				trait = proud
			}
		}
		piety = 100
		prestige = 100
		wealth = 70
	}
	
	option = {
		name = EVTOPTBCIML.754
		tooltip_info = humble
		trigger = {
			trait = humble
			ai = no
		}
		piety = 100
		prestige = 10
	}
	
	option = {
		name = EVTOPTCCIML.754
		tooltip_info = proud
		trigger = {
			trait = proud
		}
		add_trait = ciml_defender_of_the_faith
		piety = 100
		prestige = 50
		wealth = 100
	}

	after = {
	}
} 

### 
# Beginning of 50 year crisis
narrative_event = {
	id = CIML.755
	title = EVTNAMECIML.755
	desc = EVTDESCCIML.755

	picture = GFX_evt_christian_exodus
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.755
		trigger = {
			religion = catholic
			NOT = { has_secret_religion = yes }
		}
	}
	
	option = {
		name = EVTOPTBCIML.755
		trigger = {
			OR = {
				AND = {
					religion = catholic
					has_secret_religion = yes
				}
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}				
		}
	}
	
	option = {
		name = EVTOPTCCIML.755
		trigger = {
			NOR = {
				religion = catholic
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}
		}
	}
	
	option = {
		name = EVTOPTDCIML.755
		tooltip_info = cynical
		trigger = {
			trait = cynical
		}
	}

	after = {
		narrative_event = { id = CIML.756 years = 30 }
	}
} 

# Preparation for the end of Crisis, new orders of monks and devout catholics unite
narrative_event = {
	id = CIML.756
	title = EVTNAMECIML.756
	desc = EVTDESCCIML.756

	picture = GFX_evt_christian_exodus
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.756
		trigger = {
			religion = catholic
			NOT = { has_secret_religion = yes }
		}
	}
	
	option = {
		name = EVTOPTBCIML.756
		trigger = {
			OR = {
				AND = {
					religion = catholic
					has_secret_religion = yes
				}
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}				
		}
	}
	
	option = {
		name = EVTOPTCCIML.756
		trigger = {
			NOR = {
				religion = catholic
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}
		}
	}
	
	option = {
		name = EVTOPTDCIML.756
		tooltip_info = cynical
		trigger = {
			trait = cynical
		}
	}

	after = {
		narrative_event = { id = CIML.757 years = 20 }
		any_playable_ruler = {
			limit = {
				religion = catholic
				controls_religion = yes
			}
			narrative_event = { id = CIML.758 }
		}
	}
} 

# A Council end the Crisis, theologically refuting heresies and enforcing stricter dicipline to fight corruption
narrative_event = {
	id = CIML.757
	title = EVTNAMECIML.757
	desc = EVTDESCCIML.757

	picture = GFX_evt_pope
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.757
		trigger = {
			religion = catholic
			NOT = { has_secret_religion = yes }
		}
	}
	
	option = {
		name = EVTOPTBCIML.757
		trigger = {
			OR = {
				AND = {
					religion = catholic
					has_secret_religion = yes
				}
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}				
		}
	}
	
	option = {
		name = EVTOPTCCIML.757
		trigger = {
			NOR = {
				religion = catholic
				religion = cathar
				religion = fraticelli
				religion = waldensian
				religion = lollard
				religion = adoptionist
				religion = free_spirits
			}
		}
	}
	
	option = {
		name = EVTOPTDCIML.757
		tooltip_info = cynical
		trigger = {
			trait = cynical
		}
	}

	after = {
		set_global_flag = ciml_catholic_crisis_over
		clr_global_flag = ciml_catholic_crisis_ongoing
	}
} 

# Resurgent faith MA, goes to the pope and has no localisations
narrative_event = {
	id = CIML.758
	title = EVTNAMECIML.758
	desc = EVTDESCCIML.758

	picture = GFX_evt_pope
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTACIML.758
		if = { 
			limit = { 
				trait = slothful
			}
			remove_trait = slothful
		}
		if = { 
			limit = { 
				religion_authority < 0.4
			}
			religion_authority = {
				modifier = resurgent_faith
				years = 20
			}
		}
	}

	after = {
	}
}