# Replacing agendas for compatibility
## cannot vassalize custom subjects, hardcoded to tributaries
estate_nobles_vassalise_vulnerable_country = {
	can_select = {
		is_free_or_tributary_trigger = yes
		is_at_war = no
		num_of_cities = 12
		any_neighbor_country = {
			NOT = { has_reform = free_city }
			OR = {
				is_subject = no
				is_subject_of_type = tributary_state
			}
			OR = {
				NOT = { num_of_cities = 4 }
				NOT = { total_development = 100 }
			}
			OR = {
				NOT = { num_of_cities = 3 }
				NOT = { total_development = 50 }
				ROOT = { total_development = 500 }
			}
			NOT = { is_subject_of = root }
			NOT = { overlord_of = root }
			NOT = { alliance_with = root }
			NOT = { ROOT = { truce_with = prev } }
			NOT = {
				has_opinion = {
					who = root
					value = 100
				}
			}
			OR = {
				is_part_of_hre = no
				NOT = { hre_reform_passed = landfriede }
				ROOT = { is_part_of_hre = no }
			}
			any_owned_province = {
				NOT = { is_claim = root }
				NOT = { is_core = root }
			}
		}
		NOT = { has_country_modifier = foreign_contacts }
	}
	selection_weight = {
		factor = 2
		modifier = {
			factor = 0.5
			has_non_generic_missions = yes
		}
		modifier = {
			factor = 1.5
			num_of_cities = 20
		}
		modifier = {
			factor = 1.5
			num_of_cities = 25
		}
		modifier = {
			factor = 1.5
			num_of_cities = 30
		}
		modifier = {
			factor = 1.5
			num_of_cities = 40
		}
		modifier = {
			factor = 1.5
			num_of_cities = 50
		}
		modifier = {
			factor = 0.25
			any_country = {
				coalition_target = root
			}
		}
	}
	pre_effect = {
		random_neighbor_country = {
			limit = {
				NOT = { has_reform = free_city }
				OR = {
					is_subject = no
					is_subject_of_type = tributary_state
				}
				OR = {
					NOT = { num_of_cities = 4 }
					NOT = { total_development = 100 }
				}
				OR = {
					NOT = { num_of_cities = 3 }
					NOT = { total_development = 50 }
					ROOT = { total_development = 500 }
				}
				NOT = { is_subject_of = root }
				NOT = { overlord_of = root }
				NOT = { alliance_with = root }
				NOT = { ROOT = { truce_with = prev } }
				NOT = {
					has_opinion = {
						who = root
						value = 100
					}
				}
				OR = {
					is_part_of_hre = no
					NOT = { hre_reform_passed = landfriede }
					ROOT = { is_part_of_hre = no }
				}
				any_owned_province = {
					NOT = { is_claim = root }
					NOT = { is_core = root }
				}
			}
			save_event_target_as = agenda_country
			capital_scope = {
				save_event_target_as = agenda_province
			}
		}
	}
	immediate_effect = {
		add_casus_belli = {
			type = cb_vassalize_mission
			months = 240
			target = event_target:agenda_country
		}
	}
	on_invalid = {
		if = {
			limit = {
				has_casus_belli = {
					type = cb_vassalize_mission
					target = event_target:agenda_country
				}
			}
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
	}
	provinces_to_highlight = {
		is_capital_of = event_target:agenda_country
	}
	task_requirements = {
		if = {
			limit = {
				has_estate_agenda_auto_completion = {
					estate = estate_nobles
				}
			}
			has_estate_agenda_auto_completion = {
				estate = estate_nobles
			}
		}
		else = {
			event_target:agenda_country = {
				is_subject_of = root
				NOT = { is_subject_of_type = tributary_state }
			}
		}
	}
	fail_if = {
		OR = {
			is_subject_other_than_tributary_trigger = yes
			event_target:agenda_country = {
				NOT = { num_of_cities = 1 }
			}
		}
	}
	task_completed_effect = {
		on_completed_agenda_effect = {
			estate = estate_nobles
		}
		add_estate_loyalty = {
			estate = estate_nobles
			loyalty = 10
		}
		add_country_modifier = {
			name = foreign_contacts
			duration = 3650
		}
		hidden_effect = {
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
	}
    failing_effect = {
		on_failed_agenda_effect = yes
		clr_auto_complete_flag = yes
        add_estate_loyalty_modifier = {
            estate = estate_nobles
			desc = EST_VAL_AGENDA_DENIED
			loyalty = -5
			duration = 7300
		}
		if = {
			limit = {
				has_casus_belli = {
					type = cb_vassalize_mission
					target = event_target:agenda_country
				}
			}
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
    }
}

estate_rajput_vassalise_vulnerable_country = {
	can_select = {
		is_free_or_tributary_trigger = yes
		is_at_war = no
		num_of_cities = 12
		any_neighbor_country = {
			NOT = { has_reform = free_city }
			OR = {
				is_subject = no
				is_subject_of_type = tributary_state
			}
			OR = {
				NOT = { num_of_cities = 4 }
				NOT = { total_development = 100 }
			}
			OR = {
				NOT = { num_of_cities = 3 }
				NOT = { total_development = 50 }
				ROOT = { total_development = 500 }
			}
			NOT = { is_subject_of = root }
			NOT = { overlord_of = root }
			NOT = { alliance_with = root }
			NOT = { ROOT = { truce_with = prev } }
			NOT = {
				has_opinion = {
					who = root
					value = 100
				}
			}
			OR = {
				is_part_of_hre = no
				NOT = { hre_reform_passed = landfriede }
				ROOT = { is_part_of_hre = no }
			}
			any_owned_province = {
				NOT = { is_claim = root }
				NOT = { is_core = root }
			}
		}
		NOT = { has_country_modifier = foreign_contacts }
	}
	selection_weight = {
		factor = 2
		modifier = {
			factor = 0.5
			has_non_generic_missions = yes
		}
		modifier = {
			factor = 1.5
			num_of_cities = 20
		}
		modifier = {
			factor = 1.5
			num_of_cities = 25
		}
		modifier = {
			factor = 1.5
			num_of_cities = 30
		}
		modifier = {
			factor = 1.5
			num_of_cities = 40
		}
		modifier = {
			factor = 1.5
			num_of_cities = 50
		}
		modifier = {
			factor = 0.25
			any_country = {
				coalition_target = root
			}
		}
	}
	pre_effect = {
		random_neighbor_country = {
			limit = {
				NOT = { has_reform = free_city }
				OR = {
					is_subject = no
					is_subject_of_type = tributary_state
				}
				OR = {
					NOT = { num_of_cities = 4 }
					NOT = { total_development = 100 }
				}
				OR = {
					NOT = { num_of_cities = 3 }
					NOT = { total_development = 50 }
					ROOT = { total_development = 500 }
				}
				NOT = { is_subject_of = root }
				NOT = { overlord_of = root }
				NOT = { alliance_with = root }
				NOT = { ROOT = { truce_with = prev } }
				NOT = {
					has_opinion = {
						who = root
						value = 100
					}
				}
				OR = {
					is_part_of_hre = no
					NOT = { hre_reform_passed = landfriede }
					ROOT = { is_part_of_hre = no }
				}
				any_owned_province = {
					NOT = { is_claim = root }
					NOT = { is_core = root }
				}
			}
			save_event_target_as = agenda_country
			capital_scope = {
				save_event_target_as = agenda_province
			}
		}
	}
	immediate_effect = {
		add_casus_belli = {
			type = cb_vassalize_mission
			months = 240
			target = event_target:agenda_country
		}
	}
	on_invalid = {
		if = {
			limit = {
				has_casus_belli = {
					type = cb_vassalize_mission
					target = event_target:agenda_country
				}
			}
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
	}
	provinces_to_highlight = {
		is_capital_of = event_target:agenda_country
	}
	task_requirements = {
		if = {
			limit = {
				has_estate_agenda_auto_completion = {
					estate = estate_rajput
				}
			}
			has_estate_agenda_auto_completion = {
				estate = estate_rajput
			}
		}
		else = {
			event_target:agenda_country = {
				is_subject_of = root
				NOT = { is_subject_of_type = tributary_state }
			}
		}
	}
	fail_if = {
		OR = {
			is_subject_other_than_tributary_trigger = yes
			event_target:agenda_country = {
				NOT = { num_of_cities = 1 }
			}
		}
	}
    task_completed_effect = {
		on_completed_agenda_effect = {
			estate = estate_rajput
		}
		add_estate_loyalty = {
			estate = estate_rajput
			loyalty = 10
		}
		add_country_modifier = {
			name = foreign_contacts
			duration = 3650
		}
		hidden_effect = {
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
	}
    failing_effect = {
		on_failed_agenda_effect = yes
		clr_auto_complete_flag = yes
        add_estate_loyalty_modifier = {
            estate = estate_rajput
			desc = EST_VAL_AGENDA_DENIED
			loyalty = -5
			duration = 7300
		}
		if = {
			limit = {
				has_casus_belli = {
					type = cb_vassalize_mission
					target = event_target:agenda_country
				}
			}
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
    }
}

estate_maratha_vassalise_vulnerable_country = {
	can_select = {
		is_free_or_tributary_trigger = yes
		is_at_war = no
		num_of_cities = 12
		any_neighbor_country = {
			NOT = { has_reform = free_city }
			OR = {
				is_subject = no
				is_subject_of_type = tributary_state
			}
			OR = {
				NOT = { num_of_cities = 4 }
				NOT = { total_development = 100 }
			}
			OR = {
				NOT = { num_of_cities = 3 }
				NOT = { total_development = 50 }
				ROOT = { total_development = 500 }
			}
			NOT = { is_subject_of = root }
			NOT = { overlord_of = root }
			NOT = { alliance_with = root }
			NOT = { ROOT = { truce_with = prev } }
			NOT = {
				has_opinion = {
					who = root
					value = 100
				}
			}
			OR = {
				is_part_of_hre = no
				NOT = { hre_reform_passed = landfriede }
				ROOT = { is_part_of_hre = no }
			}
			any_owned_province = {
				NOT = { is_claim = root }
				NOT = { is_core = root }
			}
		}
		NOT = { has_country_modifier = foreign_contacts }
	}
	selection_weight = {
		factor = 2
		modifier = {
			factor = 0.5
			has_non_generic_missions = yes
		}
		modifier = {
			factor = 1.5
			num_of_cities = 20
		}
		modifier = {
			factor = 1.5
			num_of_cities = 25
		}
		modifier = {
			factor = 1.5
			num_of_cities = 30
		}
		modifier = {
			factor = 1.5
			num_of_cities = 40
		}
		modifier = {
			factor = 1.5
			num_of_cities = 50
		}
		modifier = {
			factor = 0.25
			any_country = {
				coalition_target = root
			}
		}
	}
	pre_effect = {
		random_neighbor_country = {
			limit = {
				NOT = { has_reform = free_city }
				OR = {
					is_subject = no
					is_subject_of_type = tributary_state
				}
				OR = {
					NOT = { num_of_cities = 4 }
					NOT = { total_development = 100 }
				}
				OR = {
					NOT = { num_of_cities = 3 }
					NOT = { total_development = 50 }
					ROOT = { total_development = 500 }
				}
				NOT = { is_subject_of = root }
				NOT = { overlord_of = root }
				NOT = { alliance_with = root }
				NOT = { ROOT = { truce_with = prev } }
				NOT = {
					has_opinion = {
						who = root
						value = 100
					}
				}
				OR = {
					is_part_of_hre = no
					NOT = { hre_reform_passed = landfriede }
					ROOT = { is_part_of_hre = no }
				}
				any_owned_province = {
					NOT = { is_claim = root }
					NOT = { is_core = root }
				}
			}
			save_event_target_as = agenda_country
			capital_scope = {
				save_event_target_as = agenda_province
			}
		}
	}
	immediate_effect = {
		add_casus_belli = {
			type = cb_vassalize_mission
			months = 240
			target = event_target:agenda_country
		}
	}
	on_invalid = {
		if = {
			limit = {
				has_casus_belli = {
					type = cb_vassalize_mission
					target = event_target:agenda_country
				}
			}
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
	}
	provinces_to_highlight = {
		is_capital_of = event_target:agenda_country
	}
	task_requirements = {
		if = {
			limit = {
				has_estate_agenda_auto_completion = {
					estate = estate_maratha
				}
			}
			has_estate_agenda_auto_completion = {
				estate = estate_maratha
			}
		}
		else = {
			event_target:agenda_country = {
				is_subject_of = root
				NOT = { is_subject_of_type = tributary_state }
			}
		}
	}
	fail_if = {
		OR = {
			is_subject_other_than_tributary_trigger = yes
			event_target:agenda_country = {
				NOT = { num_of_cities = 1 }
			}
		}
	}
    task_completed_effect = {
		on_completed_agenda_effect = {
			estate = estate_maratha
		}
		add_estate_loyalty = {
			estate = estate_maratha
			loyalty = 10
		}
		add_country_modifier = {
			name = foreign_contacts
			duration = 3650
		}
		hidden_effect = {
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
	}
    failing_effect = {
		on_failed_agenda_effect = yes
		clr_auto_complete_flag = yes
        add_estate_loyalty_modifier = {
            estate = estate_maratha
			desc = EST_VAL_AGENDA_DENIED
			loyalty = -5
			duration = 7300
		}
		if = {
			limit = {
				has_casus_belli = {
					type = cb_vassalize_mission
					target = event_target:agenda_country
				}
			}
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
    }
}

estate_nomadic_tribes_vassalise_vulnerable_country = {
	can_select = {
		is_free_or_tributary_trigger = yes
		is_at_war = no
		num_of_cities = 12
		any_neighbor_country = {
			NOT = { has_reform = free_city }
			OR = {
				is_subject = no
				is_subject_of_type = tributary_state
			}
			OR = {
				NOT = { num_of_cities = 4 }
				NOT = { total_development = 100 }
			}
			OR = {
				NOT = { num_of_cities = 3 }
				NOT = { total_development = 50 }
				ROOT = { total_development = 500 }
			}
			NOT = { is_subject_of = root }
			NOT = { overlord_of = root }
			NOT = { alliance_with = root }
			NOT = { ROOT = { truce_with = prev } }
			NOT = {
				has_opinion = {
					who = root
					value = 100
				}
			}
			OR = {
				is_part_of_hre = no
				NOT = { hre_reform_passed = landfriede }
				ROOT = { is_part_of_hre = no }
			}
			any_owned_province = {
				NOT = { is_claim = root }
				NOT = { is_core = root }
			}
		}
		NOT = { has_country_modifier = foreign_contacts }
	}
	selection_weight = {
		factor = 2
		modifier = {
			factor = 0.5
			has_non_generic_missions = yes
		}
		modifier = {
			factor = 1.5
			num_of_cities = 20
		}
		modifier = {
			factor = 1.5
			num_of_cities = 25
		}
		modifier = {
			factor = 1.5
			num_of_cities = 30
		}
		modifier = {
			factor = 1.5
			num_of_cities = 40
		}
		modifier = {
			factor = 1.5
			num_of_cities = 50
		}
		modifier = {
			factor = 0.25
			any_country = {
				coalition_target = root
			}
		}
	}
	pre_effect = {
		random_neighbor_country = {
			limit = {
				NOT = { has_reform = free_city }
				OR = {
					is_subject = no
					is_subject_of_type = tributary_state
				}
				OR = {
					NOT = { num_of_cities = 4 }
					NOT = { total_development = 100 }
				}
				OR = {
					NOT = { num_of_cities = 3 }
					NOT = { total_development = 50 }
					ROOT = { total_development = 500 }
				}
				NOT = { is_subject_of = root }
				NOT = { overlord_of = root }
				NOT = { alliance_with = root }
				NOT = { ROOT = { truce_with = prev } }
				NOT = {
					has_opinion = {
						who = root
						value = 100
					}
				}
				OR = {
					is_part_of_hre = no
					NOT = { hre_reform_passed = landfriede }
					ROOT = { is_part_of_hre = no }
				}
				any_owned_province = {
					NOT = { is_claim = root }
					NOT = { is_core = root }
				}
			}
			save_event_target_as = agenda_country
			capital_scope = {
				save_event_target_as = agenda_province
			}
		}
	}
	immediate_effect = {
		add_casus_belli = {
			type = cb_vassalize_mission
			months = 240
			target = event_target:agenda_country
		}
	}
	on_invalid = {
		if = {
			limit = {
				has_casus_belli = {
					type = cb_vassalize_mission
					target = event_target:agenda_country
				}
			}
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
	}
	provinces_to_highlight = {
		is_capital_of = event_target:agenda_country
	}
	task_requirements = {
		if = {
			limit = {
				has_estate_agenda_auto_completion = {
					estate = estate_nomadic_tribes
				}
			}
			has_estate_agenda_auto_completion = {
				estate = estate_nomadic_tribes
			}
		}
		else = {
			event_target:agenda_country = {
				is_subject_of = root
				NOT = { is_subject_of_type = tributary_state }
			}
		}
	}
	fail_if = {
		OR = {
			is_subject_other_than_tributary_trigger = yes
			event_target:agenda_country = {
				NOT = { num_of_cities = 1 }
			}
		}
	}
    task_completed_effect = {
		on_completed_agenda_effect = {
			estate = estate_nomadic_tribes
		}
		add_estate_loyalty = {
			estate = estate_nomadic_tribes
			loyalty = 10
		}
		add_country_modifier = {
			name = foreign_contacts
			duration = 3650
		}
		hidden_effect = {
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
	}
    failing_effect = {
		on_failed_agenda_effect = yes
		clr_auto_complete_flag = yes
        add_estate_loyalty_modifier = {
            estate = estate_nomadic_tribes
			desc = EST_VAL_AGENDA_DENIED
			loyalty = -5
			duration = 7300
		}
		if = {
			limit = {
				has_casus_belli = {
					type = cb_vassalize_mission
					target = event_target:agenda_country
				}
			}
			remove_casus_belli = {
				type = cb_vassalize_mission
				target = event_target:agenda_country
			}
		}
    }
}