# dismantle
dismantlemayor = {
	name = CB_NAME_DISMANTLEMAYOR
	war_name = WAR_NAME_DISMANTLEMAYOR
	sprite = 6
	truce_days = 3650
	#is_independence = yes
	hostile_against_others = no
	is_permanent = yes
	can_ask_to_join_war = yes
	full_hostility = no
	reflect_titleholder_change = no
	is_claim_all = yes
	press_claim = no
	allow_whitepeace = yes
	allowed_to_target_tributaries = no
	can_call_allies = yes
	can_call_vassals = yes
	can_attack_vassals = no
	attacker_alliance_occ_warscore = yes
	is_holy_war = no
	prestige_cost = 1000
	attacker_rel_head_is_ally = no
	infamy_modifier = 1
	is_tyranny_cb = no
	max_attacker_battle_score = 99
	capturing_attacker_is_complete_victory = no
	sort_priority = 1001

	can_use_title = {
		ROOT ={
		is_incapable = no
		lower_tier_than = FROM
		is_primary_war_defender = no
		rebel = no
		NOT = {
		num_of_count_titles_in_realm = 25
		}
		NOT ={
		dynasty = FROM
		}
		}
		#Title must be feudal empire
		FROM = {
		primary_title = {tier = emperor}
		is_feudal = yes
		independent = yes
		NOT = {is_friend = ROOT}
		num_of_count_titles_in_realm = 50
		}
		OR ={
		 ROOT = {any_owned_bloodline = { has_bloodline_flag = destroyer_of_empires }}
		 AND ={
		  ROOT ={
			trait = ambitious
		  }
		  FROM ={
		  OR ={
		    is_adult = no
		    is_foe = ROOT
			in_revolt = yes
			primary_title = {is_titular = yes}
			trait = decadent
		  }
		  }
		 }
		 AND ={
		  ROOT ={
		  trait = zealous
		  }
		  FROM ={
		  		OR ={
				is_heresy_of = ROOT
				trait = excommunicated
				trait = decadent
				trait = bad_priest_muslim
			}
		  }
		 }
		}
	}

	is_valid_title = {
		FROM = {
			has_landed_title = PREV
		}
	}

	on_add = {
	ROOT = { prestige = -1000 }
	}

	on_success_title = {
		hidden_tooltip = {
			ROOT = {
				if = {
					limit = {
						has_nickname = no
					}
					random = {
						chance = 50
						give_nickname = nick_the_iron_heart
					}
				}
				if = {
				limit = {
				NOT = {any_owned_bloodline = { has_bloodline_flag = destroyer_of_empires }}
				}
				random = {
				chance = 25
				if = {
				limit = { is_female = no}
				create_bloodline = {
				type = destroyer_of_empires_male
				}
				}
				if = {
				limit = { is_female = yes}
				create_bloodline = {
				type = destroyer_of_empires_female
				}
				}
				}
				}
			}
		}
		
		ROOT = {
			show_scope_change = no
			participation_scaled_prestige = 500
		}
		
		any_attacker = {
			limit = { NOT = { character = ROOT } }
			hidden_tooltip = { participation_scaled_prestige = 100 }
		}
		
		FROM = {
			show_scope_change = no
			prestige = -5000
			primary_title = {
				activate_title = { title = THIS status = no }
				destroy_landed_title = THIS
			}
		}
	}

	on_reverse_demand = {
		ROOT = {
			show_scope_change = no
			prestige = -1000
			hidden_tooltip = {
				disband_event_forces = yes
			}
			set_defacto_liege = FROM
		}
		FROM = {
			show_scope_change = no
			participation_scaled_prestige = 1000
		}
		any_defender = {
			limit = { NOT = { character = FROM } }
			hidden_tooltip = { participation_scaled_prestige = 100 }
		}
	}

	on_fail_title = {
		ROOT = {
			show_scope_change = no
			prestige = -150
			transfer_scaled_wealth = {
				to = FROM
				value = 5.0
			}
		}
		if = {
			limit = {
				ROOT = { has_character_flag = claimant_adventurer }
			}
			ROOT = { imprison = FROM }
		}
		FROM = {
			show_scope_change = no
			participation_scaled_prestige = 150
		}
		any_defender = {
			limit = { NOT = { character = FROM } }
			hidden_tooltip = { participation_scaled_prestige = 150 }
		}
	}

	on_reverse_demand_title = {
		ROOT = { 
		show_scope_change = no 
		remove_claim = PREV }
		ROOT = {
			hidden_tooltip = {
				disband_event_forces = yes
			}
		}
	}

	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
	}
}