﻿county_conquest_cb = {
	icon = county_conquest_cb
	group = conquest

	combine_into_one = yes
	should_show_war_goal_subview = yes
	mutually_exclusive_titles = { always = yes }

	allowed_for_character = {
		can_use_conquest_cbs_trigger = yes
		NOT = {
			government_has_flag = government_is_landless_adventurer
		}
	}

	allowed_for_character_display_regardless = {
		# Struggle constraint - Note: This is the CB you get in FP2 opportunity, if you need to debug, test it here first.
		custom_tooltip = {
			text = struggle_involvement_cb_check_failure
			struggle_blocks_invasion_conquest_cb_trigger = yes
		}
		tgp_japan_offensive_wars_ban_trigger = yes
	}

	allowed_against_character = {
		scope:attacker.top_liege != scope:defender.top_liege
		NAND = {
			scope:attacker = { government_has_flag = government_is_nomadic }
			scope:defender = { government_has_flag = government_is_nomadic }
		}
	}
	target_titles = all
	target_title_tier = county
	ignore_effect = change_title_holder

	attacker_score_from_occupation_scale = 150
	attacker_score_from_battles_scale = 150
	defender_score_from_battles_scale = 150

	ai_can_target_all_titles = {
		can_use_viking_invasion_cbs_trigger = yes
	}
	ai_score_mult = {
		value = viking_conquest_ai_score_value

		# As a feudal gov, do not attack owner of tribal holdings  if you have a tribal holding to convert already
		add = {
			every_in_list = {
				list = target_titles
				if = {
					limit = { feudal_clan_tribal_conquest_constraints = yes }
					add = -1000
				}
			}
		}
		# HOUSE RELATIONS
		add = house_relation_ai_score_value
		# AI in struggles act insularly for wars that don't have a familial or legal basis.
		multiply = struggle_wars_prioritise_struggle_targets_value
		# Tell the Romans to stop going adventuring into the steppe for no gods-damned reason.
		multiply = byzantium_conquests_ai_score_value

		multiply = pam_peace_of_god_coreligionist_war_ai_score_value
		multiply = zealous_war_on_head_of_faith_ai_score_value
		add = frankokratia_leader_protection_value #Set back to 0. Declaring war on the frankokratia leader can really ruin the whole thing
	}

	valid_to_start = {
		scope:target = {
			is_landless_type_title = no
			neighboring_county_or_viking_conquest_trigger = { CHARACTER = root }
		}
	}

	should_invalidate = {
		war_should_invalidate_defender_lost_target_lands_trigger = yes
	}

	on_invalidated_desc = msg_county_conquest_war_invalidated_message
	on_invalidated = {}

	cost = {
		piety = {
			add = county_cb_piety_base_cost
			multiply = common_cb_piety_cost_multiplier
		}
		prestige = {
			add = county_cb_prestige_base_cost
			multiply = common_cb_prestige_cost_multiplier
		}
	}

	on_declaration = {
		on_declared_war = yes
	}

	on_victory_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:attacker = { is_local_player = yes } }
				desc = county_conquest_cb_victory_desc_attacker
			}
			desc = county_conquest_cb_victory_desc
		}
	}

	on_victory = {
		on_victory_aggressive_war_effect = yes

		#EP2 accolade glory gain for winning against higher ranked enemy
		scope:attacker = { accolade_attacker_war_end_glory_gain_low_effect = yes }

		create_title_and_vassal_change = {
			type = conquest
			save_scope_as = change
			add_claim_on_loss = yes
		}

		#As this is just a county conquest, simply grab the designated county.
		every_in_list = {
			list = target_titles
			change_title_holder = {
				holder = scope:attacker
				change = scope:change
			}
		}

		resolve_title_and_vassal_change = scope:change

		# Prestige Progress for the Attacker
		every_in_list = {
			list = target_titles
			scope:attacker = {
				add_prestige_experience = minor_prestige_value
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:attacker
			FAME_BASE = minor_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	on_white_peace_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:defender = { is_local_player = yes } }
				desc = county_conquest_cb_white_peace_desc_defender
			}
			desc = county_conquest_cb_white_peace_desc
		}
	}

	on_white_peace = {
		on_white_peace_effect = yes
		# Prestige loss for the attacker
		scope:attacker = {
			add_prestige = {
				value = minor_prestige_value
				multiply = -1.0
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:attacker # Not important as the scales are identical
			FAME_BASE = minor_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	on_defeat_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:defender = { is_local_player = yes } }
				desc = county_conquest_cb_defeat_desc_defender
			}
			triggered_desc = {
				trigger = {
					scope:attacker = {
						is_local_player = yes
						has_targeting_faction = yes
					}
				}
				desc = county_conquest_cb_defeat_desc_attacker
			}
			desc = county_conquest_cb_defeat_desc
		}
	}

	on_defeat = {
		on_defeat_aggressive_war_effect = yes

		scope:defender = {
			#EP2 accolade glory gain for winning against higher ranked enemy
			accolade_defender_war_end_glory_gain_low_effect = yes
			# Prestige for Defender
			add_prestige_war_defender_effect = {
				PRESTIGE_VALUE = medium_prestige_value
			}
		}

		# Prestige loss for the attacker
		scope:attacker = {
			pay_short_term_gold_reparations_effect = {
				GOLD_VALUE = 2
			}
			add_prestige = medium_prestige_loss
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:defender
			FAME_BASE = minor_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	transfer_behavior = transfer

	on_primary_attacker_death = inherit
	on_primary_defender_death = inherit

	attacker_allies_inherit = yes
	defender_allies_inherit = yes

	war_name = "CONQUEST_WAR_NAME"
	war_name_base = "CONQUEST_WAR_NAME_BASE"
	cb_name = "CONQUEST_COUNTY_CB_NAME"

	interface_priority = 79

	use_de_jure_wargoal_only = yes

	attacker_wargoal_percentage = 0.8

	max_defender_score_from_occupation = 150
	max_attacker_score_from_occupation = 150
}

duchy_conquest_cb = {
	icon = duchy_conquest_cb
	group = conquest

	combine_into_one = yes
	should_show_war_goal_subview = yes
	mutually_exclusive_titles = { always = yes }

	attacker_score_from_occupation_scale = 150
	attacker_score_from_battles_scale = 150
	defender_score_from_battles_scale = 150

	allowed_for_character = {
		can_use_conquest_cbs_trigger = yes
		NOT = {
			government_has_flag = government_is_landless_adventurer
		}
	}

	allowed_for_character_display_regardless = {
		trigger_if = {
			limit = {
				highest_held_title_tier >= tier_kingdom
			}
			prestige_level > -1
		}
		trigger_else = {
			trigger_if = {
				limit = {
					government_has_flag = government_is_clan
					house ?= {
						has_house_unity_stage = antagonistic
					}
					culture ?= {
						has_cultural_parameter = cb_lower_prestige_level_requirement
					}
				}
				prestige_level >= 1
			}
			trigger_else_if = {
				limit = {
					OR = {
						AND = {
							government_has_flag = government_is_clan
							house ?= {
								has_house_unity_stage = antagonistic
							}
						}
						culture ?= {
							has_cultural_parameter = cb_lower_prestige_level_requirement
						}
					}
				}
				prestige_level >= 2
			}
			trigger_else = {
				prestige_level >= 3
			}
		}

		# Struggle constraint
		custom_tooltip = {
			text = struggle_involvement_cb_check_failure
			struggle_blocks_invasion_conquest_cb_trigger = yes
		}
		tgp_japan_offensive_wars_ban_trigger = yes
	}

	allowed_against_character = {
		scope:attacker.top_liege != scope:defender.top_liege
		NAND = {
			scope:attacker = { government_has_flag = government_is_nomadic }
			scope:defender = { government_has_flag = government_is_nomadic }
		}
	}
	target_titles = all
	target_title_tier = duchy
	target_de_jure_regions_above = yes
	ignore_effect = change_title_holder

	ai_can_target_all_titles = {
		can_use_viking_invasion_cbs_trigger = yes
	}
	ai_score_mult = {
		value = viking_conquest_ai_score_value

		# As a feudal gov, do not attack tribal
		add = {
			every_in_list = {
				list = target_titles
				if = {
					limit = { feudal_clan_tribal_conquest_constraints = yes }
					add = -1000
				}
			}
		}
		# HOUSE RELATIONS
		add = house_relation_ai_score_value
		# AI in struggles act insularly for wars that don't have a familial or legal basis.
		multiply = struggle_wars_prioritise_struggle_targets_value
		# Tell the Romans to stop going adventuring into the steppe for no gods-damned reason.
		multiply = byzantium_conquests_ai_score_value
		multiply = muslim_invasions_prefer_nonmuslims_ai_score_value

		multiply = pam_peace_of_god_coreligionist_war_ai_score_value
		multiply = zealous_war_on_head_of_faith_ai_score_value
		add = frankokratia_leader_protection_value #Set back to 0. Declaring war on the frankokratia leader can really ruin the whole thing
	}

	valid_to_start = {
		scope:target = {
			is_landless_type_title = no
			any_in_de_jure_hierarchy = {
				tier = tier_county
				neighboring_county_or_viking_conquest_trigger = { CHARACTER = root }
			}
		}
		ai_aggressive_cb_constraints = yes
	}

	should_invalidate = {
		war_should_invalidate_defender_lost_target_lands_trigger = yes
	}

	on_invalidated_desc = msg_religious_war_invalidation_region_message

	on_invalidated = {
	}

	cost = {
		piety = {
			add = common_cb_impious_piety_cost
			add = duchy_cb_piety_base_cost
			multiply = common_cb_piety_cost_multiplier
		}
		prestige = {
			add = duchy_cb_prestige_base_cost
			multiply = common_cb_prestige_cost_multiplier
			multiply = conquest_cb_prestige_cost_multiplier
		}
	}

	on_declaration = {
		on_declared_war = yes
	}

	on_victory_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:attacker = { is_local_player = yes } }
				desc = county_conquest_cb_victory_desc_attacker
			}
			desc = county_conquest_cb_victory_desc
		}
	}

	on_victory = {
		on_victory_aggressive_war_effect = yes

		#EP2 accolade glory gain for winning against higher ranked enemy
		scope:attacker = { accolade_attacker_war_end_glory_gain_med_effect = yes }

		create_title_and_vassal_change = {
			type = conquest
			save_scope_as = change
			add_claim_on_loss = yes
		}

		# go through the dejure hierarchy under target titles, transfer eligible vassals and seize counties from ineligible ones
		every_in_list = {
			list = target_titles
			custom_tooltip = CONQUEST_CB_TITLE

			conquest_cb_title_transfer = {
				RELIGIOUS_WAR = no
			}
		}

		every_in_list = {
			list = vassals_taken
			change_liege = {
				liege = scope:attacker
				change = scope:change
			}
		}

		every_in_list = {
			list = titles_taken
			change_title_holder = {
				holder = scope:attacker
				change = scope:change
				take_baronies = yes
			}
		}

		resolve_title_and_vassal_change = scope:change

		# Prestige Progress for the Attacker
		every_in_list = {
			list = target_titles
			scope:attacker = {
				add_prestige_experience = medium_prestige_value
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:attacker
			FAME_BASE = medium_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	on_white_peace_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:defender = { is_local_player = yes } }
				desc = county_conquest_cb_white_peace_desc_defender
			}
			desc = county_conquest_cb_white_peace_desc
		}
	}

	on_white_peace = {
		on_white_peace_effect = yes

		#EP2 accolade glory gain for doing pretty good against higher ranked enemy
		scope:defender = { accolade_defender_war_end_glory_gain_low_effect = yes }

		scope:attacker = {
			add_prestige = {
				value = minor_prestige_value
				multiply = -1.0
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:attacker # not impactful as the scale are identical
			FAME_BASE = medium_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	on_defeat_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:defender = { is_local_player = yes } }
				desc = county_conquest_cb_defeat_desc_defender
			}
			triggered_desc = {
				trigger = {
					scope:attacker = {
						is_local_player = yes
						has_targeting_faction = yes
					}
				}
				desc = county_conquest_cb_defeat_desc_attacker
			}
			desc = county_conquest_cb_defeat_desc
		}
	}

	on_defeat = {
		on_defeat_aggressive_war_effect = yes

		scope:defender = {
			#EP2 accolade glory gain for winning against higher ranked enemy
			accolade_defender_war_end_glory_gain_med_effect = yes
			# Prestige for Defender
			add_prestige_war_defender_effect = {
				PRESTIGE_VALUE = major_prestige_value
			}
		}

		# Prestige loss for the attacker
		scope:attacker = {
			pay_short_term_gold_reparations_effect = {
				GOLD_VALUE = 3
			}
			add_prestige = {
				value = major_prestige_value
				multiply = -1.0
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:defender
			FAME_BASE = medium_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	transfer_behavior = transfer

	on_primary_attacker_death = inherit
	on_primary_defender_death = inherit

	attacker_allies_inherit = yes
	defender_allies_inherit = yes

	war_name = "CONQUEST_WAR_NAME"
	war_name_base = "CONQUEST_WAR_NAME_BASE"
	cb_name = "CONQUEST_DUCHY_CB_NAME"

	interface_priority = 79

	use_de_jure_wargoal_only = yes

	attacker_wargoal_percentage = 0.8

	max_defender_score_from_occupation = 150
	max_attacker_score_from_occupation = 150
}

ducal_conquest_cb = {
	icon = county_conquest_cb
	group = conquest

	combine_into_one = yes
	should_show_war_goal_subview = yes
	mutually_exclusive_titles = { always = yes }

	attacker_score_from_occupation_scale = 150
	attacker_score_from_battles_scale = 150
	defender_score_from_battles_scale = 150

	allowed_for_character = {
		has_perk = ducal_conquest_perk
		can_use_conquest_cbs_trigger = no
		NOR = {
			government_has_flag = government_is_merchant
			government_has_flag = government_is_landless_adventurer
			government_has_flag = government_is_nomadic
			government_has_flag = government_is_republic
		}
	}

	allowed_against_character = {
		# scope:attacker.top_liege != scope:defender.top_liege
	}
	target_titles = neighbor_land
	target_title_tier = duchy
	target_de_jure_regions_above = yes
	ignore_effect = change_title_holder

	valid_to_start = {
		scope:target = {
			is_landless_type_title = no
			is_title_created = no
			any_de_jure_county = {
				holder = {
					target_is_same_character_or_above = scope:attacker
				}
			}
		}
		ai_aggressive_cb_constraints = yes
	}

	allowed_for_character_display_regardless = {
		# Struggle constraint
		custom_tooltip = {
			text = struggle_involvement_cb_check_failure
			struggle_blocks_invasion_conquest_cb_trigger = yes
		}
		tgp_japan_offensive_wars_ban_trigger = yes
	}

	should_invalidate = {
		war_should_invalidate_defender_lost_target_lands_trigger = yes
	}

	on_invalidated_desc = msg_county_conquest_war_invalidated_message

	on_invalidated = {
	}

	cost = {
		piety = {
			value = 0
			add = common_cb_impious_piety_cost
		}
		prestige = {
			value = 0
			if = {
				limit = {
					scope:attacker.primary_title.tier <= tier_county
				}
				add = {
					value = 50
					desc = CB_BASE_COST
				}
			}
			else = {
				add = {
					value = 100
					desc = CB_BASE_COST
				}
			}

			multiply = common_cb_prestige_cost_multiplier
		}
	}

	on_declaration = {
		on_declared_war = yes
	}

	on_victory_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:attacker = { is_local_player = yes } }
				desc = ducal_conquest_cb_victory_desc_attacker
			}
			desc = ducal_conquest_cb_victory_desc
		}
	}

	on_victory = {
		on_victory_aggressive_war_effect = yes

		#EP2 accolade glory gain for winning against higher ranked enemy
		scope:attacker = { accolade_attacker_war_end_glory_gain_low_effect = yes }

		create_title_and_vassal_change = {
			type = conquest
			save_scope_as = change
			add_claim_on_loss = yes
		}

		# go through the dejure hierarchy under target titles, transfer eligible vassals and seize counties from ineligible ones
		every_in_list = {
			list = target_titles
			custom_tooltip = CONQUEST_CB_TITLE

			conquest_cb_title_transfer = {
				RELIGIOUS_WAR = yes
			}
		}

		every_in_list = {
			list = titles_taken
			change_title_holder = {
				holder = scope:attacker
				change = scope:change
				take_baronies = yes
			}
		}

		every_in_list = {
			list = vassals_taken
			change_liege = {
				liege = scope:attacker
				change = scope:change
			}
		}

		resolve_title_and_vassal_change = scope:change

		# Prestige Progress for the Attacker
		every_in_list = {
			list = target_titles
			scope:attacker = {
				add_prestige_experience = minor_prestige_value
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:attacker
			FAME_BASE = minor_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	on_white_peace_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:defender = { is_local_player = yes } }
				desc = ducal_conquest_cb_white_peace_desc_defender
			}
			desc = ducal_conquest_cb_white_peace_desc
		}
	}

	on_white_peace = {
		on_white_peace_effect = yes
		# Prestige loss for the attacker
		scope:attacker = {
			add_prestige = {
				value = minor_prestige_value
				multiply = -1.0
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:attacker # not important as scale values are identical
			FAME_BASE = minor_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	on_defeat_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:defender = { is_local_player = yes } }
				desc = ducal_conquest_cb_defeat_desc_defender
			}
			triggered_desc = {
				trigger = {
					scope:attacker = {
						is_local_player = yes
						has_targeting_faction = yes
					}
				}
				desc = ducal_conquest_cb_defeat_desc_attacker
			}
			desc = ducal_conquest_cb_defeat_desc
		}
	}

	on_defeat = {
		on_defeat_aggressive_war_effect = yes

		scope:defender = {
			#EP2 accolade glory gain for winning against higher ranked enemy
			accolade_defender_war_end_glory_gain_low_effect = yes
			# Prestige for Defender
			add_prestige_war_defender_effect = {
				PRESTIGE_VALUE = medium_prestige_value
			}
		}

		# Prestige loss for the attacker
		scope:attacker = {
			pay_short_term_gold_reparations_effect = {
				GOLD_VALUE = 2
			}
			add_prestige = {
				value = medium_prestige_value
				multiply = -1.0
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:defender
			FAME_BASE = minor_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	transfer_behavior = transfer

	on_primary_attacker_death = inherit
	on_primary_defender_death = inherit

	attacker_allies_inherit = yes
	defender_allies_inherit = yes

	war_name = "DUCAL_CONQUEST_WAR_NAME"
	war_name_base = "DUCAL_CONQUEST_WAR_NAME_BASE"
	cb_name = "DUCAL_CONQUEST_CB_NAME"

	interface_priority = 79

	use_de_jure_wargoal_only = yes

	attacker_wargoal_percentage = 0.8

	max_defender_score_from_occupation = 150
	max_attacker_score_from_occupation = 150

	max_ai_diplo_distance_to_title = 1500

	ai_score_mult = {
		value = 1
		multiply = pam_peace_of_god_coreligionist_war_ai_score_value
		multiply = zealous_war_on_head_of_faith_ai_score_value
		add = frankokratia_leader_protection_value #Set back to 0. Declaring war on the frankokratia leader can really ruin the whole thing
	}
}

ireland_laudabiliter_conquest_cb = {
	icon = county_conquest_cb
	group = conquest

	combine_into_one = yes
	should_show_war_goal_subview = yes
	mutually_exclusive_titles = { always = yes }

	attacker_score_from_occupation_scale = 150
	attacker_score_from_battles_scale = 150
	defender_score_from_battles_scale = 150

	allowed_for_character = {
		exists = scope:attacker.house
		scope:attacker.house = { #Laudabiliter modifier allows conquest on Ireland region.
			has_house_modifier = ireland_laudabiliter_modifier
		}
	}

	allowed_against_character = {
		scope:attacker.top_liege != scope:defender.top_liege
	}
	target_titles = all
	target_title_tier = county
	target_de_jure_regions_above = yes
	ignore_effect = change_title_holder
	ai_only_against_neighbors = yes

	valid_to_start = {
		scope:target = {
			is_landless_type_title = no
			scope:attacker.house = {
				has_house_modifier = ireland_laudabiliter_modifier
			}
			title_province = { geographical_region = custom_roman_hibernia }
		}
	}

	allowed_for_character_display_regardless = {
		# Struggle constraint
		custom_tooltip = {
			text = struggle_involvement_cb_check_failure
			struggle_blocks_invasion_conquest_cb_trigger = yes
		}
		tgp_japan_offensive_wars_ban_trigger = yes
	}

	should_invalidate = {
		war_should_invalidate_defender_lost_target_lands_trigger = yes
	}

	on_invalidated = {
	}

	cost = {
		piety = {
			add = common_cb_impious_piety_cost
			add = county_cb_piety_base_cost
			multiply = common_cb_piety_cost_multiplier
		}
		prestige = {
			value = 0
			add = county_cb_prestige_base_cost
			multiply = common_cb_prestige_cost_multiplier
		}
	}

	on_declaration = {
		on_declared_war = yes
	}

	on_victory_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:attacker = { is_local_player = yes } }
				desc = ireland_laudabiliter_conquest_cb_victory_desc_attacker
			}
			triggered_desc = {
				trigger = { scope:defender = { is_local_player = yes } }
				desc = ireland_laudabiliter_conquest_cb_victory_desc_defender
			}
			desc = ireland_laudabiliter_conquest_cb_victory_desc
		}
	}

	on_victory = {
		on_victory_aggressive_war_effect = yes

		#EP2 accolade glory gain for winning against higher ranked enemy
		scope:attacker = { accolade_attacker_war_end_glory_gain_low_effect = yes }

		create_title_and_vassal_change = {
			type = conquest
			save_scope_as = change
			add_claim_on_loss = yes
		}

		# go through the dejure hierarchy under target titles, transfer eligible vassals and seize counties from ineligible ones
		every_in_list = {
			list = target_titles
			custom_tooltip = CONQUEST_CB_TITLE

			conquest_cb_title_transfer = {
				RELIGIOUS_WAR = yes
			}
		}

		every_in_list = {
			list = titles_taken
			change_title_holder = {
				holder = scope:attacker
				change = scope:change
				take_baronies = yes
			}
		}

		every_in_list = {
			list = vassals_taken
			change_liege = {
				liege = scope:attacker
				change = scope:change
			}
		}

		resolve_title_and_vassal_change = scope:change

		# Prestige Progress for the Attacker
		every_in_list = {
			list = target_titles
			scope:attacker = {
				add_prestige_experience = minor_prestige_value
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:attacker
			FAME_BASE = minor_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	on_white_peace_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:defender = { is_local_player = yes } }
				desc = ireland_laudabiliter_conquest_cb_white_peace_desc_defender
			}
			desc = ireland_laudabiliter_conquest_cb_white_peace_desc
		}
	}

	on_white_peace = {
		on_white_peace_effect = yes
		# Prestige loss for the attacker
		scope:attacker = {
			add_prestige = {
				value = minor_prestige_value
				multiply = -1.0
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:attacker # not important as the scales are identical
			FAME_BASE = minor_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	on_defeat_desc = {
		first_valid = {
			triggered_desc = {
				trigger = { scope:defender = { is_local_player = yes } }
				desc = ireland_laudabiliter_conquest_cb_defeat_desc_defender
			}
			triggered_desc = {
				trigger = {
					scope:attacker = {
						is_local_player = yes
						has_targeting_faction = yes
					}
				}
				desc = ireland_laudabiliter_conquest_cb_defeat_desc_attacker
			}
			desc = ireland_laudabiliter_conquest_cb_defeat_desc
		}
	}

	on_defeat = {
		on_defeat_aggressive_war_effect = yes

		scope:defender = {
			#EP2 accolade glory gain for winning against higher ranked enemy
			accolade_defender_war_end_glory_gain_low_effect = yes
			# Prestige for Defender
			add_prestige_war_defender_effect = {
				PRESTIGE_VALUE = medium_prestige_value
			}
		}

		# Prestige loss for the attacker
		scope:attacker = {
			pay_short_term_gold_reparations_effect = {
				GOLD_VALUE = 2
			}
			add_prestige = {
				value = medium_prestige_value
				multiply = -1.0
			}
		}

		# Allies on both sides get full prestige value for helping in the war, based on their war participation.
		modify_allies_of_participants_fame_values = {
			WINNER = scope:defender
			FAME_BASE = minor_prestige_value
			IS_RELIGIOUS_WAR = no
			WINNER_ALLY_FAME_SCALE = 1
			LOSER_ALLY_FAME_SCALE = 1
		}
	}

	on_invalidated_desc = msg_county_conquest_war_invalidated_message

	transfer_behavior = transfer

	on_primary_attacker_death = inherit
	on_primary_defender_death = inherit

	attacker_allies_inherit = yes
	defender_allies_inherit = yes

	war_name = "LAUDABILITER_CONQUEST_WAR_NAME"
	war_name_base = "LAUDABILITER_CONQUEST_WAR_NAME_BASE"
	cb_name = "LAUDABILITER_CONQUEST_CB_NAME"

	interface_priority = 80

	use_de_jure_wargoal_only = yes

	attacker_wargoal_percentage = 0.8

	max_defender_score_from_occupation = 150
	max_attacker_score_from_occupation = 150

	max_ai_diplo_distance_to_title = 500

	ai_score_mult = {
		value = 1
		multiply = pam_peace_of_god_coreligionist_war_ai_score_value
		multiply = zealous_war_on_head_of_faith_ai_score_value
		add = frankokratia_leader_protection_value #Set back to 0. Declaring war on the frankokratia leader can really ruin the whole thing
	}
}
