﻿# COW2 Placeholder #
cow_refound_set_holding_lvl_flag_effect = {
	if = { 
		limit = {  
			OR = {
				has_building = castle_01
				has_building = city_01
				has_building = temple_01
			}
		}
		add_to_local_variable_list  = { name = cow_local_holding_level target = flag:flag_cow_holding_01 }
	}
	else_if = { 
		limit = {  
			OR = {
				has_building = castle_02
				has_building = city_02
				has_building = temple_02
			}
		}
		add_to_local_variable_list  = { name = cow_local_holding_level target = flag:flag_cow_holding_02 }
	}
	else_if = { 
		limit = {  
			OR = {
				has_building = castle_03
				has_building = city_03
				has_building = temple_03
			}
		}
		add_to_local_variable_list  = { name = cow_local_holding_level target = flag:flag_cow_holding_03 }
	}
	else_if = { 
		limit = {  
			OR = {
				has_building = castle_04
				has_building = city_04
				has_building = temple_04
			}
		}
		add_to_local_variable_list  = { name = cow_local_holding_level target = flag:flag_cow_holding_04 }
	}
}

cow_refound_add_holding_level_effect = {
	if = { 
		limit = {  
			is_target_in_local_variable_list = { name = cow_local_holding_level target = flag:flag_cow_holding_01 } 
		}
		# add_building = cow_metropolis_01 # There's no need to add this holding level
		remove_list_local_variable = { name = cow_local_holding_level target = flag:flag_cow_holding_01 } 
	}
	else_if = { 
		limit = {  
			is_target_in_local_variable_list = { name = cow_local_holding_level target = flag:flag_cow_holding_02 } 
		}
		add_building = cow_metropolis_02
		remove_list_local_variable = { name = cow_local_holding_level target = flag:flag_cow_holding_02 } 
	}
	else_if = { 
		limit = {  
			is_target_in_local_variable_list = { name = cow_local_holding_level target = flag:flag_cow_holding_03 } 
		}
		add_building = cow_metropolis_03
		remove_list_local_variable = { name = cow_local_holding_level target = flag:flag_cow_holding_03 } 
	}
	else_if = { 
		limit = {  
			is_target_in_local_variable_list = { name = cow_local_holding_level target = flag:flag_cow_holding_04 } 
		}
		add_building = cow_metropolis_04
		remove_list_local_variable = { name = cow_local_holding_level target = flag:flag_cow_holding_04 } 
	}
}

cow_refound_alexandria_effect = {
	title:b_alexandria.title_province = {
		if = {
			limit = { NOT = { has_holding_type = cow_metropolis_holding } }
			cow_refound_set_holding_lvl_flag_effect = yes
			cow_set_building_lvl_flag_effect = yes
			set_holding_type = cow_metropolis_holding
			set_variable = { # Sets variable so that we know it has been converted
				name = cow_metropolis
				value = yes
			}
			if = {
				limit = { barony_variable_holding_level_trigger = yes }
				cow_refound_add_holding_level_effect = yes
			}
			if = {
				limit = { barony_variable_building_level_trigger = yes }
				cow_add_building_lvl_effect = yes
			}
			title:b_alexandria = {
				if = {
					limit = { NOT = { holder = root } }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
	}
}

cow_refound_antiocheia_effect = {
	title:b_antiocheia.title_province = {
		if = {
			limit = { NOT = { has_holding_type = cow_metropolis_holding } }
			cow_refound_set_holding_lvl_flag_effect = yes
			cow_set_building_lvl_flag_effect = yes
			set_holding_type = cow_metropolis_holding
			set_variable = { # Sets variable so that we know it has been converted
				name = cow_metropolis
				value = yes
			}
			if = {
				limit = { barony_variable_holding_level_trigger = yes }
				cow_refound_add_holding_level_effect = yes
			}
			if = {
				limit = { barony_variable_building_level_trigger = yes }
				cow_add_building_lvl_effect = yes
			}
			title:b_antiocheia = {
				if = {
					limit = { NOT = { holder = root } }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
	}
}

cow_refound_baghdad_effect = {
	title:b_baghdad.title_province = {
		if = {
			limit = { NOT = { has_holding_type = cow_metropolis_holding } }
			cow_refound_set_holding_lvl_flag_effect = yes
			cow_set_building_lvl_flag_effect = yes
			set_holding_type = cow_metropolis_holding
			set_variable = { # Sets variable so that we know it has been converted
				name = cow_metropolis
				value = yes
			}
			if = {
				limit = { barony_variable_holding_level_trigger = yes }
				cow_refound_add_holding_level_effect = yes
			}
			if = {
				limit = { barony_variable_building_level_trigger = yes }
				cow_add_building_lvl_effect = yes
			}
			title:b_baghdad = {
				if = {
					limit = { NOT = { holder = root } }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
	}
}

cow_refound_constantinople_effect = {
	title:b_constantinople.title_province = {
		if = {
			limit = { NOT = { has_holding_type = cow_metropolis_holding } }
			cow_refound_set_holding_lvl_flag_effect = yes
			cow_set_building_lvl_flag_effect = yes
			set_holding_type = cow_metropolis_holding
			set_variable = { # Sets variable so that we know it has been converted
				name = cow_metropolis
				value = yes
			}
			if = {
				limit = { barony_variable_holding_level_trigger = yes }
				cow_refound_add_holding_level_effect = yes
			}
			if = {
				limit = { barony_variable_building_level_trigger = yes }
				cow_add_building_lvl_effect = yes
			}
			title:b_constantinople = {
				if = {
					limit = { NOT = { holder = root } }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
	}
}

cow_refound_cordoba_effect = {
	title:b_cordoba.title_province = {
		if = {
			limit = { NOT = { has_holding_type = cow_metropolis_holding } }
			cow_refound_set_holding_lvl_flag_effect = yes
			cow_set_building_lvl_flag_effect = yes
			set_holding_type = cow_metropolis_holding
			set_variable = { # Sets variable so that we know it has been converted
				name = cow_metropolis
				value = yes
			}
			if = {
				limit = { barony_variable_holding_level_trigger = yes }
				cow_refound_add_holding_level_effect = yes
			}
			if = {
				limit = { barony_variable_building_level_trigger = yes }
				cow_add_building_lvl_effect = yes
			}
			title:b_cordoba = {
				if = {
					limit = { NOT = { holder = root } }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
	}
}

cow_refound_roma_effect = {
	title:b_roma.title_province = {
		if = {
			limit = { NOT = { has_holding_type = cow_metropolis_holding } }
			cow_refound_set_holding_lvl_flag_effect = yes
			cow_set_building_lvl_flag_effect = yes
			set_holding_type = cow_metropolis_holding
			set_variable = { # Sets variable so that we know it has been converted
				name = cow_metropolis
				value = yes
			}
			if = {
				limit = { barony_variable_holding_level_trigger = yes }
				cow_refound_add_holding_level_effect = yes
			}
			if = {
				limit = { barony_variable_building_level_trigger = yes }
				cow_add_building_lvl_effect = yes
			}
			title:b_roma = {
				if = {
					limit = { NOT = { holder = root } }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
	}
}

cow_refound_jerusalem_effect = {
	title:b_jerusalem.title_province = {
		if = {
			limit = { NOT = { has_holding_type = cow_metropolis_holding } }
			cow_refound_set_holding_lvl_flag_effect = yes
			cow_set_building_lvl_flag_effect = yes
			set_holding_type = cow_metropolis_holding
			set_variable = { # Sets variable so that we know it has been converted
				name = cow_metropolis
				value = yes
			}
			if = {
				limit = { barony_variable_holding_level_trigger = yes }
				cow_refound_add_holding_level_effect = yes
			}
			if = {
				limit = { barony_variable_building_level_trigger = yes }
				cow_add_building_lvl_effect = yes
			}
			title:b_jerusalem = {
				if = {
					limit = { NOT = { holder = root } }
					holder = {
						add_opinion = {
							target = root
							modifier = pleased_opinion
							opinion = 30
						}
					}
				}
			}
		}
	}
}