﻿namespace = counterfactuals
#################################
# Counterfactuals
# 500: Crusaders
# by CaelReader
#################################

#Christian conquest of Jerusalem

counterfactuals.501 = {
	type = character_event
	title = counterfactuals.501.t
	desc = counterfactuals.501.desc
	theme = war
	override_background = {
		reference = holy_site_jerusalem
	}
	right_portrait = {
		character = scope:jerusalem_sacker
		animation = marshal
	}
	left_portrait = {
		character = title:c_jerusalem.holder
		animation = beg
	}

	immediate = {
		set_global_variable = {
			name = counterfactuals_jerusalem_taken
			value = yes
		}
		title:c_jerusalem = {
			save_scope_as = jerusalem_scope
		}
		save_scope_as = jerusalem_sacker
	}
	#Do Not Sack
	option = {
		name = counterfactuals.501.a
		add_piety = 300
		title:c_jerusalem.holder = {
			add_opinion = {
				target = root
				modifier = respect_opinion
				opinion = 20
			}
		}
		faith = {
			change_fervor = {
				value = 10
				desc = counterfactuals_took_jerusalem
			}
		}
		hidden_effect = {
			every_player = {
				limit = {
					NOT = {
						this = root
					}
					OR = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_middle_east
									geographical_region = world_asia_minor
									geographical_region = world_africa_north
									geographical_region = world_africa_east
									geographical_region = world_europe_south
								}
							}
						}
						faith = { religion_tag = christianity_religion }
						faith = { religion_tag = islam_religion }
						faith = { religion_tag = judaism_religion }
					}
				}
				trigger_event = counterfactuals.503
			}
		}
		ai_chance = {
			base = 1
		}
	}
	#Sack
	option = {
		name = counterfactuals.501.b
		add_piety = -500
		add_gold = 300
		faith = {
			change_fervor = {
				value = -10
				desc = counterfactuals_we_sacked_jerusalem
			}
		}
		title:c_jerusalem = {
			change_development_progress_with_overflow = -250
			change_county_control = -30
			title_province = {
				hidden_effect = {
					destroy_random_building_variable_effect = yes
					destroy_random_building_effect = yes
					destroy_random_building_variable_effect = yes
					destroy_random_building_effect = yes
				}
			}
			culture = {
				change_cultural_acceptance = {
					target = root.culture
					value = major_cultural_acceptance_loss
					desc = counterfactuals_jerusalem_sacked_cultural_acceptance
				}

			}
			if = {
				limit = { 
					NOT = {
						faith = root.faith
					}
				}
				faith = {
					change_fervor = {
						value = 10
						desc = counterfactuals_enemies_sacked_jerusalem
					}
				}
			}

		}
		if = {
			limit = { 
				has_trait_benevolent_trigger = yes
			}
			add_stress = medium_stress_gain
		}
		hidden_effect = {
			every_player = {
				limit = {
					NOT = {
						this = root
					}
					OR = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_middle_east
									geographical_region = world_asia_minor
									geographical_region = world_africa_north
									geographical_region = world_africa_east
									geographical_region = world_europe_south
								}
							}
						}
						faith = { religion_tag = christianity_religion }
						faith = { religion_tag = islam_religion }
						faith = { religion_tag = judaism_religion }
					}
				}
				trigger_event = counterfactuals.502
			}
		}
		ai_chance = {
			base = 100
		}
	}
}
#Jerusalem sacked notification
counterfactuals.502 = {
	type = character_event
	title = counterfactuals.502.t
	desc = counterfactuals.502.desc
	theme = war
	override_background = {
		reference = holy_site_jerusalem
	}
	right_portrait = {
		character = scope:jerusalem_sacker
		animation = aggressive_sword
	}
	left_portrait = {
		character = title:c_jerusalem.holder
		animation = fear
	}

	immediate = {
		show_as_tooltip = {
			title:c_jerusalem = {
				change_development_progress_with_overflow = -250
				change_county_control = -30
				title_province = {
					hidden_effect = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
				culture = {
					change_cultural_acceptance = {
						target = root.culture
						value = major_cultural_acceptance_loss
						desc = counterfactuals_jerusalem_sacked_cultural_acceptance
					}
	
				}
			}
		}
	}
	#Default
	option = {
		name = counterfactuals.502.a
	}
}
#Jerusalem spared notification
counterfactuals.503 = {
	type = character_event
	title = counterfactuals.503.t
	desc = counterfactuals.503.desc
	theme = war
	override_background = {
		reference = holy_site_jerusalem
	}
	right_portrait = {
		character = scope:jerusalem_sacker
		animation = marshal
	}
	left_portrait = {
		character = title:c_jerusalem.holder
		animation = shame
	}

	#Default
	option = {
		name = counterfactuals.503.a
	}
}

#Christian occupation of Mecca
counterfactuals.510 = {
	type = character_event
	title = counterfactuals.510.t
	desc = counterfactuals.510.desc
	theme = war
	override_background = {
		reference = holy_site_mecca
	}
	right_portrait = {
		character = scope:mecca_sacker
		animation = marshal
	}
	left_portrait = {
		character = scope:caliph_scope
		animation = beg
	}

	immediate = {
		title:c_mecca = {
			faith.religious_head = {
				save_scope_as = caliph_scope
			}
			save_scope_as = mecca_scope
		}
		set_global_variable = {
			name = counterfactuals_mecca_taken
			value = yes
		}
		save_scope_as = mecca_sacker
	}
	#Do Not Sack
	option = {
		name = counterfactuals.510.a
		add_piety = 300
		if = {
			limit = { 
				NOT = {
					any_held_title = {
						this = title:c_mecca
					}
				}
			}
			title:c_mecca.holder = {
				add_opinion = {
					target = root
					modifier = respect_opinion
					opinion = 20
				}
			}
		}
		faith = {
			change_fervor = {
				value = 10
				desc = counterfactuals_took_mecca
			}
		}
	}
	#Sack
	option = {
		name = counterfactuals.510.b
		faith = {
			change_fervor = {
				value = 10
				desc = counterfactuals_took_mecca
			}
		}
		title:c_mecca = {
			change_development_progress_with_overflow = -250
			change_county_control = -30
			title_province = {
				hidden_effect = {
					destroy_random_building_variable_effect = yes
					destroy_random_building_effect = yes
					destroy_random_building_variable_effect = yes
					destroy_random_building_effect = yes
				}
				if = {
					limit = { has_building_or_higher = holy_site_great_mosque_of_mecca_01 }
					remove_building = holy_site_great_mosque_of_mecca_01
				}
			}
			culture = {
				change_cultural_acceptance = {
					target = root.culture
					value = major_cultural_acceptance_loss
					desc = counterfactuals_mecca_sacked_cultural_acceptance
				}
			}
			faith = {
				change_fervor = {
					value = 25
					desc = counterfactuals_mecca_outrage
				}
			}
		}
		if = {
			limit = { 
				has_trait_benevolent_trigger = yes
			}
			add_stress = medium_stress_gain
		}
		hidden_effect = {
			every_player = {
				limit = {
					OR = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_middle_east
									geographical_region = world_asia_minor
									geographical_region = world_africa_north
									geographical_region = world_africa_east
									geographical_region = world_europe_south
								}
							}
						}
						faith = { religion_tag = christianity_religion }
						faith = { religion_tag = islam_religion }
					}
				}
				trigger_event = counterfactuals.511
			}
		}
	}

}


#Mecca sacked by Christians notification
counterfactuals.511 = {
	type = character_event
	title = counterfactuals.511.t
	desc = counterfactuals.511.desc
	theme = war
	override_background = {
		reference = holy_site_mecca
	}
	right_portrait = {
		character = scope:mecca_sacker
		animation = aggressive_sword
	}
	left_portrait = {
		character = scope:caliph_scope
		animation = fear
	}

	immediate = {
		show_as_tooltip = {
			title:c_mecca = {
				change_development_progress_with_overflow = -250
				change_county_control = -30
				title_province = {
					hidden_effect = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
					if = {
						limit = { has_building_or_higher = holy_site_great_mosque_of_mecca_01 }
						remove_building = holy_site_great_mosque_of_mecca_01
					}
				}
				culture = {
					change_cultural_acceptance = {
						target = root.culture
						value = major_cultural_acceptance_loss
						desc = counterfactuals_mecca_sacked_cultural_acceptance
					}
				}
				faith = {
					change_fervor = {
						value = 25
						desc = counterfactuals_mecca_outrage
					}
				}
			}
		}
	}
	#Default
	option = {
		name = counterfactuals.511.a
	}
}
#Mecca spared notification




