cb_pte_lift_excommunication = {
	valid_for_subject = no

	prerequisites_self = {
		ai = no
		religion = catholic
		is_excommunicated = yes
	}

	prerequisites = {
		FROM = {
			religion = catholic
			is_papal_controller = yes
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_revoke_cores
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_change_religion
		po_form_personal_union
		po_become_vassal
		po_subjugate_vassal
		po_transfer_vassals
		po_annul_treaties
		po_change_government
		po_revoke_elector
		po_trade_power
		po_humiliate
		po_enforce_rebel_demands
		pte_spawn_reformation_center_in_capital
	}

	war_goal = pte_lift_excommunication_war_goal
}

cb_pte_ban_slavery = {
	valid_for_subject = no

	prerequisites_self = {
		has_country_modifier = the_abolish_slavery_act
		NOT = { has_country_flag = was_forced_to_abolish_slavery }
	}

	prerequisites = {
		FROM = {
			NOT = { has_country_modifier = the_abolish_slavery_act }
			is_free_or_tributary_trigger = yes
			OR = {
				slaves = 1
				any_subject_country = {
					OR = {
						is_colonial_nation = yes
						AND = {
							is_expanded_mod_active = { mod = subjects }
							is_subject_of_type = dominion_tc
						}
					}
					is_subject_other_than_tributary_trigger = yes
					NOT = { has_country_modifier = the_abolish_slavery_act }
					slaves = 1
				}
			}
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_revoke_cores
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_change_religion
		po_form_personal_union
		po_become_vassal
		po_subjugate_vassal
		po_transfer_vassals
		pte_spawn_reformation_center_in_capital
	}

	war_goal = pte_ban_slavery_war_goal
}

cb_pte_protect_religious_bretheren = {
	valid_for_subject = no

	prerequisites_self = {
		is_defender_of_faith = yes
	}

	prerequisites = {
		religion_group = FROM
		NOT = { religion = FROM }
		OR = {
			is_neighbor_of = FROM
			AND = {
				ai = no
				NOT = {
					border_distance = {
						who = FROM
						distance = 500
					}
				}
			}
		}
		FROM = {
			any_owned_province = {
				has_owner_religion = no
				religion = ROOT
				is_city = yes
			}
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_form_personal_union
		po_become_vassal
		po_subjugate_vassal
		po_transfer_vassals
	}

	war_goal = pte_protect_religious_bretheren_war_goal
}

cb_pte_liberation = {
	valid_for_subject = no

	prerequisites = {
		OR = {
			AND = {
				OR = {
					has_dlc = "Rights of Man"
					has_dlc = "Emperor"
				}
				is_great_power = yes
				FROM = {
					is_great_power = yes
				}
				OR = {
					ai = no
					AND = {
						is_neighbor_of = FROM
						OR = {
							is_rival = FROM
							is_enemy = FROM
							AND = {
								has_opinion_modifier = {
									who = FROM
									modifier = aggressive_expansion
								}
								NOT = {
									has_opinion_modifier = {
										who = FROM
										modifier = aggressive_expansion
										value = -20
									}
								}
							}
						}
					}
				}
			}
			AND = {
				has_opinion_modifier = {
					who = FROM
					modifier = aggressive_expansion
				}
				NOT = {
					has_opinion_modifier = {
						who = FROM
						modifier = aggressive_expansion
						value = -30
					}
				}
				capital_scope = {
					region_for_scope_province = {
						is_capital_of = FROM
					}
				}
			}
		}
		FROM = {
			OR = {
				num_of_subjects = 1
				any_owned_province = {
					any_core_country = {
						NOT = { tag = FROM }
					}
				}
			}
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_form_personal_union
		po_become_vassal
		po_subjugate_vassal
		po_transfer_vassals
	}

	war_goal = pte_liberation_war_goal
}

cb_pte_cultural_hegemony = {
	valid_for_subject = no

	prerequisites_self = {
		is_subject = no
		NOT = { has_country_modifier = pte_culture_group_hegemony_cooldown_modifier }
		any_owned_province = {
			culture_group = ROOT
		}
	}

	prerequisites = {
		NOT = { truce_with = FROM }
		FROM = {
			has_country_modifier = pte_culture_group_hegemony_modifier
			NOT = { is_variable_equal = { which = pte_culture_group_hegemony_var value = 0 } }
		}
		culture_group = FROM
		OR = {
			total_development = 50
			variable_arithmetic_trigger = {
				export_to_variable = {
					which = our_dev
					value = trigger_value:total_development
				}
				export_to_variable = {
					which = their_dev
					value = trigger_value:total_development
					who = FROM
				}
				divide_variable = { which = their_dev value = 4 }
				check_variable = { which = our_dev which = their_dev }
			}
		}
	}

	war_goal = pte_cultural_hegemony_war_goal
}

cb_pte_defend_rival_subject = {
	valid_for_subject = no

	prerequisites_self = {
		is_subject = no
	}

	prerequisites = {
		is_rival = FROM
		FROM = {
			is_subject = no
		}
		any_country = {
			offensive_war_with = FROM
			NOT = { war_with = ROOT }
			OR = {
				is_in_war = {
					attacker_leader = THIS
					defender_leader = FROM
					casus_belli = cb_independence_war
				}
				is_in_war = {
					attacker_leader = THIS
					defender_leader = FROM
					casus_belli = cb_colonial_independence_war
				}
			}
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
	}

	war_goal = pte_defend_rival_subject_war_goal
}

cb_pte_economic_hegemon = {
	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Emperor"
		pte_is_hegemon_of_type = { type = economic_hegemon }
		hegemon_strength = 25
	}

	prerequisites = {
		FROM = {
			is_great_power = yes
			monthly_income = 300
			is_bankrupt = no
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
	}

	war_goal = pte_economic_hegemon_war_goal
}

cb_pte_naval_hegemon = {
	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Emperor"
		pte_is_hegemon_of_type = { type = naval_hegemon }
		hegemon_strength = 25
	}

	prerequisites = {
		FROM = {
			is_great_power = yes
			navy_size = 1
			variable_arithmetic_trigger = {
				export_to_variable = {
					which = their_num_of_heavy_ships
					value = trigger_value:num_of_heavy_ship
				}
				export_to_variable = {
					which = their_num_of_light_ships
					value = trigger_value:num_of_light_ship
				}
				export_to_variable = {
					which = their_num_of_galleys
					value = trigger_value:num_of_galley
				}
				change_variable = { which = their_num_of_heavy_ships which = their_num_of_light_ships }
				change_variable = { which = their_num_of_heavy_ships which = their_num_of_galleys }
				check_variable = { which = their_num_of_heavy_ships value = 100 }
			}
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
	}

	war_goal = pte_naval_hegemon_war_goal
}

cb_pte_military_hegemon = {
	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Emperor"
		pte_is_hegemon_of_type = { type = military_hegemon }
		hegemon_strength = 25
	}

	prerequisites = {
		FROM = {
			is_great_power = yes
			army_size = 300
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
	}

	war_goal = pte_military_hegemon_war_goal
}

cb_pte_anti_coalition = {
	valid_for_subject = no

	ai_peace_desire = -30

	prerequisites_self = {
		is_in_coalition_war = no
	}

	prerequisites = {
		FROM = {
			coalition_target = ROOT
			num_of_coalition_members = 3
			is_revolutionary = no
		}
	}

	war_goal = pte_anti_coalition_war_goal
}

cb_pte_border_friction = {
	valid_for_subject = no
	is_triggered_only = yes
	months = 24

	ai_peace_desire = 10

	prerequisites_self = {
		is_free_or_tributary_trigger = yes
	}

	prerequisites = {
		is_neighbor_of = FROM
		FROM = {
			is_free_or_tributary_trigger = yes
		}
		NOT = { overlord_of = FROM }
		NOT = { is_subject_of = FROM }
	}

	war_goal = pte_border_friction_war_goal
}

cb_pte_take_monument = {
	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Leviathan"
		is_free_or_tributary_trigger = yes
	}

	prerequisites = {
		NOT = { overlord_of = FROM }
		NOT = { is_subject_of = FROM }
		NOT = { truce_with = FROM }
		NOT = { alliance_with = FROM }
		OR = {
			is_neighbor_of = FROM
			NOT = {
				border_distance = {
					who = FROM
					distance = 100
				}
			}
			FROM = {
				is_subject_other_than_tributary_trigger = yes
				overlord = {
					OR = {
						is_neighbor_of = ROOT
						NOT = {
							border_distance = {
								who = FROM
								distance = 100
							}
						}
					}
				}
			}
		}
		FROM = {
			any_owned_province = {
				is_city = yes
				pte_has_moveable_monument_usable_by = { who = ROOT }
			}
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_change_religion
		po_form_personal_union
		po_become_vassal
		po_subjugate_vassal
		po_transfer_vassals
		po_annul_treaties
		po_change_government
		po_revoke_elector
		po_trade_power
		pte_spawn_reformation_center_in_capital
	}

	war_goal = pte_take_monument_war_goal
}

cb_pte_stop_raiding = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 60

	prerequisites_self = {
		is_free_or_tributary_trigger = yes
	}

	prerequisites = {
		has_opinion_modifier = {
			who = FROM
			modifier = slaves_raided
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_revoke_cores
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
		pte_spawn_reformation_center_in_capital
	}

	war_goal = pte_stop_raiding_war_goal
}

cb_pte_force_convert_heathen = {
	valid_for_subject = no

	prerequisites_self = {
		is_free_or_tributary_trigger = yes
		OR = {
			is_defender_of_faith = yes
			is_papal_controller = yes
			AND = {
				NOT = { religion_group = christian }
				NOT = { religion_group = muslim }
				government = theocracy
			}
		}
		NOT = { has_reform = religious_permanent_revolution_reform }
		NOT = { current_age = classical_age }
		NOT = { current_age = late_classical_age }
		NOT = { current_age = age_of_migrations }
		OR = {
			full_idea_group = religious_ideas
			AND = {
				has_global_flag = extended_timeline_mod
				full_idea_group = early_religious_ideas
				NOT = { adm_tech = 50 }
			}
			has_reform = feudal_theocracy
			has_reform = crusading_kingdom_reform
			has_reform = militarized_crusader_order_reform
			has_reform = holy_horde_reform
			has_reform = kingdom_of_god_reform
			has_reform = battle_pope_reform
		}
	}

	prerequisites = {
		NOT = { religion_group = FROM }
		FROM = {
			is_free_or_tributary_trigger = yes
			NOT = { tag = PAP }
		}
		can_use_peace_treaty = {
			who = FROM
			treaty = po_change_religion
		}
		OR = {
			ai = no
			same_continent = FROM
			AND = {
				OR = {
					religion_group = christian
					religion_group = muslim
				}
				FROM = {
					capital_scope = {
						NOT = { continent = north_america }
						NOT = { continent = south_america }
					}
				}
			}
		}
		FROM = {
			OR = {
				is_neighbor_of = ROOT
				any_neighbor_country = {
					is_subject_of = ROOT
					religion = ROOT
					is_colonial_nation = no
					is_subject_other_than_tributary_trigger = yes
				}
			}
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_revoke_cores
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
		pte_spawn_reformation_center_in_capital
	}

	war_goal = pte_force_convert_heathen_war_goal
}

cb_pte_liberate_papal_states = {
	valid_for_subject = no

	prerequisites_self = {
		is_free_or_tributary_trigger = yes
		religion = catholic
		num_of_cardinals = 1
		NOT = { tag = PAP }
		NOT = { overlord_of = PAP }
		OR = {
			NOT = { exists = PAP }
			118 = {
				NOT = { owned_by = PAP }
			}
		}
		NOT = { owns_or_subject_of = 118 }
	}

	prerequisites = {
		118 = { owned_by = FROM }
		FROM = {
			OR = {
				is_free_or_tributary_trigger = yes
				AND = {
					is_subject_other_than_tributary_trigger = yes
					overlord = {
						is_free_or_tributary_trigger = yes
					}
				}
			}
		}
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
		pte_spawn_reformation_center_in_capital
	}

	war_goal = pte_liberate_papal_states_war_goal
}