﻿### EK NOTE: Removed references to vanilla stuff

##############
# WAR VALUES #
##############

# Truce Durations
## Since we want these to work out to nice, even numbers, we calc them manually rather than use multipliers.
standard_truce_duration_days = {
	value = 1825
	# Deductions.
	## Flexible truces perk.
	if = {
		limit = {
			scope:attacker = { has_perk = flexible_truces_perk }
		}
		add = -450
	}
	## Certain struggle phases.
	if = {
		limit = {
			scope:attacker = {
				any_character_struggle = {
					is_struggle_parameter_active_secondary_character_involvement_either_trigger = {
						PARAMETER = truces_by_involved_or_interlopers_within_region_shorter
						CHAR = scope:defender
					}
				}
			}
		}
		add = -900
	}
	if = {
		limit = {
			scope:attacker = {
				any_character_struggle = {
					is_struggle_parameter_active_secondary_character_involvement_either_trigger = {
						PARAMETER = truces_by_involved_or_interlopers_within_region_longer
						CHAR = scope:defender
					}
				}
			}
		}
		add = 900
	}
	## Shorter truce if both sides are nomads
	if = {
		limit = {
			scope:attacker = { government_has_flag = government_is_nomadic }
			scope:defender = { government_has_flag = government_is_nomadic }
		}
		subtract = 730
	}
	# A truce should at least give a 2-year breather.
	min = 730
	if = {
		limit = {
			scope:attacker = {
				any_character_war = {
					primary_attacker = scope:attacker
					primary_defender = scope:defender
					using_cb = fp2_border_raid
				}
			}
		}
		multiply = 2
	}
}

#Victory Prestige Experience Gain
mongol_invasion_cb_prestige_experience_gain = 10

#Ally contribution prestige gain
mongol_invasion_cb_ally_prestige = 100

#Prestige gain
mongol_invasion_cb_prestige_gain = 250

#White peace prestige values
mongol_invasion_cb_prestige_white_peace = -100

# Determined Independence Cultural Tradition
determined_independence_defensive_advantage_value = 15

#############
# Raid
#############

# Practiced Pirates Cultural Tradition
not_tribal_raid_prestige_multiplier = 1.5

raid_gold_value = {	#How much cash does this settlement generate in a raid?
	value = monthly_income
	multiply = 10

	#Sensible max-mins.
	min = 30
	max = 100

	#Give a whole number.
	ceiling = yes
}

tour_tax_gold_value = {
	value = monthly_income
	multiply = 4

	#Give a whole number.
	ceiling = yes
}

### EK EDIT: Removed references to vanilla culture & religions
### Used for Nord, Skaal war stuff ALSO this is where the dunmer_war_ai_score_value hooks in. low maintenance, as viking_conquest_ai_score_value already hooks int every CB
viking_conquest_ai_score_value = {
	value = 1
	scope:attacker = {
		if = {
			limit = {
				can_use_viking_invasion_cbs_trigger = yes
			}
			if = {
				limit = { NOT = { culture = scope:defender.culture } }
				add = 0.5
				if = {
					limit = {
						NOT = { culture = { has_same_culture_heritage = scope:defender.culture } }
					}
					add = 0.5
				}
			}
			if = {
				limit = { NOT = { faith = scope:defender.faith } }
				add = 0.5
				if = {
					limit = { NOT = { faith.religion = scope:defender.faith.religion } }
					add = 0.5
				}
			}
			if = {
				limit = {
					scope:defender.faith = {
						has_doctrine_parameter = unreformed
					}
				}
				multiply = 0.2
			}
			if = {
				limit = {
					scope:defender.faith = scope:attacker.faith
				}
				multiply = 0.2
			}
			if = { #EK EDIT
				limit = {
					scope:defender.culture = { has_same_culture_heritage = scope:attacker.culture }
				}
				multiply = 0.2
			}
			
			 if = { # Skaal Vikings stay home #EK EDIT change from Russian Vikings
				 limit = {
					 scope:attacker = {
						 capital_province = {
							geographical_region = mundus_tamriel_skyrim
						 }
						 NOT = {
							character_is_realm_neighbor = scope:defender
						 }
					 }
				 }
				 multiply = 0.1
			 }
			 if = { # #EK EDIT Nords like to invade former Empire of the Nords holdings
				limit = {
					scope:attacker = {
						OR = {
							#if the attacker sits in mundus_tamriel_skyrim
							capital_province = {
								geographical_region = mundus_tamriel_skyrim
							}
						}
					}
					scope:defender = {
						OR = {
							#if the defender sits in historic nordic invasion turf
							capital_province = {
								geographical_region = mundus_tamriel_high_rock_fharun
							}
							capital_province = {
								geographical_region = mundus_tamriel_hammerfell_dragontail
							}
							capital_province = {
								geographical_region = mundus_tamriel_cyrodiil_bruma
							}
							capital_province = {
								geographical_region = mundus_tamriel_morrowind_velothis
							}
						}
					}
				}
				multiply = 5
			 }
			# if = { # Norsemen should not rush the Pope...
				# limit = {
					# scope:attacker.faith.religion = faith:norse_pagan.religion
					# scope:defender = {
						# has_title = title:k_papal_state
					# }
				# }
				# multiply = 0.01
			# }
		}
	}
}

struggle_conquest_ai_score_value = {
	value = 1
	scope:attacker = {
		# Are they a different faith than me?
		if = {
			limit = {
				NOT = { faith = scope:defender.faith }
			}
			add = 1
		}
		# Are they a different culture than me?
		if = {
			limit = {
				NOT = { culture = scope:defender.culture }
			}
			add = 1
		}
		# Do I have a negative relationship with them?
		if = {
			limit = { has_relation_nemesis = scope:defender }
			add = 2
		}
		else_if = {
			limit = {
				has_any_bad_relationship_with_character_trigger = { CHARACTER = scope:defender }
			}
			add = 1
		}
		# Do I have a positive relationship with them?
		if = {
			limit = {
				OR = {
					has_relation_soulmate = scope:defender
					has_relation_best_friend = scope:defender
				}
			}
			add = -5
		}
		else_if = {
			limit = {
				has_any_good_relationship_with_character_trigger = { CHARACTER = scope:defender }
			}
			add = -1
		}
		# Multiply this up or down per the phase.
		## Some phases make people hunger for violence...
		if = {
			limit = {
				any_character_struggle = {
					is_struggle_type = iberian_struggle
					is_struggle_phase = struggle_iberia_phase_hostility
				}
				# Unless you're just not that sort of person.
				NOR = {
					has_trait = content
					has_trait = compassionate
				}
			}
			multiply = 2
		}
		## ... but in others, it seems abhorrent.
		if = {
			limit = {
				any_character_struggle = {
					is_struggle_type = iberian_struggle
					OR = {
						is_struggle_phase = struggle_iberia_phase_compromise
						is_struggle_phase = struggle_iberia_phase_conciliation
					}
				}
				NOR = {
					has_trait = ambitious
					has_trait = callous
					has_trait = sadistic
				}
			}
			multiply = 0.5
		}
	}
}

#EK DISABLED: no Byzantium
#byzantium_conquests_ai_score_value = {
#	value = 1
#	# Are we part of the Roman empire?
#	if = {
#		limit = {
#			scope:attacker = {
#				# We only care about governors and above, so don't worry about counts even if they're within the empire.
#				highest_held_title_tier >= tier_duchy
#				# Now check title ownership.
#				OR = {
#					has_title = title:e_byzantium
#					has_title = title:e_roman_empire
#					any_liege_or_above = {
#						OR = {
#							has_title = title:e_byzantium
#							has_title = title:e_roman_empire
#						}
#					}
#					# Account for the 4th crusade.
#					## Y'know, roughly.
#					AND = {
#						NOT = {
#							exists = title:e_byzantium
#						}
#						primary_title = {
#							OR = {
#								empire = title:e_byzantium
#								empire = title:e_latin_empire
#							}
#						}
#						OR = {
#							culture = { has_cultural_pillar = heritage_byzantine }
#							culture = culture:greek
#							culture = {
#    								any_parent_culture_or_above = {
#									this = culture:greek
#								}
#							} 
#						}
#					}
#				}
#			}
#		}
#		# Ok, cool. Now let's set some historical priorities.
#		every_target_title = {
#			title_province = {
#				# Constantinople is king.
#				if = {
#					limit = { county = title:c_byzantion }
#					add = 100
#				}
#				## We literally do not care about Rome: New York beats OG York, New Rome beats OG Rome.
#				# Next, we prioritise Anatolia.
#				else_if = {
#					limit = { geographical_region = ghw_region_anatolia }
#					add = 5
#				}
#				# Then Greece and the Balkans.
#				else_if = {
#					limit = {
#						OR = {
#							geographical_region = ghw_region_greece
#							geographical_region = ghw_region_thessalonika
#							geographical_region = custom_eastern_balkans
#						}
#					}
#					add = 4.5
#				}
#				# Then Syria and co.
#				else_if = {
#					limit = { geographical_region = custom_roman_syria_palestina }
#					add = 4
#				}
#				# Egypt.
#				else_if = {
#					limit = { geographical_region = custom_roman_aegyptus }
#					add = 3.5
#				}
#				# Mesopotamia.
#				else_if = {
#					limit = { geographical_region = custom_roman_mesopotamia }
#					add = 3
#				}
#				# Illyria.
#				else_if = {
#					limit = { geographical_region = custom_roman_illyricum }
#					add = 2.5
#				}
#				# North Africa.
#				else_if = {
#					limit = {
#						OR = {
#							geographical_region = custom_roman_cyrenaica
#							geographical_region = custom_roman_africa
#							geographical_region = custom_roman_mauretania
#						}
#					}
#					add = 2
#				}
#				# Italy.
#				else_if = {
#					limit = { geographical_region = ghw_region_italy }
#					add = 1.8
#				}
#				# Iberia.
#				else_if = {
#					limit = { geographical_region = custom_roman_hispania }
#					add = 1.5
#				}
#				# The remainder.
#				## Anything we missed in the east.
#				else_if = {
#					# You say "why not use Eastern Roman Empire borders?", I say, if the players are gonna obsess over historical borders then so too shall the AI.
#					limit = { geographical_region = custom_theodosian_ere }
#					add = 1
#				}
#				## Then total.
#				else_if = {
#					limit = { geographical_region = custom_roman_empire }
#					add = 0.5
#				}
#				# And _otherwise_, we probably don't want to even look at this thing.
#				## May be overridden by weird preferance combination from other values, but generally we'll hopefully get a fairly insular, naval gazing Rome.
#			}
#		}
#	}
#}

#muslim_invasions_prefer_nonmuslims_ai_score_value = {
#	value = 1
#	if = {
#		limit = {
#			scope:attacker.religion = religion:islam_religion
#		}
#		every_in_list = {
#			list = target_titles
#			if = {
#				limit = {
#					OR = {
#						AND = {
#							tier = tier_county
#							NOT = { holder.top_liege.religion = religion:islam_religion }
#							any_county_province = {
#								geographical_region = ghw_region_holy_land
#							}
#						}
#						AND = {
#							tier > tier_county
#							any_in_de_jure_hierarchy = {
#								tier = tier_county
#								NOT = { holder.top_liege.religion = religion:islam_religion }
#								any_county_province = {
#									geographical_region = ghw_region_holy_land
#								}
#							}
#						}
#					}
#				}
#				add = 1000
#			}
#			else_if = {
#				limit = {
#					OR = {
#						AND = {
#							tier = tier_county
#							NOT = { holder.top_liege.religion = religion:islam_religion }
#							any_county_province = {
#								OR = {
#									geographical_region = ghw_region_anatolia
#									geographical_region = world_india
#								}
#							}
#						}
#						AND = {
#							tier > tier_county
#							any_in_de_jure_hierarchy = {
#								tier = tier_county
#								NOT = { holder.top_liege.religion = religion:islam_religion }
#								any_county_province = {
#									OR = {
#										geographical_region = ghw_region_anatolia
#										geographical_region = world_india
#									}
#								}
#							}
#						}
#					}
#				}
#				add = 200
#			}
#			else_if = {
#				limit = {
#					OR = {
#						AND = {
#							tier = tier_county
#							NOT = { holder.top_liege.religion = religion:islam_religion }
#						}
#						AND = {
#							tier > tier_county
#							any_in_de_jure_hierarchy = {
#								tier = tier_county
#								NOT = { holder.top_liege.religion = religion:islam_religion }
#							}
#						}
#					}
#				}
#				add = 2
#			}
#		}
#	}
#}

# Raid for captives
raid_for_captives_ai_score_value = {
	value = 10
	scope:attacker = {
		if = {
			limit = {
				piety < 0
			}
			add = 15
		}
		if = {
			limit = {
				ai_zeal >= medium_positive_ai_value
				piety < 500
			}
			add = 5
		}
		if = {
			limit = {
				ai_zeal >= very_high_positive_ai_value
			}
			add = ai_zeal
		}
		if = {
			limit = {
				piety > 500
			}
			multiply = 0.5
		}
		if = {
			limit = {
				ai_zeal < 0
				NOT = {
					piety < -100
				}
			}
			multiply = 0
		}
	}
}

# EK ADDITION
clutch_raid_ai_score_value ={
	value = 0
	scope:attacker = {
		if = {
			limit = {
				any_child = { count < 2 }
			}
			add = 10
		}
		if = {
			limit = {
				any_child = { count < 1 }
			}
			add = 90
		}
	}
}
# EK ADDITION END

# Artifact wars

relic_artifact_war_ai_score_value = {
	value = 10
	scope:attacker = {
		if = {
			limit = {
				ai_greed > 0
			}
			add = {
				value = ai_greed
				divide = 2
			}
		}
		if = {
			limit = {
				ai_zeal > 0
			}
			add = ai_zeal
		}
	}
}

artifact_war_ai_score_value = {
	value = 10
	scope:attacker = {
		if = {
			limit = {
				ai_greed > 0
			}
			add = {
				value = ai_greed
				divide = 2
			}
		}
		if = {
			limit = {
				ai_vengefulness > 0
			}
			add = ai_vengefulness
		}
	}
}

#############
# Vassalization CB
#############

vassalize_default_size = 4

vassalize_growth_per_innovation = 3

vassalization_size_limit = {
	value = vassalize_default_size
	scope:attacker = {
		if = {
			limit = {
				culture = {
					has_innovation = innovation_casus_belli
				}
			}
			add = vassalize_growth_per_innovation
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_chronicle_writing
				}
			}
			add = vassalize_growth_per_innovation
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_divine_right
				}
			}
			add = vassalize_growth_per_innovation
		}
		if = {
			limit = {
				culture = {
					has_innovation = innovation_rightful_ownership
				}
			}
			add = vassalize_growth_per_innovation
		}
	}
}

#############
# GHWs
#############
third_of_defenders_strength = {
	value = ghw_defenders_strength
	multiply = 0.33
}

#############
# Siege
#############

siege_base_capture_chance = {
	value = 35

	# Dynasty Perk: Practiced Kidnappers
	if = {
		limit = {
			scope:occupant = {
				exists = dynasty
				dynasty = { has_dynasty_perk = fp1_pillage_legacy_3 }
			}
		}
		add = 20
	}
	# Cultural Parameter: State Ransoms
	if = {
		limit = {
			OR = {
				# Either you're involved in large groups of the holding surrendering...
				scope:barony.culture = { has_cultural_parameter = knights_die_less_but_are_captured_more }
				# ... or you know your liege will pay your ransom.
				scope:barony.holder.culture = { has_cultural_parameter = knights_die_less_but_are_captured_more }
			}
			# Ransoms or no, the primary participants & their heirs know better than to surrender.
			character_is_potential_valuable_prisoner = no
			# And independent characters likewise have no incentive.
			is_independent_ruler = no
		}
		add = 50
	}
	### EK ADDITON: added our own effects
	# Prisoners and Loot... Perk
	if = {
		limit = { has_perk = prisoners_and_loot_perk }
		add = 20
	}
	# whale/stuhn trait
	if = {
		limit = { has_trait = p_at_whale }
		add = 10
	}
	#EK ADDITION END
}
raid_base_capture_chance = {
	value = 20

	if = {
		limit = {
			exists = root.army_commander
		}
		# Trait: Viking
		if = {
			limit = { root.army_commander = { has_trait = viking } }
			add = 5
		}
		# Dynasty Perk: Practiced Kidnappers
		if = {
			limit = {
				exists = root.army_commander.dynasty
				root.army_commander.dynasty = { has_dynasty_perk = fp1_pillage_legacy_3 }
			}
			add = 20
		}
		add = 20
	}
	### EK ADDITON: added our own effects
	# Prisoners and Loot... Perk
	if = {
		limit = { has_perk = prisoners_and_loot_perk }
		add = 20
	}
	# whale/stuhn trait
	if = {
		limit = { has_trait = p_at_whale }
		add = 10
	}
	#EK ADDITION END
}

county_control_loss_value = {
	value = -40

	# Dynasty Perk: No Quarter
	if = {
		limit = {
			root = {
				exists = dynasty
				dynasty = { has_dynasty_perk = fp1_pillage_legacy_5 }
			}
		}
		add = -40
	}
}

raid_county_control_loss_value = {
	value = -10

	# Dynasty Perk: No Quarter
	if = {
		limit = {
			scope:raider ?= {
				exists = dynasty
				dynasty = { has_dynasty_perk = fp1_pillage_legacy_5 }
			}
		}
		add = -20
	}
}

#############
# CB Costs
#############


scale_10_war_defender_win = {
	value = 10

	if = {
		limit= {
			scope:defender.culture = {
				has_cultural_parameter = more_fame_for_successful_defensive_wars
			}
		}
		multiply = 2
	}
}

######################
# AI Decision Making #
######################

# Compute military strength against *scope:target_military*.
#
# This script value and the one after it are to be used in combination as
# "root_military_strength_higher_than_military_target_value > target_military_strength_root_value"
# to check player vs enemy strength.
root_military_strength_higher_than_military_target_value = {
	value = 0
	add = max_military_strength # Add num of troops
	if = {
		limit = {
			any_ally = {
				NOT = { has_truce = scope:target_military }
			}
		}
		every_ally = {
			limit = {
				NOT = { has_truce = scope:target_military }
			}
			add = max_military_strength
		}
	}
	if = {
		limit = { exists = var:ai_strength_multiplier }
		multiply = var:ai_strength_multiplier  # 1.25 == 25% stronger than, remember to potty train your script and have it remove the variable after usage!!
	}
}

# One above calcs player strength (plus multiplier), this one is enemy strength.
target_military_strength_root_value = {
	value = 0
	if = {
		limit = { exists = scope:target_military }
		add = scope:target_military.max_military_strength # this should be a character, probably a top liege
		scope:target_military = {
			every_ally = {
				limit =	{
					NOT = { has_truce = root }
				}
				add = max_military_strength
			}
		}
	}
}

# Compute military strength against *scope:recipient*.
#
# This script value and the one after it are to be used in combination as
# "root_military_strength_higher_than_recipient_value  > recipient_strength_root_value"
# to check player vs enemy strength.
root_military_strength_higher_than_recipient_value = {
	value = 0
	add = max_military_strength # Add num of troops
	if = {
		limit = {
			any_ally = {
				NOT = { has_truce = scope:recipient }
			}
		}
		every_ally = {
			limit = {
				NOT = { has_truce = scope:recipient }
			}
			add = max_military_strength
		}
	}
	if = {
		limit = { exists = var:ai_strength_multiplier }
		multiply = var:ai_strength_multiplier  # 1.25 == 25% stronger than, remember to potty train your script and have it remove the variable after usage!!
	}
}

# One above calcs player strength (plus multiplier), this one is enemy strength.
recipient_strength_root_value = {
	value = 0
	if = {
		limit = { exists = scope:recipient }
		add = scope:recipient.max_military_strength # this should be a character, probably a top liege
		scope:recipient = {
			every_ally = {
				limit =	{
					NOT = { has_truce = root }
				}
				add = max_military_strength
			}
		}
	}
}

war_attacker_total_strength_value = {
	value = 0
	every_war_attacker = { add = max_military_strength }
}

war_defender_total_strength_value = {
	value = 0
	every_war_defender = { add = max_military_strength }
}

war_attacker_total_strength_halved_value = {
	value = war_attacker_total_strength_value
	divide = 2
}

war_defender_total_strength_halved_value = {
	value = war_defender_total_strength_value
	divide = 2
}

war_attacker_total_strength_tenth_value = {
	value = war_attacker_total_strength_value
	divide = 10
}

war_defender_total_strength_tenth_value = {
	value = war_defender_total_strength_value
	divide = 10
}

war_attacker_total_current_strength_value = {
	value = 0
	every_war_attacker = { add = current_military_strength }
}

war_defender_total_current_strength_value = {
	value = 0
	every_war_defender = { add = current_military_strength }
}

war_attacker_total_current_strength_halved_value = {
	value = war_attacker_total_current_strength_value
	divide = 2
}

war_defender_total_current_strength_halved_value = {
	value = war_defender_total_current_strength_value
	divide = 2
}

war_attacker_total_current_strength_tenth_value = {
	value = war_attacker_total_current_strength_value
	divide = 10
}

war_defender_total_current_strength_tenth_value = {
	value = war_defender_total_current_strength_value
	divide = 10
}

war_attacker_total_current_strength_divided_by_defender_value = {
	value = war_attacker_total_current_strength_value
	divide = war_defender_total_current_strength_value
	round = yes
}

war_defender_total_current_strength_divided_by_attacker_value = {
	value = war_defender_total_current_strength_value
	divide = war_attacker_total_current_strength_value
	round = yes
}

war_total_participants_current_strength_value = {
	value = 0
	every_war_participant = { add = current_military_strength }
}

total_war_attacker_strength_value = {
	value = 0
	every_character_war = {
		limit = { prev = primary_defender }
		every_war_attacker = { add = current_military_strength }
	}
}

total_war_enemy_strength_value = {
	value = 0
	every_war_enemy = { add = current_military_strength }
}

#EK ADDITION
# central plug for all EK war AI score values.
# if you need more than two checks for a specific culture, religion or whatever, add a separate score_value
ek_war_ai_score_value = {
	value = 1
	#Dunmer war calc
	if = {
		limit = {
			OR = {
				scope:attacker.faith.religion = religion:velothi_faiths
				scope:attacker = {
					culture = {
						has_cultural_pillar = heritage_dunmeri
					}
				}
			}
		}
		multiply = dunmer_war_ai_score_value
	}
	#Altmer war calc
	if = {
		limit = {
			OR = {
				scope:attacker.faith.religion = religion:aldmeri_religion
				scope:attacker = {
					culture = {
						has_cultural_pillar = heritage_aldmeri
					}
				}	
			}
		}
		multiply = altmer_war_ai_score_value
	}
	#Cyro-Nord war calc
	if = {
		limit = {
			scope:attacker = {
				culture = {
					any_parent_culture_or_above = {
						this = culture:cyro_nord
					}
				}
			}
		}
		multiply = cyro_nord_war_ai_score_value
	}
	# simple Elsweyr x Black Marsh war reduction calc
	if = {
		limit = {
			scope:attacker = { #attacker lives in Elsweyr
				capital_province = { geographical_region = mundus_tamriel_elsweyr }
			}
			scope:defender = { #defender lives in Black Marsh
				capital_province = { geographical_region = mundus_tamriel_black_marsh }
			}
		}
		multiply = 0.8
	}
	if = {
		limit = {
			scope:attacker = { #attacker lives in Black Marsh
				capital_province = { geographical_region = mundus_tamriel_black_marsh }
			}
			scope:defender = { #defender lives in Elsweyr
				capital_province = { geographical_region = mundus_tamriel_elsweyr}
			}
		}
		multiply = 0.8
	}
	# Elsweyr: Mane war reduction outside of Elsweyr
	if = {
		limit = {
			scope:attacker = {
				has_title = title:d_mane
			}
			scope:defender = { #defender lives outside Elsweyr
				NOT = { capital_province = { geographical_region = mundus_tamriel_elsweyr}}
			}
		}
		multiply = 0.5
	}
	# Solstheim isolation
	if = {
		limit = {
			scope:attacker = { #attacker lives outside of Solstheim
				NOT = { capital_province = { geographical_region = mundus_tamriel_skyrim_solstheim } }
			}
			scope:defender = { #defender lives in Solstheim
				capital_province = { geographical_region = mundus_tamriel_skyrim_solstheim }
			}
		}
		multiply = 0.5
	}
	if = {
		limit = {
			scope:attacker = { #attacker lives in Solstheim
				capital_province = { geographical_region = mundus_tamriel_skyrim_solstheim }
			}
			scope:defender = { #defender lives outside of Solstheim
				NOT = { capital_province = { geographical_region = mundus_tamriel_skyrim_solstheim } }
			}
		}
		multiply = 0.8
	}
	if = { #Cyrodiilic Cult faiths shouldn't be so eager to eradicate the various Abbeys in Cyrodiil
		limit = {
			scope:attacker.faith = { #attacker is Cyrodiilic Cult
				has_doctrine = special_doctrine_cyrodiilic_cult
			}
			scope:defender = { #and defender is a Cyrodiilic Abbey
				OR = {
					has_title = title:d_abbey_zenithar
					has_title = title:k_abbey_eight
					has_title = title:d_abbey_shezarr
				}
			}
		}
		multiply = 0.25
	}
	if = { #Post-Knahaten, Lore-wise non-Argonians were scared of conquering BM
		limit = {
			has_global_variable = black_death_happened
			scope:attacker = {
				NOT = { culture = { has_cultural_tradition = tradition_histskin } }
				NOT = {  #Marduhn Oadi economy is dependent on BM slavery, so they're the exception
					culture = {
						OR = {
							this = culture:marduhn_oad
							any_parent_culture_or_above = {
								this = culture:marduhn_oad
							}
						}
					}
				}
				NOT = { capital_province = { geographical_region = mundus_tamriel_black_marsh } }
			}
			scope:defender = {
				capital_province = { geographical_region = mundus_tamriel_black_marsh }
			}
		}
		multiply = 0.75
	}

	min = 1
}
dunmer_war_ai_score_value = {
	value = 1
	if = { # Dunmer should never attack the tribunal #GCM TODO: should/could be handled by GCM, alongside defending the tribunal in defensive wars
		limit = {
			scope:attacker = {
				faith = {
					has_doctrine = doctrine_pantheon_tribunal
				}
			}
			scope:defender = {
				OR = {
					has_title = title:e_tribunal_temple
					has_title = title:k_archcanon_vivec
					has_title = title:k_archcanon_almalexia
					has_title = title:k_archcanon_sotha_sil
				}
			}
		}
		multiply = 0
	}
	if = { # ...unless they are Ashlanders, then pester them GCM TODO: stance on Ashlanders
		limit = {
			scope:attacker = {
				NOT = {
					faith = {
						has_doctrine = doctrine_pantheon_tribunal
					}
				}
				culture = {
					OR = {
						this = culture:ashlander
						any_parent_culture_or_above = { this = culture:ashlander }
					}
				}
			}
			scope:defender = {
				OR = {
					has_title = title:e_tribunal_temple
					has_title = title:k_archcanon_vivec
					has_title = title:k_archcanon_almalexia
					has_title = title:k_archcanon_sotha_sil
				}
			}
		}
		multiply = 4
	}
	if = { # Dunmer in general are just somewhat desinterested in Cyrodiil
		limit = {
			scope:defender = {
				capital_province = {
					geographical_region = mundus_tamriel_cyrodiil
				}
			}
		}
		multiply = 0.8
	}
	if = { #Hlaalu have a particular disinterest in _conquering_ places in Cyrodiil. They would rather trade with them.
		limit = {
			scope:attacker.top_liege = {
				has_title = title:k_hlaalu
			}
			scope:defender = {
				capital_province = {
					geographical_region = mundus_tamriel_cyrodiil
				}
			}
		}
		multiply = 0.5
	}
	if = { #Nor does Hlaalu wish to compete with Dres over Black Marsh
		limit = {
			scope:attacker.top_liege = {
				has_title = title:k_hlaalu
			}
			scope:defender = {
				capital_province = {
					geographical_region = mundus_tamriel_black_marsh
				}
			}
		}
		multiply = 0.5
	}
	if = { #Dres is quadruple as likely to invade Black Marsh as others. they just really like Black Marsh
		limit = {
			scope:attacker.top_liege = {
				has_title = title:k_dres
			}
			scope:defender = {
				capital_province = {
					geographical_region = mundus_tamriel_black_marsh
				}
			}
		}
		multiply = 4
	}
	if = { #Redoran is half as likely to kill Ashlanders GHC TODO: stance on Ashlanders
		limit = {
			scope:attacker.top_liege = {
				has_title = title:k_redoran
			}
			scope:defender = {
				culture = {
					OR = {
						this = culture:ashlander
						any_parent_culture_or_above = { this = culture:ashlander }
					}
				}
			}
		}
		multiply = 0.5
	}
	if = { #Redoran is double as likely to pick a fight with nords/atmorans #GHC TODO: stance on Outlanders
		limit = {
			scope:attacker = {
				has_title = title:k_redoran
			}
			scope:defender = {
				culture = {
					has_cultural_pillar = heritage_atmoran
				}
			}
		}
		multiply = 2
	}
	if = { #Dunmer should generally try to stay in Morrowind
		limit = {
			OR = { #attacker is dunmer
				scope:attacker.religion = religion:velothi_faiths
				scope:attacker = {
					culture = {
						has_cultural_pillar = heritage_dunmeri
					}
				}
			}
			scope:attacker = { #attacker is in morrowind
				capital_province = { geographical_region = mundus_tamriel_morrowind }
			}
			scope:defender = { #defender is _not_ in morrowind
				NOT = { capital_province = { geographical_region = mundus_tamriel_morrowind } }
			}
		}
		multiply = 0.5
	}
	min = 0
}

altmer_war_ai_score_value = {
	value = 1
	if = { #if your capital is on the Summerset isles, you don't like to go elsweyr (haha)
		limit = {
			scope:attacker = { #attacker lives in summerset
				capital_province = { geographical_region = mundus_tamriel_summerset_isles }
			}
			scope:defender = { #defender doesn't
				NOT = { capital_province = { geographical_region = mundus_tamriel_summerset_isles } }
			}
		}
		multiply = 0.3
	}
	if = { #if your capital is on the Summerset isles, hew's bane is of particular desinterest to you
		limit = {
			scope:attacker = { #attacker lives in summerset
				capital_province = { geographical_region = mundus_tamriel_summerset_isles }
			}
			scope:defender = { #defender lives in hews bane
				capital_province = { geographical_region = mundus_tamriel_hammerfell_hew_bane }
			}
		}
		multiply = 0.9
	}
	if = { #if you hold Balfiera, you really like to stay on balfiera
		limit = {
			scope:attacker = { #attacker lives on balfiera
				capital_province = { geographical_region = mundus_tamriel_high_rock_balfiera }
			}
			scope:defender = { #defender doesn't
				NOT = { capital_province = { geographical_region = mundus_tamriel_high_rock_balfiera } }
			}
		}
		multiply = 0.4
	}
	if = { #if you hold Balfiera, you really like holding Bhoriane and Koegria
		limit = {
			scope:attacker = { #attacker lives on balfiera
				capital_province = { geographical_region = mundus_tamriel_high_rock_balfiera }
			}
			scope:defender = { #defender lives in direnni_allowed_expansion (d_bhoriane and d_koegria)
				capital_province = { geographical_region = direnni_allowed_expansion }
			}
		}
		multiply = 5
	}
	min = 0
}

cyro_nord_war_ai_score_value = {
	value = 1
	if = { #cyro-nords are just somewhat desinterested in areas outside northern cyrodiil/southern skyrim
		limit = {
			scope:defender = {
				capital_province = {
					NOR = {
						geographical_region = mundus_tamriel_cyrodiil_jerall_mountains
						geographical_region = mundus_tamriel_skyrim_falkreath
						geographical_region = mundus_tamriel_skyrim_the_rift
					}
				}
			}
		}
		multiply = 0.75
	}
	if = { #they are further desinterested in the heartlands (so 0.75*0.7 = 0.525 war value in the heartlands)
		limit = {
			scope:defender = {
				capital_province = {
					geographical_region = mundus_tamriel_cyrodiil_heartlands
				}
			}
		}
		multiply = 0.7
	}
	min = 0
}
#EK ADDITION END