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

less_trucks_4_u_JAP = {
	enable = {
		tag = JAP
		date < 1939.1.1
	}
	abort = { 
		date > 1939.1.1
	}

	ai_strategy = { 
		type = role_ratio
		id = infantry
		value = 80
	}
	
	ai_strategy = { 
		type = role_ratio
		id = garrison
		value = 12
	}
	
	# Old garrison system against resistance
	# ai_strategy = { 
	# 	type = role_ratio
	# 	id = suppression
	# 	value = 8
	# }

	ai_strategy = {
		type = template_prio
		id = motorized
		value = -80
	}

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

	ai_strategy = {
		type = template_prio
		id = mountaineers
		value = -80
	}

	ai_strategy = {
		type = template_prio
		id = infantry
		value = 100
	}
	
		ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 20
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 5 #10 to 5
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 20 #From 40 to 20
	}
		ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 5
	}
}
	
JAP_build_some_factories_jeez = {
	enable = {
		tag = JAP
		date > 1939.1.2
	}
	abort = { 
		OR = {
			num_of_military_factories > 50
			CHI = { is_subject_of = JAP }
		}
	}

	ai_strategy = { 
		type = role_ratio
		id = infantry
		value = 80
	}
	
	ai_strategy = { 
		type = role_ratio
		id = garrison
		value = 12
	}
	
	# Old garrison system against resistance
	# ai_strategy = { 
	# 	type = role_ratio
	# 	id = suppression
	# 	value = 8
	# }

	ai_strategy = {
		type = template_prio
		id = motorized
		value = -80
	}

	ai_strategy = {
		type = role_ratio
		id = armor
		value = -10
	}

	ai_strategy = {
		type = template_prio
		id = armor
		value = -80
	}

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

	ai_strategy = {
		type = template_prio
		id = mountaineers
		value = -80
	}

	ai_strategy = {
		type = template_prio
		id = infantry
		value = 100
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 20
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 5 #10 to 5
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 20 #From 40 to 20
	}

	ai_strategy = {
		type = equipment_variant_production_factor
		id = light_tank_equipment
		value = -50
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 5
	}

	ai_strategy = {
		type = added_military_to_civilian_factory_ratio
		value = 15
	}
}

JAP_glorious_nippon_steel_has_triumphed = {
	enable = {
		tag = JAP
		OR = {
			num_of_military_factories > 50
			CHI = { is_subject_of = JAP }
		}
	}
	abort = { 
		
	}

	ai_strategy = { 
		type = role_ratio
		id = infantry
		value = 80
	}
	
	# Old garrison system against resistance
	# ai_strategy = { 
	# 	type = role_ratio
	# 	id = garrison
	# 	value = 12
	# }
	
	ai_strategy = { 
		type = role_ratio
		id = suppression
		value = 8
	}
	ai_strategy = {
		type = role_ratio
		id = marines
		value = 1
	}

	ai_strategy = {
		type = template_prio
		id = motorized
		value = -80
	}

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

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

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

	ai_strategy = {
		type = template_prio
		id = mountaineers
		value = -80
	}
	ai_strategy = {
		type = template_prio
		id = infantry
		value = 100
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = fighter
		value = 20
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = infantry
		value = 5 #10 to 5
	}
	
	ai_strategy = {
		type = equipment_production_factor
		id = artillery
		value = 20 #From 40 to 20
	}

	ai_strategy = {
		type = equipment_production_min_factories
		id = artillery
		value = 5
	}
}
southern_expansion = {
	enable = {
		tag = JAP
		has_completed_focus = JAP_strike_south_doctrine
		OR = {
			country_exists = HOL
			country_exists = ENG	
		}
	}
	abort = {
		NOT = {
			country_exists = HOL
			country_exists = ENG	
		}
	}
	
	ai_strategy = {
		type = antagonize
		id = "HOL"			
		value = 200
	}		
	ai_strategy = {
		type = antagonize
		id = "ENG"			
		value = 100
	}
}

northern_expansion = {
	enable = {
		tag = JAP
		has_completed_focus = JAP_prepare_for_war_with_the_soviet_union
		country_exists = SOV
	}
	abort = {
		NOT = {
			country_exists = SOV
		}
	}
	
	ai_strategy = {
		type = antagonize
		id = "SOV"			
		value = 200
	}		
}

chinese_war = {
	enable = {
		tag = JAP
		has_completed_focus = JAP_intervene_in_china
		country_exists = CHI
	}
	abort = {
		NOT = {
			country_exists = CHI
		}
	}
	
	ai_strategy = {
		type = antagonize
		id = "CHI"			
		value = 200
	}		
}

strike_usa = {
	enable = {
		tag = JAP
		has_completed_focus = JAP_secure_the_philippines
		country_exists = USA
	}
	abort = {
		NOT = {
			country_exists = USA
		}
	}
	
	ai_strategy = {
		type = antagonize
		id = "USA"			
		value = 200
	}

	ai_strategy = {
		type = antagonize
		id = "PHI"			
		value = 200
	}	
}

# "I can run wild for six months… after that, I have no expectation of success"
jap_hush_yamamoto_its_gonna_be_ok = {
	enable = {
		tag = JAP
		has_completed_focus = JAP_secure_the_philippines
		country_exists = USA
		NOT = { has_war_with = USA }
	}

	abort = {
		OR = {
			has_war_with = USA
			NOT = {
				country_exists = USA
			}
		}
	}

	ai_strategy = {
		type = consider_weak
		id = "USA"
		value = 75
	}
}

jap_conserve_fuel_for_usa_fight = {
	enable = {
		tag = JAP
		date < 1941.1.1
		NOT = { has_war_with = USA }
	}

	abort = {
		OR = {
			date > 1941.1.1
			has_war_with = USA
		}		
	}

	ai_strategy = {
		type = naval_mission_threshold
		id = "MISSION_CONVOY_ESCORT"
		value = 150 #puts our threshold at 250
	}
}

germany_ally = {
	enable = {
		tag = JAP
		has_completed_focus = JAP_technological_exchange
		country_exists = GER
	}
	abort = {
		NOT = { country_exists = GER }
	}
	
	ai_strategy = {
		type = befriend
		id = "GER"			
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "GER"			
		value = 200
	}	
}


JAP_template_design = {
	enable = {
		original_tag = JAP
		date > 1940.1.1				
	}
	
	ai_strategy = {
		type = template_prio
		id = infantry
		value = -10
	}

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

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

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

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


# hey dynamic targets would be swole as f*
all_china_must_prosper_in_my_prosperity_sphere_SIK = {

	enable = {
		tag = JAP
		
		OR = {
			NOT = { country_exists = CHI }
			CHI = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}
		}
		country_exists = SIK
		NOT = { 
			YUN = {
				OR = {
					is_in_faction_with = JAP
					is_puppet_of = JAP
				}			
			} 
		}
	}

	abort = {
		NOT = { country_exists = SIK }
		SIK = {
			OR = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}			
		} 
	}
	
	ai_strategy = {
		type = antagonize
		id = "SIK"
		value = 5000
	}
}
all_china_must_prosper_in_my_prosperity_sphere_XSM = {

	enable = {
		tag = JAP
		
		OR = {
			NOT = { country_exists = CHI }
			CHI = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}
		}
		country_exists = XSM
		NOT = { 
			YUN = {
				OR = {
					is_in_faction_with = JAP
					is_puppet_of = JAP
				}			
			} 
		}
	}

	abort = {
		NOT = { country_exists = XSM }
		XSM = {
			OR = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}			
		} 
	}
	
	ai_strategy = {
		type = antagonize
		id = "XSM"
		value = 5000
	}
}
all_china_must_prosper_in_my_prosperity_sphere_GXC = {

	enable = {
		tag = JAP
		
		OR = {
			NOT = { country_exists = CHI }
			CHI = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}
		}
		country_exists = GXC
		NOT = { 
			YUN = {
				OR = {
					is_in_faction_with = JAP
					is_puppet_of = JAP
				}			
			} 
		}
	}

	abort = {
		NOT = { country_exists = GXC }
		GXC = {
			OR = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}			
		} 
	}
	
	ai_strategy = {
		type = antagonize
		id = "GXC"
		value = 5000
	}
}
all_china_must_prosper_in_my_prosperity_sphere_SHX = {

	enable = {
		tag = JAP
		
		OR = {
			NOT = { country_exists = CHI }
			CHI = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}
		}
		country_exists = SHX
		NOT = { 
			YUN = {
				OR = {
					is_in_faction_with = JAP
					is_puppet_of = JAP
				}			
			} 
		}
	}

	abort = {
		NOT = { country_exists = SHX }
		SHX = {
			OR = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}			
		} 
	}
	
	ai_strategy = {
		type = antagonize
		id = "SHX"
		value = 5000
	}
}
all_china_must_prosper_in_my_prosperity_sphere_YUN = {

	enable = {
		tag = JAP
		
		OR = {
			NOT = { country_exists = CHI }
			CHI = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}
		}
		country_exists = YUN
		NOT = { 
			YUN = {
				OR = {
					is_in_faction_with = JAP
					is_puppet_of = JAP
				}			
			} 
		}
	}

	abort = {
		NOT = { country_exists = YUN }
		YUN = {
			OR = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}			
		} 
	}
	
	ai_strategy = {
		type = antagonize
		id = "YUN"
		value = 5000
	}

}
all_china_must_prosper_in_my_prosperity_sphere_PRC = {

	enable = {
		tag = JAP
		
		OR = {
			NOT = { country_exists = CHI }
			CHI = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}
		}
		country_exists = PRC
		NOT = { 
			YUN = {
				OR = {
					is_in_faction_with = JAP
					is_puppet_of = JAP
				}			
			} 
		}
	}

	abort = {
		NOT = { country_exists = PRC }
		PRC = {
			OR = {
				is_in_faction_with = JAP
				is_puppet_of = JAP
			}			
		} 
	}
	
	ai_strategy = {
		type = antagonize
		id = "PRC"
		value = 5000
	}
}

jap_china_is_weak = {

	enable = {
		tag = JAP
		date < 1939.10.1
		NOT = { has_war_with = CHI } # only underestimate the japanese before the war
	}

	abort = {
		OR = {
			date > 1939.10.1
			has_war_with = CHI # only underestimate the japanese before the war
		}		
	}
	
	ai_strategy = {
		type = consider_weak
		id = "CHI"
		value = 50
	}
}


jap_building_boats_is_great = {
	
	enable = {
		tag = JAP
		num_of_civilian_factories_available_for_projects > 15
	}

	abort = {

	}

	ai_strategy = {
		type = dockyard_to_military_factory_ratio
		value = 40  #aim for a 2-1 ratio on naval factories
	}
}


JAP_dont_mess_with_volunteers = { # Reverse strategy
	reversed = yes

	enable = {
		NOT = { tag = JAP }
		date < 1941.6.1	
		JAP = {
			OR = {
				has_government = fascism
				has_government = neutrality
			}
		}
		
		capital_scope = {
			is_on_continent = europe # lets not mess with europe
		}
	}

	abort = {
		date > 1941.6.1 #lets go global later yo
		JAP = {
			OR = {
				NOT = {	has_government = fascism }
				NOT = {	has_government = neutrality }
			}
		}
	}

	ai_strategy = {
		type = send_volunteers_desire
		id = "JAP"
		value = -500
	}
}

JAP_naval_role_ratios_historical = {
	enable = {
		has_dlc = "Man the Guns"
		original_tag = JAP
	}
	abort = {
		num_of_naval_factories > 60
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = -120
	}

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

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

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

	ai_strategy = {
		type = role_ratio
		id = naval_submarine
		value = 50
	}

	ai_strategy = {
		type = role_ratio
		id = naval_screen
		value = 100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_escort 
		value = 30
	}

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

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_heavy
		value = -15
	}

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

	ai_strategy = {
		type = role_ratio
		id = naval_mine_layer
		value = 5
	}
	# general building directives
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 2
	}

	ai_strategy = {
		type = unit_ratio
		id = carrier
		value = 4
	}

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

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

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

JAP_naval_role_ratios_historical_late = {
	enable = {
		has_dlc = "Man the Guns"
		original_tag = JAP
		num_of_naval_factories > 60
	}

	ai_strategy = {
		type = role_ratio
		id = naval_capital_bb
		value = -120
	}

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

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

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

	ai_strategy = {
		type = role_ratio
		id = naval_submarine
		value = 50
	}

	ai_strategy = {
		type = role_ratio
		id = naval_screen
		value = 100
	}

	ai_strategy = {
		type = role_ratio
		id = naval_escort 
		value = 30
	}

	ai_strategy = {
		type = role_ratio
		id = naval_cruiser_light
		value = 30
	}

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

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

	ai_strategy = {
		type = role_ratio
		id = naval_mine_layer
		value = 5
	}
	# general building directives
	ai_strategy = {
		type = unit_ratio
		id = capital_ship
		value = 3
	}

	ai_strategy = {
		type = unit_ratio
		id = carrier
		value = 4
	}

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

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

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

jap_invasions_of_gxc_are_super_tough_and_waste_manpower = {
	enable = {
		tag = JAP
		date < 1942.1.1 #if we still stuck we might need a trick

		has_war_with = CHI
	}
	
	abort = {
		OR = {
			date > 1942.1.1
			NOT = { has_war_with = CHI }
		}		
	}

	ai_strategy = {
		type = invade
		id = "GXC"			
		value = -500
	}
}

jap_early_invasions_are_risky_and_best_wait_for_later = {
	enable = {
		tag = JAP
		date < 1939.1.1
		has_war_with = CHI
		CHI = { is_ai = yes }
	}
	
	abort_when_not_enabled = yes

	ai_strategy = {
		type = invade
		id = "CHI"			
		value = -500
	}
}

jap_doesnt_care_about_relation = {

	enable = {
		tag = JAP
		OR = {
			has_war = yes
			date < 1940.1.1
		}
	}
	
	abort = {
		has_war = no
		date > 1940.1.1
	}

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

# if china has fallen and we are going for USA we will end up at war with allies suddenly while maybe bordering them,
# but thats hard to guess for AI considering all the steps. So we warn it so it can prep vs the allies
jap_early_part_beware_allies = {
	enable = {
		tag = JAP
		USA = { is_in_faction = no }
		focus_progress = {
			focus = JAP_secure_the_philippines
			progress > 0
		}
		PHI = {	is_subject_of = USA }
		NOT = { has_war_together_with = ENG }
	}
	
	abort = {
		OR = {
			USA = { is_in_faction = yes } # they know where to stand so we can go back to regular logic
			has_war_together_with = ENG
		}		
	}

	ai_strategy = {
		type = prepare_for_war
		id = "ENG"
		value = 100
	}
	ai_strategy = {
		type = prepare_for_war
		id = "FRA"
		value = 100
	}
	ai_strategy = {
		type = prepare_for_war
		id = "PHI"
		value = 100
	}
	ai_strategy = {
		type = prepare_for_war
		id = "USA"
		value = 100
	}
	ai_strategy = {
		type = prepare_for_war
		id = "RAJ"
		value = 100
	}
}

JAP_USA_we_love_islands = {
	enable = {
		OR = { 
			tag = JAP
			tag = USA
		}
		OR = {
			JAP = { has_war_with = USA }
			CHI = { is_subject_of = JAP }
		}
	}

	abort_when_not_enabled = yes
		
	ai_strategy = {
		type = area_priority
		id = pacific
		value = 80
	}
}

JAP_we_will_mostly_fight_on_subjects = {
	enable = {
		tag = JAP
	}
	
	ai_strategy = {
		type = produce_unit_for_subject_supply_chunks
		value = 50
	}
}
