# Written by Henrik "Groogy" Hansson
# Modified by Daniel "Da9L" Sjöberg

# befriend
# conquer
# antagonize
# build_ship
# build_army
# unit_ratio
# build_building
# research_tech
# garrison
# protect
# influence
# contain
# area_priority

default_unit_production = {
	enable = {
		always = yes
		NOT = { original_tag = CHN } is_pony_race = no NOT = { original_tag = OLE  } NOT = { original_tag = ENG  }
	}

	ai_strategy = {
		type = role_ratio
		id = paratroopers
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = mountaineers
		value = 4
	}

	ai_strategy = {
		type = role_ratio
		id = marines
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 1
	}

	ai_strategy = {
		type = role_ratio
		id = light_armor
		value = 1
	}

	ai_strategy = {
		type = role_ratio
		id = modern_armor
		value = 2
	}

	ai_strategy = {
		type = role_ratio
		id = infantry
		value = 65
	}

	ai_strategy = {
		type = role_ratio
		id = magical_infantry
		value = 15
	}

	#Air unit factors
	ai_strategy = {
		type = unit_ratio
		id = fighter
		value = 80
	}

	ai_strategy = {
		type = unit_ratio
		id = cas
		value = 5
	}

	ai_strategy = {
		type = unit_ratio
		id = tactical_bomber
		value = 5
	}

	ai_strategy = {
		type = unit_ratio
		id = strategic_bomber
		value = 5
	}

	ai_strategy = {
		type = unit_ratio
		id = naval_bomber
		value = 5
	}


	# Naval unit factors
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 20
	}

	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = 10
	}

	ai_strategy = {
		type = unit_ratio
		id = screen_ship
		value = 30
	}

	ai_strategy = {
		type = unit_ratio
		id = convoy
		value = 15
	}

	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 35
	}

	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 40
	}

	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 25
	}
}


default_paratroopers_production = {
	enable = {
		NOT = { original_tag = CHN }
		ai_wants_divisions >  12 #Massively decreasing the amount of paratroopers the AI wants
	}
	abort = {
		ai_wants_divisions < 13 #Massively decreasing the amount of paratroopers the AI wants
	}

	ai_strategy = {
		type = role_ratio
		id = paratroopers
		value = 0
	}
}

default_garrison_production = {
	enable = {
		NOT = {
			original_tag = CHN
			original_tag = SOV
			original_tag = USA
			original_tag = CHI
			original_tag = FRA
			original_tag = JAP
		}
		ai_wants_divisions >  12 #Massively decreasing the amount of paratroopers the AI wants
		is_major = yes
	}
	abort = {
		ai_wants_divisions < 13 #Massively decreasing the amount of paratroopers the AI wants
		is_major = no
	}

	ai_strategy = {
		type = role_ratio
		id = garrison
		value = 7
	}
}

default_mountaineers_production = {
	enable = {
		NOT = { original_tag = CHN }
		ai_wants_divisions > 11 #Decreasing the amount of mountaineers the AI wants
	}
	abort = {
		ai_wants_divisions < 12 #Decreasing the amount of mountaineers the AI wants
	}

	ai_strategy = {
		type = role_ratio
		id = mountaineers
		value = 3
	}
}

default_marines_production = {
	enable = {
		NOT = { original_tag = CHN }
		ai_wants_divisions > 49
	}
	abort = {
		ai_wants_divisions < 50
	}

	ai_strategy = {
		type = role_ratio
		id = marines
		value = 0
	}

	ai_strategy = {
		type = role_ratio
		id = infantry
		value = 0
	}
}

default_mobile_production = {
	enable = {
		NOT = { original_tag = CHN }
		ai_wants_divisions > 11
		has_tech = motorised_infantry
	}
	abort = {
		ai_wants_divisions < 12
	}

	ai_strategy = {
		type = role_ratio
		id = mobile
		value = 2
	}
}

default_armored_production = {
	enable = {
		NOT = { original_tag = CHN }
		ai_wants_divisions > 49
	}
	abort = {
		ai_wants_divisions < 50
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 2
	}

	ai_strategy = {
		type = role_ratio
		id = infantry
		value = 0
	}
}

highered_armored_production = {
	enable = {
		NOT = { original_tag = CHN }
		num_of_military_factories > 69
	}
	abort = {
		num_of_military_factories < 70
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = 5
	}
}

slightly_naval_focused_nation = {
	enable = {
		OR = {
			original_tag = EQS
			original_tag = NLR
			original_tag = CHN
			original_tag = OLE
		}
	}

	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 1
	}

	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = 1
	}

	ai_strategy = {
		type = unit_ratio
		id = screen_ship
		value = 1
	}

	ai_strategy = {
		type = unit_ratio
		id = convoy
		value = 1
	}
}

more_naval_focused_nation = {
	enable = {
		OR = {
			original_tag = EQS
			original_tag = NLR
		}
		date > "1012.1.1" #Delaying it by a couple of years
	}

	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 2		 #1 to 2
	}

	ai_strategy = {
		type = unit_ratio
		id = submarine
		value = 1
	}

	ai_strategy = {
		type = unit_ratio
		id = screen_ship
		value = 1
	}

	ai_strategy = {
		type = unit_ratio
		id = convoy
		value = 1
	}
}


default_area_priority = {
	enable = {
		NOT = { original_tag = CHN } NOT = { original_tag = FRA }
	}

	ai_strategy = {
		type = area_priority
		id = europe
		value = 100
	}

	ai_strategy = {
		type = area_priority
		id = north_america
		value = 100
	}

	ai_strategy = {
		type = area_priority
		id = south_america
		value = 50
	}

	ai_strategy = {
		type = area_priority
		id = asia
		value = 75
	}

	ai_strategy = {
		type = area_priority
		id = middle_east
		value = 50
	}

	ai_strategy = {
		type = area_priority
		id = africa
		value = -90
	}

	ai_strategy = {
		type = area_priority
		id = pacific
		value = 300
	}

	ai_strategy = {
		type = area_priority
		id = oceania
		value = 80
	}

}

default_stockpile_management = {
	enable = {
		num_divisions > 150
	}

	abort = {
		num_divisions < 130
	}

	ai_strategy = {
		type = equipment_stockpile
		value = 35 # double base stockpile #from 25 to 35
	}
}


DEFAULT_template_design = {
	enable = {
		NOT = { OR = { tag = CHN is_pony_race = yes tag = SOV tag = ITA tag = JAP tag = USA tag = POL } }
		date < 1011.1.1
	}
	abort = {
		date > 1011.1.1
	}

	ai_strategy = {
		type = template_prio
		id = motorized
		value = 10
	}

	ai_strategy = {
		type = template_prio
		id = cavalry
		value = -100
	}

	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 50
	}

	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = -10
	}

	ai_strategy = {
		type = template_prio
		id = heavy_armor
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = paratroopers
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = infantry
		value = 60
	}
}

DEFAULT_template_design = {
	enable = {
		NOT = { OR = { tag = CHN is_pony_race = yes tag = SOV tag = ITA tag = JAP tag = USA tag = POL } }
		date > 1011.1.1
	}

	ai_strategy = {
		type = template_prio
		id = mechanized
		value = 10
	}

	ai_strategy = {
		type = template_prio
		id = cavalry
		value = -100
	}

	ai_strategy = {
		type = template_prio
		id = light_armor
		value = 10
	}

	ai_strategy = {
		type = template_prio
		id = medium_armor
		value = 20
	}

	ai_strategy = {
		type = template_prio
		id = modern_armor
		value = 50
	}

	ai_strategy = {
		type = template_prio
		id = heavy_armor
		value = 10
	}

	ai_strategy = {
		type = template_prio
		id = paratroopers
		value = -50
	}

	ai_strategy = {
		type = template_prio
		id = infantry
		value = 10
	}
}

save_admiral_pp_for_later = {
	enable = {
		has_war = no
		threat < 0.3
		has_political_power < 200
	}
	abort = {
		OR = {
			has_war = yes
			threat > 0.3
			has_political_power > 200
		}
	}

	ai_strategy = { # dont burn PP on admirals (can still get free ones)
		type = pp_spend_priority
		id = admiral
		value = -100
	}
}

do_not_waste_pp_if_saving_for_manpower_laws = {

	enable = {
		manpower_per_military_factory < 500
		has_war = yes
	}
	abort = {
		OR = {
			manpower_per_military_factory > 500
			has_war = no
		}
	}

	ai_strategy = {
		type = pp_spend_priority
		id = relation
		value = -9999
	}

	ai_strategy = {
		type = pp_spend_priority
		id = guarantee
		value = -9999
	}
}
