﻿namespace = counterfactuals
#################################
# Counterfactuals
# 200: Mongol Sack Events
# by CaelReader
# adapted from the originals from Crusader Kings 2
#################################

#Handler Event for Mongol sacks
counterfactuals.201 = {
	hidden = yes
	trigger = {
		# # Check that it's relevant so we don't fire it *all* the time
		# exists = global_var:mongol_empire_has_spawned
		# NOT = { exists = global_var:mongol_story_has_ended }
		# any_owned_story = {
		# 	story_type = story_mongol_invasion
		# }
		# scope:county = {
		# 	NOT = { exists = scope:county.var:counterfactuals_mongols_sacked }
		# }
	}

	immediate = {
		save_scope_as = mongol_emperor
		if = {
			limit = { 
				exists = scope:defender
			}
			scope:defender = {
				save_scope_as = defeated_holder
			}
		} else = {
			scope:county.holder = {
				save_scope_as = defeated_holder
			}
		}
		scope:county = {
			title_province.barony = {
				save_scope_as = mongol_sacked_barony
			}
		}
		switch = {
			trigger = scope:county
			#Kyiv
			title:c_kiev = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe_east
									geographical_region = world_europe_north
									geographical_region = world_steppe
								}
							}
						}
					}
					trigger_event = counterfactuals.202 
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
					if = {
						limit = { 
							NOT = { exists = var:looted_by_mongols }
						}
						mongols_devastate_county_effect = yes
						set_variable = {
							name = looted_by_mongols
							value = yes
						}
					}
				}
			}
			#Novgorod
			title:c_novgorod = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe_east
									geographical_region = world_europe_north
									geographical_region = world_steppe
								}
							}
						}
					}
					trigger_event = counterfactuals.202 
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Krakow
			title:c_krakowska = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe_east
									geographical_region = world_europe_north
									geographical_region = world_steppe
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Aachen
			title:c_aachen = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_steppe
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Paris
			title:c_ile_de_france = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_steppe
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#London
			title:c_middlesex = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_steppe
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Rome
			title:c_roma = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_africa_north
									geographical_region = world_asia_minor
									geographical_region = world_middle_east_jerusalem
									geographical_region = world_steppe
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Venice
			title:c_venezia = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_africa_north
									geographical_region = world_asia_minor
									geographical_region = world_middle_east_jerusalem
									geographical_region = world_steppe
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						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 = doges_palace_01
							}
							remove_building = doges_palace_01
						}
					}
				}
			}
			#Constantinople
			title:c_byzantion = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_africa_north
									geographical_region = world_asia_minor
									geographical_region = world_middle_east
									geographical_region = world_steppe
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						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 = hagia_sophia_01
							}
							remove_building = hagia_sophia_01
						}
						if = {
							limit = { 
								has_building = hagia_sophia_02
							}
							remove_building = hagia_sophia_02
						}
					}
					if = {
						limit = { 
							NOT = { exists = var:looted_by_mongols }
						}
						mongols_devastate_county_effect = yes
						set_variable = {
							name = looted_by_mongols
							value = yes
						}
					}
				}
			}
			#Lisbon
			title:c_lisboa = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_africa_north
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Smolensk
			title:c_smolensk = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_asia_minor
									geographical_region = world_steppe_west
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Prague
			title:c_praha = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_steppe_west
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Vienna
			title:c_vienna = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_africa_north
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Esztergom
			title:c_esztergom = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_steppe_west

								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Athens
			title:c_attica = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_steppe_west
									geographical_region = world_africa_north
									geographical_region = world_middle_east
									geographical_region = world_asia_minor

								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Belgrade
			title:c_beograd = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
									geographical_region = world_steppe_west
									geographical_region = world_africa_north
									geographical_region = world_asia_minor

								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Baghdad
			title:c_baghdad = {
				every_player = {
					limit = {
						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_steppe_west
									geographical_region = world_europe_south
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						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 = house_of_wisdom_01
								scope:mongol_emperor = {
									NOR = {
										has_trait = education_learning
										has_lifestyle = learning_lifestyle
										has_learning_lifestyle_trait_trigger = yes
										islam_or_syncretic_with_islam_trigger = { CHARACTER = scope:mongol_emperor }
									}
								}
							}
							remove_building = house_of_wisdom_01
						}
					}
				}
			}
			#Damascus
			title:c_damascus = {
				every_player = {
					limit = {
						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_steppe_west
									geographical_region = world_europe_south
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Jerusalem
			title:c_jerusalem = {
				every_player = {
					limit = {
						OR = {
							any_sub_realm_county = {
								title_province = {
									OR = {
										geographical_region = world_middle_east
										geographical_region = world_europe
										geographical_region = world_asia_minor
										geographical_region = world_africa_north
										geographical_region = world_africa_east
										geographical_region = world_steppe_west
										geographical_region = world_europe_south
									}
								}
							}
							faith = { religion_tag = christianity_religion }
							faith = { religion_tag = islam_religion }
							faith = { religion_tag = judaism_religion }
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						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 = dome_of_the_rock_01
							}
							remove_building = dome_of_the_rock_01
						}
						if = {
							limit = { 
								has_building = temple_in_jerusalem_01
							}
							remove_building = temple_in_jerusalem_01
						}
					}
				}
			}
			#Alexandria
			title:c_alexandria = {
				every_player = {
					limit = {
						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
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Cairo
			title:c_cairo = {
				every_player = {
					limit = {
						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_africa_sahara
									geographical_region = world_europe_south
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Mecca
			title:c_mecca = {
				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_africa_sahara
										geographical_region = world_europe_south
									}
								}
							}
							faith = { religion_tag = islam_religion }
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Delhi
			title:c_delhi = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_middle_east
									geographical_region = world_india
									geographical_region = world_tibet
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						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 = iron_pillar_of_delhi_01
							}
							remove_building = iron_pillar_of_delhi_01
						}
					}
				}
			}
			#Tanjavur
			title:c_cholamandalam = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_india
									geographical_region = world_burma
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						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 = brihadeeswarar_temple_01
							}
							remove_building = brihadeeswarar_temple_01
						}
					}
				}
			}
			#Dublin
			title:c_dublin = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Reykjavik
			title:c_vestisland = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Samarkand
			title:c_samarkand = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_middle_east
									geographical_region = world_steppe		
									geographical_region = world_tibet	
									geographical_region = world_india_rajastan				
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
					}
				}
			}
			#Nishapur
			title:c_nishapur = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_middle_east
									geographical_region = world_steppe_west		
									geographical_region = world_india_rajastan		
									geographical_region = world_asia_minor		
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes

					}
					#Historical razing of the city
					change_development_level = -100
				}
			}
			#Timbuktu
			title:c_tirakka = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_africa		
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						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 = sankore_university
							}
							remove_building = sankore_university
						}
					}
				}
			}
			#Dagon
			title:c_dagon = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_burma
									geographical_region = world_india
									geographical_region = world_tibet		
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						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 = shwedagon_pagoda_01
							}
							remove_building = shwedagon_pagoda_01
						}
					}
				}
			}
			#Cordoba
			title:c_cordoba = {
				every_player = {
					limit = {
						any_sub_realm_county = {
							title_province = {
								OR = {
									geographical_region = world_europe_west
									geographical_region = world_europe_south
									geographical_region = world_africa_north
								}
							}
						}
					}
					trigger_event = counterfactuals.202
				}
				scope:county = {
					title_province = {
						destroy_random_building_variable_effect = yes
						destroy_random_building_effect = yes
						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 = holy_site_great_mosque_of_cordoba_01
							}
							remove_building = holy_site_great_mosque_of_cordoba_01
						}
					}
				}
			}
		}
	}
}
#Mongols Sack Reaction (Default)
counterfactuals.202 = {
	type = character_event
	# content_source = mod_counterfactuals
	title = counterfactuals.202.t
	desc = {
		triggered_desc = {
			trigger = {
				scope:county = title:c_kiev
			}
			desc = counterfactuals.202.kyiv
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_novgorod
			}
			desc = counterfactuals.202.novgorod
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_krakowska
			}
			desc = counterfactuals.202.krakow
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_aachen
			}
			desc = counterfactuals.202.aachen
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_ile_de_france
			}
			desc = counterfactuals.202.paris
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_middlesex
			}
			desc = counterfactuals.202.london
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_roma
			}
			desc = counterfactuals.202.rome
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_venezia
			}
			desc = counterfactuals.202.venice
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_byzantion
			}
			desc = counterfactuals.202.constantinople
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_lisboa
			}
			desc = counterfactuals.202.lisbon
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_smolensk
			}
			desc = counterfactuals.202.smolensk
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_praha
			}
			desc = counterfactuals.202.prague
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_vienna
			}
			desc = counterfactuals.202.vienna
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_esztergom
			}
			desc = counterfactuals.202.esztergom
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_attica
			}
			desc = counterfactuals.202.athens
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_beograd
			}
			desc = counterfactuals.202.belgrade
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_baghdad
				scope:mongol_emperor = {
					NOR = {
						has_trait = education_learning
						has_lifestyle = learning_lifestyle
						has_learning_lifestyle_trait_trigger = yes
						islam_or_syncretic_with_islam_trigger = { CHARACTER = scope:mongol_emperor }
					}
				}
			}
			desc = counterfactuals.202.baghdad
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_baghdad
				scope:mongol_emperor = {
					OR = {
						has_trait = education_learning
						has_lifestyle = learning_lifestyle
						has_learning_lifestyle_trait_trigger = yes
						islam_or_syncretic_with_islam_trigger = { CHARACTER = scope:mongol_emperor }
					}
				}
			}
			desc = counterfactuals.202.baghdad_scholars
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_damascus
			}
			desc = counterfactuals.202.damascus
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_jerusalem
			}
			desc = counterfactuals.202.jerusalem
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_alexandria
			}
			desc = counterfactuals.202.alexandria
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_cairo
			}
			desc = counterfactuals.202.cairo
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_mecca
			}
			desc = counterfactuals.202.mecca
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_delhi
			}
			desc = counterfactuals.202.delhi
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_cholamandalam
			}
			desc = counterfactuals.202.tanjavur
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_dublin
			}
			desc = counterfactuals.202.dublin
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_vestisland
			}
			desc = counterfactuals.202.reykjavik
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_samarkand
			}
			desc = counterfactuals.202.samarkand
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_nishapur
			}
			desc = counterfactuals.202.nishapur
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_tirakka
			}
			desc = counterfactuals.202.timbuktu
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_dagon
			}
			desc = counterfactuals.202.dagon
		}
		triggered_desc = {
			trigger = {
				scope:county = title:c_cordoba
			}
			desc = counterfactuals.202.cordoba
		}

	}
	theme = battle
	override_background = { reference = burning_building }
	right_portrait = {
		character = scope:mongol_emperor
		animation = aggressive_spear
	}
	left_portrait = {
		character = scope:defeated_holder
		animation = fear
	}
	immediate = {
		scope:county = {
			title_province = {
				custom_tooltip = counterfactuals.200.mongolsack.tooltip
				if = {
					limit = {scope:county = title:c_nishapur }
					custom_tooltip =  counterfactuals.202.nishapur.tooltip
				}
				show_as_tooltip = {
					if = {
						limit = { 
							has_building = hagia_sophia_01
						}
						remove_building = hagia_sophia_01
					}
					if = {
						limit = { 
							has_building = hagia_sophia_02
						}
						remove_building = hagia_sophia_02
					}
					if = {
						limit = { 
							has_building = doges_palace_01
						}
						remove_building = doges_palace_01
					}
					if = {
						limit = { 
							has_building = sankore_university
						}
						remove_building = sankore_university
					}
					if = {
						limit = { 
							has_building = holy_site_great_mosque_of_cordoba_01
						}
						remove_building = holy_site_great_mosque_of_cordoba_01
					}
					if = {
						limit = { 
							has_building = iron_pillar_of_delhi_01
						}
						remove_building = iron_pillar_of_delhi_01
					}
					if = {
						limit = { 
							has_building = shwedagon_pagoda_01
						}
						remove_building = shwedagon_pagoda_01
					}
					if = {
						limit = { 
							has_building = brihadeeswarar_temple_01
						}
						remove_building = brihadeeswarar_temple_01
					}
					if = {
						limit = { 
							has_building = sankore_university
						}
						remove_building = sankore_university
					}
					if = {
						limit = { 
							has_building = house_of_wisdom_01
							scope:mongol_emperor = {
								NOR = {
									has_trait = education_learning
									has_lifestyle = learning_lifestyle
									has_learning_lifestyle_trait_trigger = yes
									islam_or_syncretic_with_islam_trigger = { CHARACTER = scope:mongol_emperor }
								}
							}
						}
						remove_building = house_of_wisdom_01
					}
					if = {
						limit = { 
							has_building = dome_of_the_rock_01
						}
						remove_building = dome_of_the_rock_01
					}
					if = {
						limit = { 
							has_building = temple_in_jerusalem_01
						}
						remove_building = temple_in_jerusalem_01
					}
				}
				
			}
			
		}
	}
	#Uh oh
	option = {
		name = counterfactuals.202.a
		trigger = {
			NOR = {
				this = scope:mongol_emperor
				# top_liege = scope:mongol_emperor
				any_sub_realm_county = {
					this = scope:county
				}
			}
		}
	}
	#We're fucked
	option = {
		name = counterfactuals.202.b
		trigger = {
			NOR = {
				this = scope:mongol_emperor
				faith = scope:mongol_emperor.faith
			}
			any_sub_realm_county = {
				this = scope:county
			}
		}
		add_stress = minor_stress_gain
	}
	#haha yes!
	option = {
		name = counterfactuals.202.c
		trigger = {
			OR = {
				this = scope:mongol_emperor
				top_liege = scope:mongol_emperor
			}
			faith = scope:mongol_emperor.faith	
		}
	}
	after = {
		scope:county = {
				set_variable = {
				name = counterfactuals_mongols_sacked
				value = yes
			}
			# debug_log = "### added counterfactuals_mongols_sacked to [county.GetName]"
			hidden_effect = {
				if = {
					limit = { 
						NOT = { exists = var:looted_by_mongols }
					}
				}
				mongols_devastate_county_effect = yes
			}
		}
	}
}
