﻿#EK NOTE: removed mentions of cbs we disable
ai_conqueror_yearly_effect = {
	if = {
		limit = {
			ai_has_conqueror_personality = yes
			top_liege = this
		}
		save_scope_as = root_scope
		
		###### BUDGETING
		if = {
			limit = {
				is_at_war = no
				years_from_game_start >= 5
				NOT = {
					has_character_flag = conqueror_anti_pacing_flag
				}
				primary_title = { title_held_years >= 3 } # Do not go into buildup mode if there's a brother you need to destroy immediately!
				OR = {
					any_neighboring_and_across_water_top_liege_realm_owner = {
						count = all
						current_military_strength >= scope:root_scope.max_military_strength
						NOR = {
							is_allied_to = scope:root_scope
							has_relation_friend = scope:root_scope
							has_relation_lover = scope:root_scope
						}
					}
					any_neighboring_and_across_water_top_liege_realm_owner = {
						count >= 2
						current_military_strength >= scope:root_scope.max_military_strength
						NOR = {
							is_allied_to = scope:root_scope
							has_relation_friend = scope:root_scope
							has_relation_lover = scope:root_scope
						}
					}
					any_vassal = {
						joined_faction ?= {
							faction_power >= faction_power_halfway_threshold
						}
					}
					AND = {
						NOT = { ai_should_get_conqueror_bonuses = yes } # They have a 75% discount
						monthly_character_income_minus_expenses > half_monthly_character_income # Try to spend at least 50% of income on MaA!
					}
				}
			}
			add_character_flag = { # Conquerors should sometimes spend on MaA, if there are strong neighbours
				flag = conqueror_pacing_flag
				years = 3
			}
			add_character_flag = {
				flag = conqueror_anti_pacing_flag
				years = 10
			}
		}
		if = {
			limit = {
				has_character_flag = conqueror_pacing_flag
			}
			move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_short_term }
			move_budget_gold = { gold = war_chest_gold from = budget_war_chest to = budget_short_term }
		}
		else = { # Conquerors are special; they don't care about states or eras - they just want to conquer, and put their resources towards just that.
			move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_war_chest }
			move_budget_gold = { gold = short_term_gold from = budget_short_term to = budget_war_chest }
			# Conquerors have no concern for the future; only here and now matters
			move_budget_gold = { gold = long_term_gold from = budget_long_term to = budget_short_term }
		}
		
		###### IMPORTANT DECISIONS
		if = {
			limit = {
				can_execute_decision = mpo_become_greatest_of_khans_decision
			}
			execute_decision = mpo_become_greatest_of_khans_decision
		}
		if = {
			limit = {
				can_execute_decision = nomad_higher_tier_title_decision
			}
			execute_decision = nomad_higher_tier_title_decision
		}
		
		###### LIFESTYLES
		if = { # Conquerors change lifestyle focus to suit their needs
			limit = {
				NOT = { has_character_flag = ai_focus_cd } # No cheating!
			}
			if = {
				limit = {
					is_at_war = no
					war_chest_gold < war_chest_gold_maximum
					NOT = { has_focus = stewardship_wealth_focus }
				}
				set_focus = stewardship_wealth_focus
				add_character_flag = {
					flag = ai_focus_cd
					years = 5
				}
			}
			else_if = { # Prestige is important for CB's
				limit = {
					is_at_war = no
					OR = {
						AND = {
							prestige_level < 4
							can_use_conquest_cbs_trigger = yes
						}
						prestige < 1000
					}
					NOT = { has_focus = diplomacy_majesty_focus }
					NOT = { has_trait = august }
				}
				set_focus = diplomacy_majesty_focus
				add_character_flag = {
					flag = ai_focus_cd
					years = 5
				}
			}
			else_if = { # Certain conquerors will level up the skulduggery tree so they can murder important enemies to weaken them
				limit = {
					is_at_war = no
					intrigue >= martial
					intrigue >= 12
					NOT = { has_focus = intrigue_skulduggery_focus }
					NOT = { has_trait = schemer }
				}
				set_focus = intrigue_skulduggery_focus
				add_character_flag = {
					flag = ai_focus_cd
					years = 5
				}
			}
			else_if = {
				limit = {
					is_commanding_army = yes
					NOT = { has_focus = martial_chivalry_focus }
				}
				set_focus = martial_chivalry_focus
				add_character_flag = {
					flag = ai_focus_cd
					years = 5
				}
			}
			else_if = {
				limit = {
					NOT = { has_focus = martial_authority_focus }
					any_held_title = {
						tier = tier_county
						county_control < 100
					}
				}
				set_focus = martial_authority_focus
				add_character_flag = {
					flag = ai_focus_cd
					years = 5
				}
			}
			else_if = {
				limit = {
					NOT = { has_focus = martial_strategy_focus }
				}
				set_focus = martial_strategy_focus
				add_character_flag = {
					flag = ai_focus_cd
					years = 5
				}
			}
		}
		
		##### SCHEMES
		if = { # End murder schemes that are useless
			limit = {
				any_scheme = {
					scheme_type = murder
					is_scheme_exposed = yes
				}
			}
			every_scheme = {
				limit = {
					scheme_type = murder
					is_scheme_exposed = yes
				}
				end_scheme = yes
			}
		}
		if = { # Murders
			limit = {
				NOT = { # Really honorable characters do not stoop this low, ever
					ai_honor >= high_positive_ai_value
				}
				OR = {
					NOT = {
						any_scheme = {
							OR = {
								scheme_type = murder
								scheme_type = abduct
								scheme_type = claim_throne
								scheme_type = fabricate_hook
							}
						}
					}
					AND = {
						has_perk = twice_schemed_perk
						any_scheme = {
							count < 2
							OR = {
								scheme_type = murder
								scheme_type = abduct
								scheme_type = claim_throne
								scheme_type = fabricate_hook
							}
						}
					}
				}
			}
			every_neighboring_and_across_water_top_liege_realm_owner = { # Weaken strong neighbours
				limit = {
					save_temporary_scope_as = target_scope
					current_military_strength >= scope:target_scope.current_military_strength
					scope:root_scope = { has_any_cb_on = scope:target_scope }
					NOR = {
						is_allied_to = scope:root_scope
						has_relation_friend = scope:root_scope
						has_relation_lover = scope:root_scope
					}
					OR = {
						AND = { # Children are usually weaker rulers
							is_adult = yes
							primary_heir ?= {
								is_adult = no
							}
						}
						AND = { # Split the realm
							has_partition_succession_realm_law_trigger = yes
							any_heir = {
								count >= 2
							}
						}
					}
					scope:root_scope = {
						can_start_scheme = {
							type = murder
							target_character = scope:target_scope
						}
					}
				}
				add_to_list = targets
			}
			every_targeting_faction = {
				limit = {
					faction_is_type = claimant_faction
					exists = special_character
					save_temporary_scope_as = faction_in_question
					scope:root_scope = {
						can_start_scheme = {
							type = murder
							target_character = scope:faction_in_question.special_character 
						}
					}
				}
				special_character = {
					add_to_list = targets
				}
			}
			every_relation = {
				type = rival
				add_to_list = targets
			}
			random_in_list = {
				list = targets
				save_scope_as = murder_target
			}
			if = {
				limit = {
					exists = scope:murder_target
				}
				start_scheme = {
					type = murder
					target_character = scope:murder_target
				}
			}
		}
		if = { # End hook schemes that are useless
			limit = {
				any_scheme = {
					scheme_type = fabricate_hook
					is_scheme_exposed = yes
				}
			}
			every_scheme = {
				limit = {
					scheme_type = fabricate_hook
					is_scheme_exposed = yes
				}
				end_scheme = yes
			}
		}
		if = { # Fabricate Hook
			limit = {
				has_perk = truth_is_relative_perk
				OR = {
					NOT = {
						any_scheme = {
							OR = {
								scheme_type = murder
								scheme_type = abduct
								scheme_type = claim_throne
								scheme_type = fabricate_hook
							}
						}
					}
					AND = {
						has_perk = twice_schemed_perk
						any_scheme = {
							count < 2
							OR = {
								scheme_type = murder
								scheme_type = abduct
								scheme_type = claim_throne
								scheme_type = fabricate_hook
							}
						}
					}
				}
			}
			every_courtier = {
				limit = {
					is_theocratic_lessee = yes
					scope:root_scope = {
						can_start_scheme = {
							type = fabricate_hook
							target_character = prev
						}
					}
				}
				add_to_list = hook_targets
			}
			every_vassal = {
				limit = {
					highest_held_title_tier >= tier_county
					government_has_flag = government_is_feudal
					vassal_contract_can_be_modified_trigger = yes
					scope:root_scope = {
						can_start_scheme = {
							type = fabricate_hook
							target_character = prev
						}
					}
				}
				add_to_list = hook_targets
			}
			if = {
				limit = {
					has_perk = golden_obligations_perk
				}
				every_vassal = {
					limit = {
						gold >= 200
						scope:root_scope = {
							can_start_scheme = {
								type = fabricate_hook
								target_character = prev
							}
						}
					}
					add_to_list = hook_targets
				}
				every_neighboring_and_across_water_top_liege_realm_owner = {
					limit = {
						gold >= 100
						scope:root_scope = {
							can_start_scheme = {
								type = fabricate_hook
								target_character = prev
							}
						}
					}
					add_to_list = hook_targets
				}
			}
			random_in_list = {
				list = hook_targets
				weight = {
					base = 1
					modifier = {
						add = primary_title.tier
					}
				}
				save_scope_as = hook_target
			}
			if = {
				limit = {
					exists = scope:hook_target
				}
				start_scheme = {
					type = fabricate_hook
					target_character = scope:hook_target
				}
			}
		}
		
		if = { # Sway
			limit = {
				OR = {
					NOT = {
						any_scheme = {
							OR = {
								scheme_type = befriend
								scheme_type = sway
								scheme_type = seduce
								scheme_type = courting
								scheme_type = elope
								scheme_type = learn_language
							}
						}
					}
					AND = {
						OR = {
							dynasty ?= { has_dynasty_perk = glory_legacy_5 }
							AND = {
								has_royal_court = yes
								has_dlc_feature = royal_court
								has_court_type = court_diplomatic
								court_grandeur_current_level >= 10
							}
						}
						any_scheme = {
							count < 2
							OR = {
								scheme_type = befriend
								scheme_type = sway
								scheme_type = seduce
								scheme_type = courting
								scheme_type = elope
								scheme_type = learn_language
							}
						}
					}
					AND = {
						dynasty ?= { has_dynasty_perk = glory_legacy_5 }
						has_royal_court = yes
						has_dlc_feature = royal_court
						has_court_type = court_diplomatic
						court_grandeur_current_level >= 10
						any_scheme = {
							count < 3
							OR = {
								scheme_type = befriend
								scheme_type = sway
								scheme_type = seduce
								scheme_type = courting
								scheme_type = elope
								scheme_type = learn_language
							}
						}
					}
				}
			}
			every_courtier = {
				limit = {
					OR = {
						is_theocratic_lessee = yes
						has_council_position = councillor_spymaster
					}
					opinion = {
						target = scope:root_scope
						value < 100
					}
					scope:root_scope = {
						can_start_scheme = {
							type = sway
							target_character = prev
						}
					}
				}
				add_to_list = sway_targets
			}
			every_vassal = {
				limit = {
					highest_held_title_tier >= tier_county
					opinion = {
						target = scope:root_scope
						value < 100
					}
					scope:root_scope = {
						can_start_scheme = {
							type = sway
							target_character = prev
						}
					}
				}
				add_to_list = sway_targets
			}
			random_in_list = {
				list = sway_targets
				weight = {
					base = 1
					modifier = {
						add = 1000
						is_theocratic_lessee = yes
					}
					modifier = {
						add = 1000
						opinion = {
							target = scope:root_scope
							value <= 0
						}
					}
				}
				save_scope_as = sway_target
			}
			if = {
				limit = {
					exists = scope:sway_target
				}
				start_scheme = {
					type = sway
					target_character = scope:sway_target
				}
			}
		}
		
		###### WAR!
		if = {
			limit = {
				is_at_war = no
				war_chest_gold >= war_chest_gold_maximum
				NOR = {
					has_character_flag = conqueror_pacing_flag
					any_owned_story = { story_type = story_greatest_of_khans }
				}
			}
			# Lots of nested ai_start_best_war here, priority as follows: Start high-impact CB war, start 3 wars against rulers with 30% or less strength, start 2 wars against rulers with less than 40%, or just start any good war
			if = { # Kingdom+ Claims first
				limit = {
					any_claim = {
						pressed = yes
						tier >= tier_kingdom
					}
				}
				ai_start_best_war = {
					cb = {
						claim_cb
					}
					is_valid = {
						scope:target_title.tier >= tier_kingdom
						scope:target_character = {
							current_military_strength < root.current_military_strength
							OR = {
								gold < root.gold
								current_military_strength <= root.fifty_percent_of_current_military_strength
							}
						}
					}
					on_failure = {
						# Start one very high-impact war with a very good CB
						ai_start_best_war = {
							cb = {
								major_religious_war
								#invasion_war
								#clan_invasion_war
								directed_great_holy_war
								tribal_subjugation_cb
								de_jure_cb
								de_jure_cb_nomadic
								kingdom_conquest_cb #ek added
								empire_conquest_cb #ek added
							}
							is_valid = {
							}
							on_failure = {
								# Either go for one decent war, or three 'small' wars immediately
								random_list = {
									50 = {
										ai_start_best_war = {
											cb = {
												claim_cb
												duchy_conquest_cb
												religious_war
												vassalization_cb
												individual_duchy_de_jure_cb
												sovereignty_cb
												nomadic_conquest_duchy_cb
											}
											is_valid = {
												trigger_if = {
													limit = {
														scope:casus_belli_type = casus_belli_type:claim_cb
													}
													scope:target_title.tier > tier_county
												}
												scope:target_character = {
													current_military_strength < root.current_military_strength
													OR = {
														gold < root.gold
														current_military_strength <= root.fifty_percent_of_current_military_strength
													}
												}
											}
											on_failure = {
												ai_start_best_war = {
													cb = {
														claim_cb
														county_conquest_cb
														individual_county_de_jure_cb
														minor_religious_war
														county_struggle_cb
														ducal_conquest_cb
														nomadic_conquest_cb
													}
													is_valid = {
														scope:target_character = {
															current_military_strength <= root.a_third_of_current_military_strength
															gold < root.gold
														}
													}
													on_failure = {
														ai_start_best_war = {
															cb = {
																claim_cb
																county_conquest_cb
																individual_county_de_jure_cb
																minor_religious_war
																county_struggle_cb
																ducal_conquest_cb
																nomadic_conquest_cb
															}
															is_valid = {
																scope:target_character = {
																	current_military_strength < root.forty_percent_of_current_military_strength
																	gold < root.gold
																}
															}
															on_failure = {
																ai_start_best_war = {
																	cb = {
																		claim_cb
																		county_conquest_cb
																		individual_county_de_jure_cb
																		minor_religious_war
																		county_struggle_cb
																		ducal_conquest_cb
																		nomadic_conquest_cb
																	}
																}
															}
														}
														ai_start_best_war = {
															cb = {
																claim_cb
																county_conquest_cb
																individual_county_de_jure_cb
																minor_religious_war
																county_struggle_cb
																ducal_conquest_cb
																nomadic_conquest_cb
															}
															is_valid = {
																scope:target_character = {
																	current_military_strength < root.forty_percent_of_current_military_strength
																	gold < root.gold
																}
															}
														}
													}
												}
												ai_start_best_war = {
													cb = {
														claim_cb
														county_conquest_cb
														individual_county_de_jure_cb
														minor_religious_war
														county_struggle_cb
														ducal_conquest_cb
														nomadic_conquest_cb
													}
													is_valid = {
														scope:target_character = {
															current_military_strength <= root.a_third_of_current_military_strength
															gold < root.gold
														}
													}
												}
												ai_start_best_war = {
													cb = {
														claim_cb
														county_conquest_cb
														individual_county_de_jure_cb
														minor_religious_war
														county_struggle_cb
														ducal_conquest_cb
														nomadic_conquest_cb
													}
													is_valid = {
														scope:target_character = {
															current_military_strength <= root.a_third_of_current_military_strength
															gold < root.gold
														}
													}
												}
											}
										}
									}
									50 = {
										ai_start_best_war = {
											cb = {
												claim_cb
												duchy_conquest_cb
												religious_war
												vassalization_cb
												individual_duchy_de_jure_cb
												tribal_subjugation_cb
												de_jure_cb
												de_jure_cb_nomadic
												nomadic_conquest_duchy_cb
											}
											is_valid = {
												scope:target_character = {
													current_military_strength <= root.a_third_of_current_military_strength
													gold < root.gold
												}
											}
											on_failure = {
												ai_start_best_war = {
													cb = {
														claim_cb
														county_conquest_cb
														vassalization_cb
														individual_county_de_jure_cb
														minor_religious_war
														county_struggle_cb
														ducal_conquest_cb
														nomadic_conquest_duchy_cb
													}
													is_valid = {
														scope:target_character = {
															current_military_strength <= root.a_third_of_current_military_strength
															gold < root.gold
														}
													}
													on_failure = {
														ai_start_best_war = {
															cb = {
																claim_cb
																county_conquest_cb
																individual_county_de_jure_cb
																minor_religious_war
																county_struggle_cb
																ducal_conquest_cb
																nomadic_conquest_cb
															}
															is_valid = {
																scope:target_character = {
																	current_military_strength < root.forty_percent_of_current_military_strength
																	gold < root.gold
																}
															}
															on_failure = {
																ai_start_best_war = {
																	cb = {
																		claim_cb
																		county_conquest_cb
																		individual_county_de_jure_cb
																		minor_religious_war
																		county_struggle_cb
																		ducal_conquest_cb
																		nomadic_conquest_cb
																	}
																}
															}
														}
														ai_start_best_war = {
															cb = {
																claim_cb
																county_conquest_cb
																individual_county_de_jure_cb
																minor_religious_war
																county_struggle_cb
																ducal_conquest_cb
																nomadic_conquest_cb
															}
															is_valid = {
																scope:target_character = {
																	current_military_strength < root.forty_percent_of_current_military_strength
																	gold < root.gold
																}
															}
														}
													}
												}
												ai_start_best_war = {
													cb = {
														claim_cb
														county_conquest_cb
														individual_county_de_jure_cb
														minor_religious_war
														county_struggle_cb
														ducal_conquest_cb
														nomadic_conquest_cb
													}
													is_valid = {
														scope:target_character = {
															current_military_strength <= root.a_third_of_current_military_strength
															gold < root.gold
														}
													}
												}
												ai_start_best_war = {
													cb = {
														claim_cb
														county_conquest_cb
														individual_county_de_jure_cb
														minor_religious_war
														county_struggle_cb
														ducal_conquest_cb
														nomadic_conquest_cb
													}
													is_valid = {
														scope:target_character = {
															current_military_strength <= root.a_third_of_current_military_strength
															gold < root.gold
														}
													}
												}
											}
										}
										ai_start_best_war = {
											cb = {
												claim_cb
												duchy_conquest_cb
												religious_war
												vassalization_cb
												individual_duchy_de_jure_cb
												de_jure_cb
												de_jure_cb_nomadic
												nomadic_conquest_duchy_cb
											}
											is_valid = {
												scope:target_character = {
													current_military_strength <= root.a_third_of_current_military_strength
													gold < root.gold
												}
											}
										}
										ai_start_best_war = {
											cb = {
												claim_cb
												duchy_conquest_cb
												religious_war
												vassalization_cb
												individual_duchy_de_jure_cb
												de_jure_cb
												de_jure_cb_nomadic
												nomadic_conquest_duchy_cb
											}
											is_valid = {
												scope:target_character = {
													current_military_strength <= root.a_third_of_current_military_strength
													gold < root.gold
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
			else = { # Then everything else
				# Start one very high-impact war with a very good CB
				ai_start_best_war = {
					cb = {
						major_religious_war
						#invasion_war
						#clan_invasion_war
						directed_great_holy_war
						tribal_subjugation_cb
						de_jure_cb
						de_jure_cb_nomadic
						kingdom_conquest_cb #ek added
						empire_conquest_cb #ek added
					}
					is_valid = {
					}
					on_failure = {
						# Either go for one decent war, or three 'small' wars immediately
						random_list = {
							50 = {
								ai_start_best_war = {
									cb = {
										claim_cb
										duchy_conquest_cb
										religious_war
										vassalization_cb
										individual_duchy_de_jure_cb
										sovereignty_cb
										nomadic_conquest_duchy_cb
									}
									is_valid = {
										trigger_if = {
											limit = {
												scope:casus_belli_type = casus_belli_type:claim_cb
											}
											scope:target_title.tier > tier_county
										}
										scope:target_character = {
											current_military_strength < root.current_military_strength
											OR = {
												gold < root.gold
												current_military_strength <= root.fifty_percent_of_current_military_strength
											}
										}
									}
									on_failure = {
										ai_start_best_war = {
											cb = {
												claim_cb
												county_conquest_cb
												individual_county_de_jure_cb
												minor_religious_war
												county_struggle_cb
												ducal_conquest_cb
												nomadic_conquest_cb
											}
											is_valid = {
												scope:target_character = {
													current_military_strength <= root.a_third_of_current_military_strength
													gold < root.gold
												}
											}
											on_failure = {
												ai_start_best_war = {
													cb = {
														claim_cb
														county_conquest_cb
														individual_county_de_jure_cb
														minor_religious_war
														county_struggle_cb
														ducal_conquest_cb
														nomadic_conquest_cb
													}
													is_valid = {
														scope:target_character = {
															current_military_strength < root.forty_percent_of_current_military_strength
															gold < root.gold
														}
													}
													on_failure = {
														ai_start_best_war = {
															cb = {
																claim_cb
																county_conquest_cb
																individual_county_de_jure_cb
																minor_religious_war
																county_struggle_cb
																ducal_conquest_cb
																nomadic_conquest_cb
															}
														}
													}
												}
												ai_start_best_war = {
													cb = {
														claim_cb
														county_conquest_cb
														individual_county_de_jure_cb
														minor_religious_war
														county_struggle_cb
														ducal_conquest_cb
														nomadic_conquest_cb
													}
													is_valid = {
														scope:target_character = {
															current_military_strength < root.forty_percent_of_current_military_strength
															gold < root.gold
														}
													}
												}
											}
										}
										ai_start_best_war = {
											cb = {
												claim_cb
												county_conquest_cb
												individual_county_de_jure_cb
												minor_religious_war
												county_struggle_cb
												ducal_conquest_cb
												nomadic_conquest_cb
											}
											is_valid = {
												scope:target_character = {
													current_military_strength <= root.a_third_of_current_military_strength
													gold < root.gold
												}
											}
										}
										ai_start_best_war = {
											cb = {
												claim_cb
												county_conquest_cb
												individual_county_de_jure_cb
												minor_religious_war
												county_struggle_cb
												ducal_conquest_cb
												nomadic_conquest_cb
											}
											is_valid = {
												scope:target_character = {
													current_military_strength <= root.a_third_of_current_military_strength
													gold < root.gold
												}
											}
										}
									}
								}
							}
							50 = {
								ai_start_best_war = {
									cb = {
										claim_cb
										duchy_conquest_cb
										religious_war
										vassalization_cb
										individual_duchy_de_jure_cb
										tribal_subjugation_cb
										de_jure_cb
										de_jure_cb_nomadic
										nomadic_conquest_duchy_cb
									}
									is_valid = {
										scope:target_character = {
											current_military_strength <= root.a_third_of_current_military_strength
											gold < root.gold
										}
									}
									on_failure = {
										ai_start_best_war = {
											cb = {
												claim_cb
												county_conquest_cb
												vassalization_cb
												individual_county_de_jure_cb
												minor_religious_war
												county_struggle_cb
												ducal_conquest_cb
												nomadic_conquest_duchy_cb
											}
											is_valid = {
												scope:target_character = {
													current_military_strength <= root.a_third_of_current_military_strength
													gold < root.gold
												}
											}
											on_failure = {
												ai_start_best_war = {
													cb = {
														claim_cb
														county_conquest_cb
														individual_county_de_jure_cb
														minor_religious_war
														county_struggle_cb
														ducal_conquest_cb
														nomadic_conquest_cb
													}
													is_valid = {
														scope:target_character = {
															current_military_strength < root.forty_percent_of_current_military_strength
															gold < root.gold
														}
													}
													on_failure = {
														ai_start_best_war = {
															cb = {
																claim_cb
																county_conquest_cb
																individual_county_de_jure_cb
																minor_religious_war
																county_struggle_cb
																ducal_conquest_cb
																nomadic_conquest_cb
															}
														}
													}
												}
												ai_start_best_war = {
													cb = {
														claim_cb
														county_conquest_cb
														individual_county_de_jure_cb
														minor_religious_war
														county_struggle_cb
														ducal_conquest_cb
														nomadic_conquest_cb
													}
													is_valid = {
														scope:target_character = {
															current_military_strength < root.forty_percent_of_current_military_strength
															gold < root.gold
														}
													}
												}
											}
										}
										ai_start_best_war = {
											cb = {
												claim_cb
												county_conquest_cb
												individual_county_de_jure_cb
												minor_religious_war
												county_struggle_cb
												ducal_conquest_cb
												nomadic_conquest_cb
											}
											is_valid = {
												scope:target_character = {
													current_military_strength <= root.a_third_of_current_military_strength
													gold < root.gold
												}
											}
										}
										ai_start_best_war = {
											cb = {
												claim_cb
												county_conquest_cb
												individual_county_de_jure_cb
												minor_religious_war
												county_struggle_cb
												ducal_conquest_cb
												nomadic_conquest_cb
											}
											is_valid = {
												scope:target_character = {
													current_military_strength <= root.a_third_of_current_military_strength
													gold < root.gold
												}
											}
										}
									}
								}
								ai_start_best_war = {
									cb = {
										claim_cb
										duchy_conquest_cb
										religious_war
										vassalization_cb
										individual_duchy_de_jure_cb
										de_jure_cb
										de_jure_cb_nomadic
										nomadic_conquest_duchy_cb
									}
									is_valid = {
										scope:target_character = {
											current_military_strength <= root.a_third_of_current_military_strength
											gold < root.gold
										}
									}
								}
								ai_start_best_war = {
									cb = {
										claim_cb
										duchy_conquest_cb
										religious_war
										vassalization_cb
										individual_duchy_de_jure_cb
										de_jure_cb
										de_jure_cb_nomadic
										nomadic_conquest_duchy_cb
									}
									is_valid = {
										scope:target_character = {
											current_military_strength <= root.a_third_of_current_military_strength
											gold < root.gold
										}
									}
								}
							}
						}
					}
				}
			}
		}
		
		
		###### Get claimants to join your court!
		if = {
			limit = {
				is_ai = yes
				highest_held_title_tier >= tier_duchy
				is_at_war = no
				war_chest_gold >= war_chest_gold_maximum
				NOT = {
					has_character_flag = conqueror_pacing_flag
				}
				ai_should_get_conqueror_bonuses = yes
			}
			random_character_to_title_neighboring_duchy = {
				limit = {
					holder ?= {
						top_liege.current_military_strength < scope:root_scope.current_military_strength
					}
					any_claimant = {
						is_ruler = no
						is_physically_able_adult = yes
						NOT = {
							is_weak_claimant_due_to_gender_trigger = { FAITH = this.faith CHARACTER = this }
						}
						OR = {
							is_pool_character = yes
							liege ?= {
								NOR = {
									is_ai = no
									is_parent_of = prev
									is_grandparent_of = prev
									is_great_grandparent_of = prev
									this = scope:root_scope
								}
							}
						}
					}
				}
				random_claimant = {
					limit = {
						is_ruler = no
						is_physically_able_adult = yes
						NOT = {
							is_weak_claimant_due_to_gender_trigger = { FAITH = this.faith CHARACTER = this }
						}
						OR = {
							is_pool_character = yes
							liege ?= {
								NOR = {
									is_ai = no
									is_parent_of = prev
									is_grandparent_of = prev
									is_great_grandparent_of = prev
									this = scope:root_scope
								}
							}
						}
					}
					scope:root_scope = {
						add_courtier = prev
					}
				}
			}
		}
	}
}
