CB_papal_vassalization = {
	name = CB_NAME_PAPAL_VASSALIZATION_VATICAN
	war_name = WAR_NAME_PAPAL_VASSALIZATION_VATICAN
	sprite = 29
	truce_days = 365
	
	is_permanent = yes
	can_ask_to_join_war = yes
	can_call_vassals = yes
	can_call_allies = yes
	attacker_rel_head_is_ally = no
	allowed_to_target_tributaries = no	
	defender_unoccupied_warscore = yes	
	infamy_modifier = 0.1
	sort_priority = 1000
	
	can_use_gui = {
		check_if_crusader_trigger = yes
		ROOT = {
			tier = EMPEROR
			NOT = {
				same_realm = FROM
			}
			NOT = {
				is_liege_or_above = FROM
			}
			NOT = {
				has_non_aggression_pact_with = FROM
			}
			NOT = {
				is_allied_with = FROM
			}
			prestige = 400
			NOT = {
				war_with = FROM
			}
		}
		FROM = {
			lower_tier_than = ROOT
			has_landed_title = k_papal_state
			NOT = {
				has_landed_title = e_papal_state
			}
			in_revolt = no
			independent = yes
			shares_realm_border_with = ROOT
		}
	}
	
	on_add = {
		ROOT = {
			prestige = -400
		}
	}

	on_invalidation = {
	}
	
	can_use = {
		ROOT = {
			tier = EMPEROR
			NOT = {
				same_realm = FROM
			}
			NOT = {
				is_liege_or_above = FROM
			}
			NOT = {
				has_non_aggression_pact_with = FROM
			}
			NOT = {
				is_allied_with = FROM
			}
			prestige = 400
			NOT = {
				war_with = FROM
			}
		}
		FROM = {
			lower_tier_than = ROOT
			has_landed_title = k_papal_state
			NOT = {
				has_landed_title = e_papal_state
			}
			in_revolt = no
			independent = yes
			shares_realm_border_with = ROOT
		}
	}
	
	is_valid = {
		ROOT = {
			tier = EMPEROR
		}	
		FROM = {
			is_landed = yes
			has_landed_title = k_papal_state
		}
	}
	
	on_success = {
		ROOT = {
			show_scope_change = no
		}
	#	any_attacker = {
	#		limit = {
	#			NOT = {
	#				character = ROOT
	#			}
	#		}
	#	}
		FROM = {
			show_scope_change = no
			set_defacto_liege = ROOT
		}
	}
	
	on_fail = {
		FROM = {
			show_scope_change = no
		}
	#	any_defender = {
	#		limit = {
	#			NOT = {
	#				character = FROM
	#			}
	#		}
	#	}
		FROM = {
			show_scope_change = no
		}
	}
	
	on_reverse_demand = {
		FROM = {
			show_scope_change = no
		}
	#	any_defender = {
	#		limit = {
	#			NOT = {
	#				character = FROM
	#			}
	#		}
	#	}
		FROM = {
			show_scope_change = no
		}
	}
	
	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
	}
	
	ai_will_do = { 
		factor = 1
		modifier = {
			factor = 0.3
			ROOT = {
				NOT = {
					war_with = FROM
				}
			}
		}
		modifier = { #Focus on Coronation first.
			factor = 0.6
			ROOT = {
				OR = {
					trait = ambitious
					any_vassal = {
						has_claim = k_papal_state
					}
				}
				NOT = {
					war_with = FROM
				}
			}
		}
	}
}