﻿

## AI decision to start (or join) the war for the dawn.
war_for_the_dawn_decision = {
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_realm.dds"
	}

	# Never shown, so it doesn't matter what we write here
	title = war_for_the_dawn_decision_title
	desc = war_for_the_dawn_decision_desc
	confirm_text = war_for_the_dawn_decision_confirm
	selection_tooltip = war_for_the_dawn_decision_tt

	decision_group_type = major

	ai_check_interval = 36

	is_shown = {
		exists = title:e_others.holder
		NOT = { title:e.others.holder = { has_character_flag = war_for_dawn_cooldown } }
		OR = { 
				is_ai = no 
				highest_held_title_tier >= tier_duchy
				title:e_others.holder = { is_at_war = yes }
				}
		NOT = { highest_held_title_tier < tier_county }
		max_military_strength >= 1000
				
		
	}

	# Must be a landed ruler, not a nightswatch, nightswatch must exist, and one of NW de jure lands must be held by a non-vassal wildling
	is_valid = {
		is_landed = yes
		exists = title:e_others.holder
		#highest_held_title_tier >= tier_county
		NOT = { has_faith = faith:cold_gods }
		NOT = { title:e.others.holder = { has_character_flag = war_for_dawn_cooldown } }

	}

	is_valid_showing_failures_only = {
		is_at_war = no
	}

	effect = {
		title:e_others.holder = { 
				 if = { limit = { any_character_war = {
								is_attacker = title:e_others.holder
								using_cb = other_cb	}
										   }
								random_character_war = {
								limit = {
								is_attacker = title:e_others.holder
								using_cb = other_cb
							}

							add_defender = root
						}
							}
				
		
					else_if = { limit = { any_character_war = {
								is_defender = title:e_others.holder
								using_cb = war_for_the_dawn_cb	}
										   }
								random_character_war = {
								limit = {
								is_defender = title:e_others.holder
								using_cb = war_for_the_dawn_cb
							}

							add_attacker = root
						}
							}
							else = {
						root = {
							start_war = {
								cb = war_for_the_dawn_cb
								target = prev
								claimant = this
							}
						}
					}
									
	}
	}

	ai_will_do = {
		base = -45

		ai_value_modifier = {
			who = root
			ai_boldness = tiny_chance_impact_positive_ai_value
			ai_compassion = tiny_chance_impact_positive_ai_value
			ai_sociability = 1.0
			ai_greed = tiny_chance_impact_negative_ai_value
			ai_energy = tiny_chance_impact_positive_ai_value
			ai_honor = tiny_chance_impact_positive_ai_value
			ai_rationality = tiny_chance_impact_positive_ai_value
			ai_vengefulness = 1.0
			ai_zeal = tiny_chance_impact_positive_ai_value
			max = 35.50
		}
		modifier = {
			add = 30
			is_landed = yes
			any_sub_realm_county = { is_neighbor_to_realm = title:e_others.holder }
		}
		modifier = {
			add = 30
			is_landed = yes
			root.capital_barony.title_province = { geographical_region = world_westeros_the_north }
		}
		modifier = {
			add = 5
			has_faith = faith:old_gods
			
		}
		modifier = {
			add = 5
			has_faith = faith:weirwood_of_the_seven
			
		}
		modifier = {
			add = -150
			is_landed = yes
		NOT = {	root.capital_barony.title_province = { geographical_region = world_westeros_seven_kingdoms } }
		}
		
		modifier = {
			add = 50
			faith = faith:rhllor
		}
		modifier = {
			add = 50
			faith = faith:red_god
		
		}
		
		
		modifier = {
			add = 100
			dynasty = dynasty:dynn_Stark
		}
		modifier = {
			add = 100
			dynasty = dynasty:dynn_Dayne
		}
			modifier = {
			add = 50
			dynasty = dynasty:dynn_Hightower
		}
		modifier = {
			add = 50
			dynasty = dynasty:dynn_Targaryen
		}
		modifier = {
			add = 25
			dynasty = dynasty:dynn_Umber
		}
		modifier = {
			add = -100
			has_culture = culture:ironborn
		}
		modifier = {
			add = -25
			faith = faith:trios
		}
		
		modifier = {
			add = -100
			has_government = pirate_government
		}
		modifier = {
			add = -75
			has_government = free_city_government
		}
		modifier = {
			add = 1000
			has_title = title:k_the_wall
			has_government = nights_watch_government
		}
		modifier = {
			add = 50
			is_vassal_or_below_of = title:e_others.holder
		}
		modifier = {
			add = 5
			any_liege_or_above = { is_at_war_with = title:e_others.holder }
		}
		modifier = {
			add = 30
			has_title = title:k_the_wall
		}
		modifier = {
			add = -50
			highest_held_title_tier < tier_county
		}
		modifier = {
			add = 10
			highest_held_title_tier >= tier_kingdom
		}
		
			
		modifier = {
			add = 5
			title:e_others.holder = { any_sub_realm_county = { geographical_region = world_westeros_the_north } }
		}
		modifier = {
			add = 5
			title:e_others.holder = { any_sub_realm_county = { geographical_region = world_westeros_the_riverlands } }
		}
		modifier = {
			add = 5
			title:e_others.holder = { any_sub_realm_county = { geographical_region = world_westeros_the_vale } }
		}
		modifier = {
			add = 5
			title:e_others.holder = { any_sub_realm_county = { geographical_region = world_westeros_the_westerlands } }
		}
		modifier = {
			add = 5
			title:e_others.holder = { any_sub_realm_county = { geographical_region = world_westeros_the_crownlands } }
		}
		modifier = {
			add = 5
			title:e_others.holder = { any_sub_realm_county = { geographical_region = world_westeros_dorne } }
		}
		modifier = {
			add = 5
			title:e_others.holder = { any_sub_realm_county = { geographical_region = world_westeros_the_reach } }
		}
		



		modifier = {
			factor = 0
			root = {
				debt_level > 0
			}
		}

		
	}
}




others_trigger_invasion = {
	decision_group_type = major
	picture = {
		reference = "gfx/interface/illustrations/decisions/decision_realm.dds"
	}

	# Never shown, so it doesn't matter what we write here
	title = others_trigger_title
	desc = others_trigger_desc
	confirm_text = others_trigger_confirm
	selection_tooltip = others_trigger_tooltip

	
	ai_check_interval = 0
	
	is_shown = {
		NOT = {
			has_global_variable = others_invasion_has_arrived
		}
		OR = {
			debug_only = yes
			has_game_rule = others_manual_invasion
		}
	}
	
	effect = {
		trigger_event = others.1
	}
}