ere_imperial_reconquest = {
	name = CB_NAME_ERE_IMPERIAL_RECONQUEST
	war_name = WAR_NAME_ERE_IMPERIAL_RECONQUEST
	sprite = 17
	truce_days = 3650
	is_permanent = yes
	check_de_jure_tier = KING # this scans all dejure duchies for the counties which are held by or vassals(or below) of selected character. Only valid if is_permanent = yes
	max_attacker_battle_score = 75 #you should at least have to siege down something, and the wars should have the potential to be longer and costlier
	allowed_to_target_tributaries = no
	
	can_use = {
		ROOT = {
			has_landed_title = e_byzantium
			has_romance_culture_trigger = yes
			primary_title = { higher_tier_than = DUKE }
			independent = yes
			mercenary = no
			NOT = { same_realm = FROM }
			NOR = {
				has_claim = e_roman_empire
				has_landed_title = e_wre
			}
		}
		FROM = {
			NOT = { religion_group = muslim }
			NOR = {
				has_landed_title = e_wre
				has_landed_title = e_byzantium
			}
		}
	}
	
	can_use_title = { # Title scope
		region = custom_pars_orientalis
		is_titular = no
	}
	
	can_use_gui = {
		ROOT = {
			scaled_wealth = 0.5
			wealth = 500
		}
	}
	
	is_valid = {
		ROOT = {
			independent = yes
			NOT = { same_realm = FROM }
		}
	}
	
	on_add = { 
		ROOT = { 
			scaled_wealth = { 
				value = -0.5 
				min = -500 
			}
		} 
		if = {
			limit = { defender = { is_offmap_governor = offmap_china } }
			attacker = {  
				sound_effect = china_angered_emperor
				detract_grace_super_huge_effect = yes 
			}
		}
	}
	
	on_success = {
		any_attacker = {
			limit = { character = ROOT }
			participation_scaled_prestige = 100
		}
		any_attacker = {
			limit = { NOT = { character = ROOT } }
			hidden_tooltip = { 
				participation_scaled_prestige = 100
			}
		}
		
		FROM = { prestige = -100 }
	}

	on_success_title = {
		custom_tooltip = { 
			text = other_invasion_succ_tip
			hidden_tooltip = {
				ROOT = {
					vassalize_or_take_under_title = {
						title = PREV
						enemy = FROM
						type = invasion
					}
				}
			}
		}
		if = {
			limit = {
				holder_scope = { character = FROM }
			}
			usurp_title_only = { target = ROOT type = invasion }
		}
	}

	on_fail = {
		ROOT = { 
			prestige = -150 
			transfer_scaled_wealth = {
				to = FROM
				value = 4.0
			}
		}
	}

	on_reverse_demand = {
		ROOT = {
			transfer_scaled_wealth = {
				to = FROM
				value = 4.0
			}
			ROOT = { prestige = -200 }
		}
		any_defender = {
			limit = { character = FROM }
			participation_scaled_piety = 100
			participation_scaled_prestige = 200
			if = {
				limit = {
					uses_decadence = yes
				}
				participation_scaled_decadence = -10
			}
		}
		any_defender = {
			limit = { NOT = { character = FROM } }
			hidden_tooltip = { 
				participation_scaled_piety = 100
				participation_scaled_prestige = 200
				if = {
					limit = {
						uses_decadence = yes
					}
					participation_scaled_decadence = -10
				}
			}
		}
	}

	attacker_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	attacker_ai_defeat_worth = {
		factor = 100
	}

	defender_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	defender_ai_defeat_worth = {
		factor = 100
	}
}
wre_imperial_reconquest = {
	name = CB_NAME_WRE_IMPERIAL_RECONQUEST
	war_name = WAR_NAME_WRE_IMPERIAL_RECONQUEST
	sprite = 17
	truce_days = 3650
	is_permanent = yes
	check_de_jure_tier = KING # this scans all dejure duchies for the counties which are held by or vassals(or below) of selected character. Only valid if is_permanent = yes
	max_attacker_battle_score = 75 #you should at least have to siege down something, and the wars should have the potential to be longer and costlier
	allowed_to_target_tributaries = no
	
	can_use = {
		ROOT = {
			has_landed_title = e_wre
			has_romance_culture_trigger = yes
			primary_title = { higher_tier_than = DUKE }
			independent = yes
			mercenary = no
			NOT = { same_realm = FROM }
			NOR = {
				has_claim = e_roman_empire
				has_landed_title = e_byzantium
			}
		}
		FROM = {
			NOT = { religion_group = muslim }
		    NOR = {
				has_landed_title = e_wre
				has_landed_title = e_byzantium
			}
		}
	}

	can_use_title = { # Title scope
		region = custom_pars_occidentalis
		is_titular = no
	}
	
	can_use_gui = {
		ROOT = {
			scaled_wealth = 0.5
			wealth = 500
		}
	}
	
	is_valid = {
		ROOT = {
			independent = yes
			NOT = { same_realm = FROM }
		}
	}
	
	on_add = { 
		ROOT = { 
			scaled_wealth = { 
				value = -0.5 
				min = -500 
			}
		} 
		if = {
			limit = { defender = { is_offmap_governor = offmap_china } }
			attacker = {  
				sound_effect = china_angered_emperor
				detract_grace_super_huge_effect = yes 
			}
		}
	}	

	on_success = {
		any_attacker = {
			limit = { character = ROOT }
			participation_scaled_prestige = 100
		}
		any_attacker = {
			limit = { NOT = { character = ROOT } }
			hidden_tooltip = { 
				participation_scaled_prestige = 100
			}
		}
		
		FROM = { prestige = -100 }
	}

	on_success_title = {
		custom_tooltip = { 
			text = other_invasion_succ_tip
			hidden_tooltip = {
				ROOT = {
					vassalize_or_take_under_title = {
						title = PREV
						enemy = FROM
						type = invasion
					}
				}
			}
		}
		if = {
			limit = {
				holder_scope = { character = FROM }
			}
			usurp_title_only = { target = ROOT type = invasion }
		}
	}

	on_fail = {
		ROOT = { 
			prestige = -150 
			transfer_scaled_wealth = {
				to = FROM
				value = 4.0
			}
		}
	}

	on_reverse_demand = {
		ROOT = {
			transfer_scaled_wealth = {
				to = FROM
				value = 4.0
			}
			ROOT = { prestige = -200 }
		}
		any_defender = {
			limit = { character = FROM }
			participation_scaled_piety = 100
			participation_scaled_prestige = 200
			if = {
				limit = {
					uses_decadence = yes
				}
				participation_scaled_decadence = -10
			}
		}
		any_defender = {
			limit = { NOT = { character = FROM } }
			hidden_tooltip = { 
				participation_scaled_piety = 100
				participation_scaled_prestige = 200
				if = {
					limit = {
						uses_decadence = yes
					}
					participation_scaled_decadence = -10
				}
			}
		}
	}

	attacker_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	attacker_ai_defeat_worth = {
		factor = 100
	}

	defender_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	defender_ai_defeat_worth = {
		factor = 100
	}
}
sucessor_imperial_reconquest = {
	name = CB_NAME_SUCESSOR_IMPERIAL_RECONQUEST
	war_name = WAR_NAME_SUCESSOR_IMPERIAL_RECONQUEST
	sprite = 17
	truce_days = 3650
	is_permanent = yes
	check_de_jure_tier = KING # this scans all dejure duchies for the counties which are held by or vassals(or below) of selected character. Only valid if is_permanent = yes
	max_attacker_battle_score = 75 #you should at least have to siege down something, and the wars should have the potential to be longer and costlier
	allowed_to_target_tributaries = no
	
	can_use = {
		ROOT = {
			has_romance_culture_trigger = yes
			primary_title = { higher_tier_than = DUKE }
			independent = yes
			mercenary = no
			NOT = { 
				same_realm = FROM
			}
			NOR = {
				has_landed_title = e_wre
				has_landed_title = e_byzantium
				has_landed_title = e_roman_empire
			}
		}
		FROM = {
			NOT = { religion_group = muslim }
		    NOR = {
				has_landed_title = e_wre
				has_landed_title = e_byzantium
			}
		}
	}

	can_use_title = { # Title scope
		region = custom_imperium_romanum
		is_titular = no
		any_direct_de_jure_vassal_title = { #scope to duchy title
			any_direct_de_jure_vassal_title = { #scope to county title
				any_direct_de_jure_vassal_title = {
					OR = {
						holder_scope = {
							OR = {
								character = ROOT
								is_liege_or_above = ROOT
							}
						}
						location = {
							any_neighbor_province = {
								OR = {
									AND = {
										has_owner = yes
										owner = {
											OR = {
												character = ROOT
												is_liege_or_above = ROOT
											}
										}
									}
									AND = {
										is_land = no
										any_neighbor_province = {
											OR = {
												AND = {
													has_owner = yes
													owner = {
														OR = {
															character = ROOT
															is_liege_or_above = ROOT
														}
													}
												}		
												AND = {
													is_land = no
													any_neighbor_province = {
														owner = {
															OR = {
																character = ROOT
																is_liege_or_above = ROOT
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}	
	}
	
	can_use_gui = {
		ROOT = {
			scaled_wealth = 0.5
			wealth = 500
			prestige = 500
		}
	}
		
	is_valid = {
		ROOT = {
			independent = yes
			NOT = { same_realm = FROM }
		}
	}
	
	on_add = { 
		ROOT = { 
			prestige = -500
			scaled_wealth = { 
				value = -0.5 
				min = -500 
			}
		} 
		if = {
			limit = { defender = { is_offmap_governor = offmap_china } }
			attacker = {  
				sound_effect = china_angered_emperor
				detract_grace_super_huge_effect = yes 
			}
		}
	}
	
	on_success = {
		any_attacker = {
			limit = { character = ROOT }
			participation_scaled_prestige = 100
		}
		any_attacker = {
			limit = { NOT = { character = ROOT } }
			hidden_tooltip = { 
				participation_scaled_prestige = 100
			}
		}
		
		FROM = { prestige = -100 }
	}

	on_success_title = {
		custom_tooltip = { 
			text = other_invasion_succ_tip
			hidden_tooltip = {
				ROOT = {
					vassalize_or_take_under_title = {
						title = PREV
						enemy = FROM
						type = invasion
					}
				}
			}
		}
		if = {
			limit = {
				holder_scope = { character = FROM }
			}
			usurp_title_only = { target = ROOT type = invasion }
		}
	}

	on_fail = {
		ROOT = { 
			prestige = -150 
			transfer_scaled_wealth = {
				to = FROM
				value = 4.0
			}
		}
	}

	on_reverse_demand = {
		ROOT = {
			transfer_scaled_wealth = {
				to = FROM
				value = 4.0
			}
			ROOT = { prestige = -200 }
		}
		any_defender = {
			limit = { character = FROM }
			participation_scaled_piety = 100
			participation_scaled_prestige = 200
			if = {
				limit = {
					uses_decadence = yes
				}
				participation_scaled_decadence = -10
			}
		}
		any_defender = {
			limit = { NOT = { character = FROM } }
			hidden_tooltip = { 
				participation_scaled_piety = 100
				participation_scaled_prestige = 200
				if = {
					limit = {
						uses_decadence = yes
					}
					participation_scaled_decadence = -10
				}
			}
		}
	}

	attacker_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	attacker_ai_defeat_worth = {
		factor = 100
	}

	defender_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	defender_ai_defeat_worth = {
		factor = 100
	}
}
re_imperial_reconquest = {
	name = CB_NAME_RE_IMPERIAL_RECONQUEST
	war_name = WAR_NAME_RE_IMPERIAL_RECONQUEST
	sprite = 17
	truce_days = 3650
	is_permanent = yes
	check_de_jure_tier = KING # this scans all dejure duchies for the counties which are held by or vassals(or below) of selected character. Only valid if is_permanent = yes
	max_attacker_battle_score = 75 #you should at least have to siege down something, and the wars should have the potential to be longer and costlier
	allowed_to_target_tributaries = no
	
	can_use = {
		ROOT = {
			has_romance_culture_trigger = yes
			primary_title = { higher_tier_than = DUKE }
			independent = yes
			mercenary = no
			NOT = { 
				same_realm = FROM 
			}
			OR = {
				has_landed_title = e_roman_empire
				has_claim  = e_roman_empire
			}
		}
		FROM = {
			NOT = { religion_group = muslim }
		}
	}

	can_use_title = { # Title scope
		region = custom_imperium_romanum   
		is_titular = no
	}
	
	can_use_gui = {
		ROOT = {
			scaled_wealth = 0.5
			wealth = 500
		}
	}
		
	is_valid = {
		ROOT = {
			independent = yes
			NOT = { same_realm = FROM }
		}
	}
	
	on_add = { 
		ROOT = { 
			scaled_wealth = { 
				value = -0.5 
				min = -500 
			}
		} 
		if = {
			limit = { defender = { is_offmap_governor = offmap_china } }
			attacker = {  
				sound_effect = china_angered_emperor
				detract_grace_super_huge_effect = yes 
			}
		}
	}
	
	on_success = {
		any_attacker = {
			limit = { character = ROOT }
			participation_scaled_prestige = 100
		}
		any_attacker = {
			limit = { NOT = { character = ROOT } }
			hidden_tooltip = { 
				participation_scaled_prestige = 100
			}
		}
		
		FROM = { prestige = -100 }
	}

	on_success_title = {
		custom_tooltip = { 
			text = other_invasion_succ_tip
			hidden_tooltip = {
				ROOT = {
					vassalize_or_take_under_title = {
						title = PREV
						enemy = FROM
						type = invasion
					}
				}
			}
		}
		if = {
			limit = {
				holder_scope = { character = FROM }
			}
			usurp_title_only = { target = ROOT type = invasion }
		}
	}

	on_fail = {
		ROOT = { 
			prestige = -150 
			transfer_scaled_wealth = {
				to = FROM
				value = 4.0
			}
		}
	}

	on_reverse_demand = {
		ROOT = {
			transfer_scaled_wealth = {
				to = FROM
				value = 4.0
			}
			ROOT = { prestige = -200 }
		}
		any_defender = {
			limit = { character = FROM }
			participation_scaled_piety = 100
			participation_scaled_prestige = 200
			if = {
				limit = {
					uses_decadence = yes
				}
				participation_scaled_decadence = -10
			}
		}
		any_defender = {
			limit = { NOT = { character = FROM } }
			hidden_tooltip = { 
				participation_scaled_piety = 100
				participation_scaled_prestige = 200
				if = {
					limit = {
						uses_decadence = yes
					}
					participation_scaled_decadence = -10
				}
			}
		}
	}

	attacker_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	attacker_ai_defeat_worth = {
		factor = 100
	}

	defender_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	defender_ai_defeat_worth = {
		factor = 100
	}
}