#####################

###  ##  #  # # #  ## 
 #  #  # ## # # # #   
 #  #### # ## ##   #  
 #  #  # #  # # #   # 
 #  #  # #  # # # ## 

 #################### 

JAP_osaka_army_arsenal_organization = {
	include = generic_tank_organization
	icon = GFX_idea_osaka_army_arsenal
	allowed = {	
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}

	add_trait = {
		token = JAP_mio_trait_foreign_research_and_development_cooperation
		name = JAP_mio_trait_foreign_research_and_development_cooperation
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_defensive_equipment

		position = { x = 2 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_foreign_tank_modernization_cooperation
				NOT = { has_country_flag = JAP_mio_trait_foreign_research_and_development_cooperation_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_foreign_research_and_development_cooperation_taken_flag
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.15
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

} 

JAP_sagami_army_arsenal_organization = {
	include = generic_medium_tank_organization
	icon = GFX_idea_JAP_sagami_arsenal
	allowed = {	
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}

	add_trait = {
		token = JAP_mio_trait_foreign_research_and_development_cooperation
		name = JAP_mio_trait_foreign_research_and_development_cooperation
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_aircraft_engines

		position = { x = 0 y = 1 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_foreign_tank_modernization_cooperation
				NOT = { has_country_flag = JAP_mio_trait_foreign_research_and_development_cooperation_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_foreign_research_and_development_cooperation_taken_flag
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.15
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

} 

JAP_mitsubishi_heavy_industries_organization = {
	include = generic_infantry_tank_organization
	icon = GFX_idea_JAP_mitsubishi_tanks
	allowed = {	
		OR ={
			AND = {
					original_tag = JAP
					has_dlc = "Arms Against Tyranny"
			}
			PHI_SEA = yes
		}
	}

	available = {
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}
		
		IF = {
			limit = {
				FROM = {
					original_tag = PHI
				}
			}
			FROM = {
				has_completed_focus = PHI_align_with_japan
				if = {
					limit = {
						has_completed_focus = PHI_declare_military_emergency
					}
					NOT = {
						has_completed_focus = PHI_declare_military_emergency
					}
				}
			}
		}
	}

	add_trait = {
		token = JAP_mio_trait_special_government_contracts_mitsubishi_trait
		name = JAP_mio_trait_special_government_contracts_mitsubishi_trait
		icon = GFX_generic_mio_trait_icon_efficiency_cap
		special_trait_background = yes

		relative_position_id = generic_mio_trait_battle_tank_specifications

		position = { x = 1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			has_mio_size > 5
			FROM = {
				NOT = { has_country_flag = JAP_mio_trait_special_government_contracts_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_special_government_contracts_taken_flag 
			}
			custom_effect_tooltip = generic_skip_one_line_tt
			FROM = {
				remove_trait = {
				    character = JAP_koyata_iwasaki
				    slot = political_advisor
				    trait = JAP_mitsubishi_president
				}
				custom_effect_tooltip = generic_skip_one_line_tt
				add_trait = {
				    character = JAP_koyata_iwasaki
				    slot = political_advisor
				    trait = JAP_mitsubishi_president_2
				}
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.02
		}

		production_bonus = {
			
		}

		ai_will_do = {
			base = 2
		}
	}



	add_trait = {
		token = JAP_mio_trait_foreign_research_and_development_cooperation
		name = JAP_mio_trait_foreign_research_and_development_cooperation
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_battle_tank_specifications

		position = { x = 3 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_foreign_tank_modernization_cooperation
				NOT = { has_country_flag = JAP_mio_trait_foreign_research_and_development_cooperation_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_foreign_research_and_development_cooperation_taken_flag
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.15
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = PHI_mio_trait_ethanol_fuel_adaptations
		name = PHI_mio_trait_ethanol_fuel_adaptations
		icon = GFX_generic_mio_trait_icon_fuel_consumption
		special_trait_background = yes

		position = { x = 1 y = 3 }  
		
		visible = {
			FROM = { original_tag = PHI }
		}

		available = {
		}

		on_complete = {
		}

		equipment_bonus = {
			fuel_consumption = -0.05
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = PHI_mio_trait_coconut_fuel_adaptations
		name = PHI_mio_trait_coconut_fuel_adaptations
		icon = GFX_generic_mio_trait_icon_fuel_consumption
		special_trait_background = yes

		position = { x = 0 y = 1 }  
		
		visible = {
			FROM = { original_tag = PHI }
		}

		available = {
			FROM = {
				PHI_vicente_lava = {
					is_hired_as_advisor = yes
				}
			}
		}

		relative_position_id = PHI_mio_trait_ethanol_fuel_adaptations
		any_parent = { PHI_mio_trait_ethanol_fuel_adaptations }

		on_complete = {
		}

		equipment_bonus = {
			fuel_consumption = -0.10
			reliability = -0.05
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = PHI_mio_trait_ad_hoc_armor_reinforcement
		name = PHI_mio_trait_ad_hoc_armor_reinforcement
		icon = GFX_generic_mio_department_icon_tank_general_armor
		special_trait_background = yes

		position = { x = 8 y = 2 }  
		
		visible = {
			FROM = { original_tag = PHI }
		}

		available = {
		}

		any_parent = { generic_mio_trait_thick_armor }

		on_complete = {
		}

		equipment_bonus = {
			hardness = 0.05
			armor_value = 0.03
			maximum_speed = -0.03
		}

		ai_will_do = {
			base = 2
		}
	}

} 


#####################

 ## #  # ### ###   ## 
#   #  #  #  #  # #   
 #  ####  #  ###   #  
  # #  #  #  #      # 
##  #  # ### #    ##  
 
#####################


JAP_kure_naval_arsenal_organization = {
	include = generic_battle_line_ship_organization
	icon = GFX_idea_kure_naval_arsenal

	allowed = {	
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}

	available = {
		FROM = {
			#has_completed_focus = JAP_supremacy_of_the_battlefleet
			has_completed_focus = JAP_expand_hiratsuka_navy_arsenal
		}
	}

	add_trait = {  
		token = JAP_mio_trait_rapid_counterflooding_system
		name = JAP_mio_trait_rapid_counterflooding_system
		icon = GFX_generic_mio_trait_icon_max_strength
		special_trait_background = yes

		relative_position_id = generic_mio_trait_hardened_critical_components

		all_parents = { generic_mio_trait_hardened_critical_components }

		position = { x = 0 y = 1 } 

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		equipment_bonus = {
			naval_torpedo_enemy_critical_chance_factor = -0.1
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {  
		token = JAP_mio_trait_enhanced_optics
		name = JAP_mio_trait_enhanced_optics
		icon = GFX_generic_mio_trait_icon_surface_detection
		special_trait_background = yes

		relative_position_id = generic_mio_trait_secondary_battery_layout

		all_parents = { generic_mio_trait_secondary_battery_layout }

		position = { x = 0 y = 1 } 

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		equipment_bonus = {
			lg_attack = 0.05
			hg_attack = 0.05
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = JAP_mio_trait_strength_in_numbers
		name = JAP_mio_trait_strength_in_numbers
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_primary_battery_layout

		position = { x = 1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_seek_strength_in_numbers
				NOT = { has_country_flag = JAP_mio_trait_strength_in_numbers_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_strength_in_numbers_taken_flag
			}
		}

		organization_modifier = {
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

}

JAP_yokosuka_naval_arsenal_organization = {
	include = generic_task_force_ship_organization
	icon = GFX_idea_yokosuka_naval_arsenal

	allowed = {	
		OR = {
			AND = {
				original_tag = JAP
				has_dlc = "Arms Against Tyranny"
			}
			PHI_SEA = yes
		}
	}

	available = {
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}
		
		IF = {
			limit = {
				FROM = {
					original_tag = PHI
				}
			}
			FROM = {
				has_completed_focus = PHI_align_with_japan
				if = {
					limit = {
						has_completed_focus = PHI_declare_military_emergency
					}
					NOT = {
						has_completed_focus = PHI_declare_military_emergency
					}
				}
			}
		}
	}

	add_trait = {
		token = JAP_mio_trait_naval_arsenal_trait
		name = JAP_mio_trait_naval_arsenal_trait
		icon = GFX_generic_mio_trait_icon_production_capacity
		special_trait_background = yes

		relative_position_id = generic_mio_trait_primary_fire_director_control

		position = { x = -1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				JAP_naval_faction_is_not_subdued = yes
			}
		}

		on_complete = {
			
		}

		organization_modifier = {
		    
		}

		production_bonus = {
			production_capacity_factor = 0.05
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {  
		token = JAP_mio_trait_armor_plating_to_hull_strength
		name = JAP_mio_trait_armor_plating_to_hull_strength
		icon = GFX_generic_mio_department_icon_ship_general_production
		special_trait_background = yes

		relative_position_id = generic_mio_trait_long_range_cruising

		any_parent = { generic_mio_trait_long_range_cruising generic_mio_trait_high_speed_cruising }

		position = { x = 0 y = 1 } 

		visible = {
			FROM = { original_tag = JAP }
		}

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		production_bonus = {
			production_capacity_factor = 0.05
		}

		equipment_bonus = {
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {  
		token = JAP_mio_trait_enhanced_optics
		name = JAP_mio_trait_enhanced_optics
		icon = GFX_generic_mio_trait_icon_surface_detection
		special_trait_background = yes

		relative_position_id = generic_mio_trait_primary_fire_director_control

		all_parents = { generic_mio_trait_primary_fire_director_control }

		position = { x = 1 y = 1 } 

		visible = {
			FROM = { original_tag = JAP }
		}

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		equipment_bonus = {
			lg_attack = 0.05
			hg_attack = 0.05
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {  
		token = JAP_mio_trait_type_94_fire_control
		name = JAP_mio_trait_type_94_fire_control
		icon = GFX_generic_mio_trait_icon_anti_air_attack
		special_trait_background = yes

		relative_position_id = generic_mio_trait_secondary_fire_director_control

		all_parents = { generic_mio_trait_secondary_fire_director_control }

		position = { x = 0 y = 1 } 

		visible = {
			FROM = { original_tag = JAP }
		}

		limit_to_equipment_type = { mio_cat_eq_all_cruiser carrier }

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		equipment_bonus = {
			anti_air_attack = 0.1
			naval_light_gun_hit_chance_factor = 0.05
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {  
		token = JAP_mio_trait_torpedo_reloads
		name = JAP_mio_trait_torpedo_reloads
		icon = GFX_generic_mio_trait_icon_torpedo_attack
		special_trait_background = yes

		relative_position_id = JAP_mio_trait_enhanced_optics

		all_parents = { JAP_mio_trait_enhanced_optics }

		position = { x = 0 y = 1 } 

		visible = {
			FROM = { original_tag = JAP }
		}

		limit_to_equipment_type = { screen_ship }

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		equipment_bonus = {
			torpedo_attack	= 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = JAP_mio_trait_strength_in_numbers
		name = JAP_mio_trait_strength_in_numbers
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_primary_fire_director_control

		position = { x = 1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_seek_strength_in_numbers
				NOT = { has_country_flag = JAP_mio_trait_strength_in_numbers_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_strength_in_numbers_taken_flag
			}
		}

		organization_modifier = {
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = PHI_mio_trait_ethanol_fuel_adaptations
		name = PHI_mio_trait_ethanol_fuel_adaptations
		icon = GFX_generic_mio_trait_icon_fuel_consumption
		special_trait_background = yes

		position = { x = 9 y = 0 }  
		
		visible = {
			FROM = { original_tag = PHI }
		}

		available = {
		}

		on_complete = {
		}

		equipment_bonus = {
			fuel_consumption = -0.05
		}

		ai_will_do = {
			base = 2
		}
	}

}

JAP_maizuru_naval_arsenal_organization = {
	include = generic_escort_ship_organization
	icon = GFX_idea_maizuru_naval_arsenal
	
	allowed = {	 
		OR = {
			original_tag = JAP 
			AND = {
				original_tag = ETH
				has_dlc = "By Blood Alone"
			}
		}
	}
	
	visible = {
		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}

		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_JAP_maizuru_naval_arsenal_organization_flag
				}
			}
		}
	}

	add_trait = {  
		token = JAP_mio_trait_high_pressure_boilers
		name = JAP_mio_trait_high_pressure_boilers
		icon = GFX_generic_mio_trait_icon_maximum_speed
		special_trait_background = yes

		relative_position_id = generic_mio_trait_high_speed_mine_hunting_equipment

		all_parents = { generic_mio_trait_high_speed_mine_hunting_equipment }

		position = { x = -1 y = 1 } 

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		equipment_bonus = {
			naval_speed = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {  
		token = JAP_mio_trait_torpedo_reloads
		name = JAP_mio_trait_torpedo_reloads
		icon = GFX_generic_mio_trait_icon_torpedo_attack
		special_trait_background = yes

		relative_position_id = generic_mio_trait_fleet_escorts

		all_parents = { generic_mio_trait_fleet_escorts }

		position = { x = 0 y = 1 } 

		limit_to_equipment_type = { screen_ship }

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		equipment_bonus = {
			torpedo_attack	= 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {  
		token = JAP_mio_trait_type_94_fire_control
		name = JAP_mio_trait_type_94_fire_control
		icon = GFX_generic_mio_trait_icon_anti_air_attack
		special_trait_background = yes

		relative_position_id = generic_mio_trait_high_speed_mine_hunting_equipment

		all_parents = { generic_mio_trait_high_speed_mine_hunting_equipment }

		position = { x = 1 y = 1 } 

		limit_to_equipment_type = { mio_cat_eq_all_cruiser carrier }

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		equipment_bonus = {
			anti_air_attack = 0.1
			naval_light_gun_hit_chance_factor = 0.05
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = JAP_mio_trait_naval_arsenal_trait
		name = JAP_mio_trait_naval_arsenal_trait
		icon = GFX_generic_mio_trait_icon_production_capacity
		special_trait_background = yes

		relative_position_id = JAP_mio_trait_strength_in_numbers

		position = { x = -1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				JAP_naval_faction_is_not_subdued = yes
			}
		}

		on_complete = {
			
		}

		organization_modifier = {
		    
		}

		production_bonus = {
			production_capacity_factor = 0.05
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = JAP_mio_trait_strength_in_numbers
		name = JAP_mio_trait_strength_in_numbers
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_fleet_escorts

		position = { x = 3 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_seek_strength_in_numbers
				NOT = { has_country_flag = JAP_mio_trait_strength_in_numbers_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_strength_in_numbers_taken_flag
			}
		}

		organization_modifier = {
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

}

JAP_sasebo_naval_arsenal_organization = {
	include = generic_raider_ship_organization
	icon = GFX_idea_sasebo_naval_arsenal

	allowed = {	 
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}

	add_trait = {  
		token = JAP_mio_trait_torpedo_reloads
		name = JAP_mio_trait_torpedo_reloads
		icon = GFX_generic_mio_department_icon_ship_screen_ship_offense
		special_trait_background = yes

		relative_position_id = generic_mio_trait_raiding_submarines

		all_parents = { generic_mio_trait_raiding_submarines }

		position = { x = 2 y = 1 } 

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		limit_to_equipment_type = { screen_ship submarine }

		equipment_bonus = {
			torpedo_attack	= 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {  
		token = JAP_mio_trait_type_97_torpedo_control_director
		name = JAP_mio_trait_type_97_torpedo_control_director
		icon = GFX_generic_mio_trait_icon_torpedo_attack
		special_trait_background = yes

		relative_position_id = generic_mio_trait_high_quality_optics

		any_parent = { generic_mio_trait_high_quality_optics generic_mio_trait_spotting_tops }

		position = { x = 1 y = 1 } 

		#available = {
		#	FROM = {
		#		has_completed_focus = GER_high_seas_fleet
		#	}
		#}

		limit_to_equipment_type = { screen_ship }

		equipment_bonus = {
			naval_torpedo_hit_chance_factor	= 0.1
		}

		ai_will_do = {
			base = 2
		}
	}


	add_trait = {
		token = JAP_mio_trait_strength_in_numbers
		name = JAP_mio_trait_strength_in_numbers
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_high_speed_raiding

		position = { x = 2 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_seek_strength_in_numbers
				NOT = { has_country_flag = JAP_mio_trait_strength_in_numbers_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_strength_in_numbers_taken_flag
			}
		}

		organization_modifier = {
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

}

#JAP_hikari_naval_arsenal_organization = {
#	include = generic_refurbishment_repair_organization
#	icon = GFX_idea_JAP_hikari_naval_arsenal
#	allowed = {	 
#		original_tag = JAP
#		has_dlc = "Arms Against Tyranny"
#	}
#}

JAP_mitsubishi_kobe_shipyard_organization = {
	include = generic_submarine_organization
	icon = GFX_idea_JAP_kobe_shipyard

	allowed = {	
		OR = {
			AND = {
				original_tag = JAP 
				has_dlc = "Arms Against Tyranny"
			}
			PHI_SEA = yes
		}
	}

	available = {
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}
		
		IF = {
			limit = {
				FROM = {
					original_tag = PHI
				}
			}
			FROM = {
				has_completed_focus = PHI_align_with_japan
				if = {
					limit = {
						has_completed_focus = PHI_declare_military_emergency
					}
					NOT = {
						has_completed_focus = PHI_declare_military_emergency
					}
				}
			}
		}
	}

	add_trait = {
		token = JAP_mio_trait_special_government_contracts_mitsubishi_trait
		name = JAP_mio_trait_special_government_contracts_mitsubishi_trait
		icon = GFX_generic_mio_trait_icon_efficiency_cap
		special_trait_background = yes

		relative_position_id = generic_mio_trait_decalin_fueled_torpedo

		position = { x = 2 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			has_mio_size > 5
			FROM = {
				NOT = { has_country_flag = JAP_mio_trait_special_government_contracts_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = mitsubishi_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_special_government_contracts_taken_flag 
			}
			custom_effect_tooltip = generic_skip_one_line_tt
			FROM = {
				remove_trait = {
				    character = JAP_koyata_iwasaki
				    slot = political_advisor
				    trait = JAP_mitsubishi_president
				}
				custom_effect_tooltip = generic_skip_one_line_tt
				add_trait = {
				    character = JAP_koyata_iwasaki
				    slot = political_advisor
				    trait = JAP_mitsubishi_president_2
				}
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.02
		}

		production_bonus = {
			
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = JAP_mio_trait_strength_in_numbers
		name = JAP_mio_trait_strength_in_numbers
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_decalin_fueled_torpedo

		position = { x = 4 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_seek_strength_in_numbers
				NOT = { has_country_flag = JAP_mio_trait_strength_in_numbers_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_strength_in_numbers_taken_flag
			}
		}

		organization_modifier = {
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = PHI_mio_trait_ethanol_fuel_adaptations
		name = PHI_mio_trait_ethanol_fuel_adaptations
		icon = GFX_generic_mio_trait_icon_fuel_consumption
		special_trait_background = yes

		position = { x = 9 y = 0 }  
		
		visible = {
			FROM = { original_tag = PHI }
		}

		available = {
		}

		on_complete = {
		}

		equipment_bonus = {
			fuel_consumption = -0.05
		}

		ai_will_do = {
			base = 2
		}
	}

}

###########################

###  #    ##  #  # ###  ## 
#  # #   #  # ## # #   #   
###  #   #### # ## ##   #  
#    #   #  # #  # #     # 
#    ### #  # #  # ### ##  

###########################


JAP_mitsubishi_organization = {
	include = generic_high_agility_fighter_aircraft_organization
	icon = GFX_idea_JAP_mitsubishi_airplanes
	
	allowed = {	 
		OR = {
			original_tag = JAP 
			AND = {
				original_tag = ETH
				has_dlc = "By Blood Alone"
			}
			PHI_SEA = yes
		}
		has_dlc = "Arms Against Tyranny"
	}
	
	visible = {
		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}

		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_JAP_mitsubishi_organization_flag
				}
			}
		}

		IF = {
			limit = {
				FROM = {
					original_tag = PHI
				}
			}
			FROM = {
				has_completed_focus = PHI_align_with_japan
				if = {
					limit = {
						has_completed_focus = PHI_declare_military_emergency
					}
					NOT = {
						has_completed_focus = PHI_declare_military_emergency
					}
				}
			}
		}

	}


	add_trait = {
		token = JAP_mio_trait_special_government_contracts_mitsubishi_trait
		name = JAP_mio_trait_special_government_contracts_mitsubishi_trait
		icon = GFX_generic_mio_trait_icon_efficiency_cap
		special_trait_background = yes

		relative_position_id = generic_mio_trait_minimum_weapon_requirements

		position = { x = 2 y = 1 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			has_mio_size > 5
			FROM = {
				NOT = { has_country_flag = JAP_mio_trait_special_government_contracts_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_special_government_contracts_taken_flag 
			}
			custom_effect_tooltip = generic_skip_one_line_tt
			FROM = {
				remove_trait = {
				    character = JAP_koyata_iwasaki
				    slot = political_advisor
				    trait = JAP_mitsubishi_president
				}
				custom_effect_tooltip = generic_skip_one_line_tt
				add_trait = {
				    character = JAP_koyata_iwasaki
				    slot = political_advisor
				    trait = JAP_mitsubishi_president_2
				}
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.02
		}

		production_bonus = {
			
		}

		ai_will_do = {
			base = 2
		}
	}


	add_trait = {
		token = PHI_mio_trait_engine_filters
		name = PHI_mio_trait_engine_filters
		icon = GFX_generic_mio_trait_icon_reliability
		special_trait_background = yes

		position = { x = 1 y = 1 }  
		
		visible = {
			FROM = { original_tag = PHI }
		}

		available = {
		}

		relative_position_id = generic_mio_trait_fabric_skin
		any_parent = { generic_mio_trait_fabric_skin generic_mio_trait_metal_skin }

		on_complete = {
		}

		equipment_bonus = {
			reliability = 0.10
		}

		ai_will_do = {
			base = 2
		}
	}

} 

JAP_aichi_organization = {
	include = generic_range_focused_aircraft_organization
	icon = GFX_idea_aichi
	allowed = {	
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
	available = {
		
	}

	add_trait = {
		token = JAP_mio_trait_unified_research_and_development
		name = JAP_mio_trait_unified_research_and_development
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_extra_cargo_doors

		position = { x = -1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_sea_unify_the_air_forces
				NOT = { has_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.15
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

}

JAP_nakajima_organization = {
	include = generic_heavy_aircraft_organization
	icon = GFX_idea_nakajima
	allowed = {	
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}

	add_trait = {
		token = JAP_mio_trait_special_government_contracts_nakajima_trait
		name = JAP_mio_trait_special_government_contracts_nakajima_trait
		icon = GFX_generic_mio_trait_icon_efficiency_cap
		special_trait_background = yes

		relative_position_id = generic_mio_trait_extended_rear_fuselage

		position = { x = -3 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			has_mio_size > 5
		}

		on_complete = {
			FROM = {
				remove_trait = {
				    character = JAP_chikuhei_nakajima
				    slot = political_advisor
				    trait = JAP_nakajima_president
				}
				custom_effect_tooltip = generic_skip_one_line_tt
				add_trait = {
				    character = JAP_chikuhei_nakajima
				    slot = political_advisor
				    trait = JAP_nakajima_president_2
				}
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.02
		}

		production_bonus = {
			
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = JAP_mio_trait_unified_research_and_development
		name = JAP_mio_trait_unified_research_and_development
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_extended_rear_fuselage

		position = { x = 1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_sea_unify_the_air_forces
				NOT = { has_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.15
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

}

JAP_yokosuka_organization = {
	include = generic_naval_aircraft_organization 
	icon = GFX_idea_yokosuka
	allowed = {	
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}

	add_trait = {
		token = JAP_mio_trait_type_91_aerial_torpedo_integration
		name = JAP_mio_trait_type_91_aerial_torpedo_integration
		icon = GFX_generic_mio_trait_icon_air_ground_attack
		special_trait_background = yes

		relative_position_id = generic_mio_trait_navigation_equipment

		all_parents = { generic_mio_trait_navigation_equipment }

		position = { x = 2 y = 1 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_improve_the_type_91_aerial_torpedo
			}
		}

		on_complete = {
		}

		equipment_bonus = {
			naval_strike_attack = 0.1
			naval_strike_targetting = 0.05
		}

		ai_will_do = {
			base = 5
		}
	}

	add_trait = {
		token = JAP_mio_trait_naval_arsenal_trait
		name = JAP_mio_trait_naval_arsenal_trait
		icon = GFX_generic_mio_trait_icon_production_capacity
		special_trait_background = yes

		relative_position_id = generic_mio_trait_navigation_equipment

		position = { x = 4 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				JAP_naval_faction_is_not_subdued = yes
			}
		}

		on_complete = {
			
		}

		organization_modifier = {
		    
		}

		production_bonus = {
			production_capacity_factor = 0.05
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = JAP_mio_trait_unified_research_and_development
		name = JAP_mio_trait_unified_research_and_development
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_navigation_equipment

		position = { x = 5 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_sea_unify_the_air_forces
				NOT = { has_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.15
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

}

JAP_kawanishi_aircraft_company_organization = {
	include = generic_multi_role_aircraft_organization
	icon = GFX_idea_JAP_kawanishi
	allowed = {	
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}

	add_trait = {
		token = JAP_mio_trait_unified_research_and_development
		name = JAP_mio_trait_unified_research_and_development
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_escort_designs

		position = { x = 3 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_sea_unify_the_air_forces
				NOT = { has_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.15
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

}

JAP_kawasaki_aircraft_industries_organization = {
	include = generic_medium_aircraft_organization
	icon = GFX_idea_JAP_kawasaki_aircraft
	allowed = {	
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}

	add_trait = {
		token = JAP_mio_trait_zaibatsu_production_capabilities_trait
		name = JAP_mio_trait_zaibatsu_production_capabilities_trait
		icon = GFX_generic_mio_trait_icon_efficiency_gain
		special_trait_background = yes

		relative_position_id = generic_mio_trait_skip_bombing

		position = { x = -1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				JAP_zaibatsu_faction_is_at_least_influential = yes
			}
		}

		on_complete = {
			
		}

		production_bonus = {
			production_cost_factor = -0.05
		}

		production_bonus = {
			production_capacity_factor = 0.05
		}

		ai_will_do = {
			base = 2
		}
	}

	add_trait = {
		token = JAP_mio_trait_unified_research_and_development
		name = JAP_mio_trait_unified_research_and_development
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_skip_bombing

		position = { x = 1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_sea_unify_the_air_forces
				NOT = { has_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.15
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

}

JAP_tachikawa_aircraft_company_organization = {
	include = generic_cas_aircraft_organization
	icon = GFX_idea_JAP_tachikawa_aircraft_company
	
	allowed = {	 
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}

	initial_trait = {
		name = JAP_mio_trait_army_aircraft_manufacturer
		
		limit_to_equipment_type = { 
			small_plane_cas_airframe
		}
		
		production_bonus = {
			production_capacity_factor = 0.03
		}

		equipment_bonus = {
			air_ground_attack = 0.02
		}

	}

	add_trait = {
		token = JAP_mio_trait_unified_research_and_development
		name = JAP_mio_trait_unified_research_and_development
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_heat_bombs

		position = { x = 2 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_sea_unify_the_air_forces
				NOT = { has_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_unified_research_and_development_taken_flag
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.15
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

}



################################### 

#   #  ##  ### ### ###  ### ### #   
## ## #  #  #  #   #  #  #  #   #   
# # # ####  #  ##  ###   #  ##  #   
#   # #  #  #  #   #  #  #  #   #   
#   # #  #  #  ### #  # ### ### ### 


###################################

JAP_kokura_arsenal_organization = {
	include = generic_infantry_equipment_organization
	icon = GFX_idea_tokyo_arsenal
	allowed = {	
		OR = {
			AND = {
				original_tag = JAP
				has_dlc = "Arms Against Tyranny"
			}
			PHI_SEA = yes
		}

	}

	available = {
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}
		
		IF = {
			limit = {
				FROM = {
					original_tag = PHI
				}
			}
			FROM = {
				has_completed_focus = PHI_align_with_japan
				if = {
					limit = {
						has_completed_focus = PHI_declare_military_emergency
					}
					NOT = {
						has_completed_focus = PHI_declare_military_emergency
					}
				}
			}
		}
	}

	add_trait = { 
		token = PHI_mio_trait_rugged_construction
		name = PHI_mio_trait_rugged_construction
		icon = GFX_generic_mio_trait_icon_reliability
		special_trait_background = yes

		position = { x=0 y=0 }  

		visible = {
			FROM = {
				original_tag = PHI
			}
		}

		equipment_bonus = {
			reliability = 0.05
		}
	}

	add_trait = { 
		token = PHI_mio_trait_use_local_materials
		name = PHI_mio_trait_use_local_materials
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		position = { x=0 y=1 }  

		visible = {
			FROM = {
				original_tag = PHI
			}
		}

		any_parent = { PHI_mio_trait_rugged_construction }

		production_bonus = { 
			production_cost_factor = -0.05 
		}
	}

}

JAP_osaka_army_arsenal_artillery_organization = {
	include = generic_artillery_organization
	icon = GFX_idea_osaka_army_arsenal
	allowed = {	
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}

	add_trait = {
		token = JAP_mio_trait_military_arsenal_trait
		name = JAP_mio_trait_military_arsenal_trait
		icon = GFX_generic_mio_trait_icon_production_capacity
		special_trait_background = yes

		relative_position_id = generic_mio_trait_big_guns

		position = { x = 1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				JAP_army_faction_is_not_subdued = yes
			}
		}

		on_complete = {
			
		}

		organization_modifier = {
		    
		}

		production_bonus = {
			production_capacity_factor = 0.05
		}

		ai_will_do = {
			base = 2
		}
	}

} 

JAP_nissan_organization = {
	include = generic_motorized_mechanized_organization 
	icon = GFX_idea_nissan
	allowed = {	 
		OR = {
			original_tag = JAP 
			AND = {
				original_tag = ETH
				has_dlc = "By Blood Alone"
			}
			AND = {
				original_tag = MAN
				has_dlc = "No Compromise, No Surrender"
			}
			PHI_SEA = yes
		}
		has_dlc = "Arms Against Tyranny"
	}
	
	visible = {
		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
		IF = {
			limit = {
				FROM = { original_tag = MAN }
			}
			FROM = { has_completed_focus = MAN_tsr_strengthen_ties_with_nissan }
		}
	}
	
	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}

		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			custom_trigger_tooltip = {
				tooltip = has_invited_mio_tt
				FROM = {
					has_country_flag = has_invited_JAP_nissan_organization_flag
				}
			}
		}

		IF = {
			limit = {
				FROM = {
					original_tag = PHI
				}
			}
			FROM = {
				has_completed_focus = PHI_align_with_japan
				if = {
					limit = {
						has_completed_focus = PHI_declare_military_emergency
					}
					NOT = {
						has_completed_focus = PHI_declare_military_emergency
					}
				}
			}
		}
	}

	add_trait = {
		token = JAP_mio_trait_special_government_contracts_nissan_trait
		name = JAP_mio_trait_special_government_contracts_nissan_trait
		icon = GFX_generic_mio_trait_icon_efficiency_cap
		special_trait_background = yes

		relative_position_id = generic_mio_trait_closed_chassi

		position = { x = 1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			has_mio_size > 5
		}

		on_complete = {
			FROM = {
				remove_trait = {
				    character = JAP_yoshisuke_aikawa
				    slot = political_advisor
				    trait = JAP_nissan_president
				}
				custom_effect_tooltip = generic_skip_one_line_tt
				add_trait = {
				    character = JAP_yoshisuke_aikawa
				    slot = political_advisor
				    trait = JAP_nissan_president_2
				}
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.02
		}

		production_bonus = {
			
		}

		ai_will_do = {
			base = 2
		}
	}


	add_trait = {
		token = PHI_mio_trait_ethanol_fuel_adaptations
		name = PHI_mio_trait_ethanol_fuel_adaptations
		icon = GFX_generic_mio_trait_icon_fuel_consumption
		special_trait_background = yes

		position = { x = 9 y = 0 }  
		
		visible = {
			FROM = { original_tag = PHI }
		}

		available = {
		}

		on_complete = {
		}

		equipment_bonus = {
			fuel_consumption = -0.05
		}

		ai_will_do = {
			base = 2
		}
	}

}

JAP_tokyo_automobile_industries_organization = {
	include = generic_armored_car_organization
	icon = GFX_idea_JAP_isuzu_mot_1 # Can become GFX_idea_JAP_isuzu_mot_2
	
	allowed = {	
		OR = {
			AND = {
				original_tag = JAP
				has_dlc = "La Resistance"
			}
			PHI_SEA = yes
		}
		has_dlc = "Arms Against Tyranny"
	}
	
	available = {
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}
		
		IF = {
			limit = {
				FROM = {
					original_tag = PHI
				}
			}
			FROM = {
				has_completed_focus = PHI_align_with_japan
				if = {
					limit = {
						has_completed_focus = PHI_declare_military_emergency
					}
					NOT = {
						has_completed_focus = PHI_declare_military_emergency
					}
				}
			}
		}
	}

}

JAP_nagoya_arsenal_organization = {
	include = generic_support_equipment_organization
	icon = GFX_idea_JAP_nagoya_arsenal
	
	allowed = {	
		OR = {
			original_tag = JAP 
			original_tag = MAN
		}
		has_dlc = "Arms Against Tyranny"
	}

	available = {
		# When in a Foreign MIO, countries need to be at peace with original country
		IF = {
			limit = {
				FROM = { NOT = { original_tag = JAP } }
			}
			FROM = { NOT = { has_war_with = JAP } }
		}

		IF = {
			limit = {
				FROM = { original_tag = MAN }
			}
			FROM = {
				OR = {
					is_subject_of = JAP
					is_in_faction_with = JAP
				}
			}
		}
	}

	add_trait = {
		token = JAP_mio_trait_military_arsenal_trait
		name = JAP_mio_trait_military_arsenal_trait
		icon = GFX_generic_mio_trait_icon_production_capacity
		special_trait_background = yes

		relative_position_id = generic_mio_trait_anti_tank_rifle

		position = { x = 1 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				JAP_army_faction_is_not_subdued = yes
			}
		}

		on_complete = {
			
		}

		organization_modifier = {
		    
		}

		production_bonus = {
			production_capacity_factor = 0.05
		}

		ai_will_do = {
			base = 2
		}
	}

}

JAP_kayaba_industry_organization = {
	include = generic_helicopter_organization
	icon = GFX_idea_JAP_kayaba_industry
	
	allowed = {	
		original_tag = JAP 
		has_dlc = "Gotterdammerung"		
		has_dlc = "Arms Against Tyranny"
	}

}

JAP_hitachi_arms_department_organization = {
	include = generic_assault_guns_organization
	icon = GFX_idea_JAP_hitachi_arms
	
	allowed = {	
		original_tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
	
	available = {
		
	}

	add_trait = {
		token = JAP_mio_trait_foreign_research_and_development_cooperation
		name = JAP_mio_trait_foreign_research_and_development_cooperation
		icon = GFX_generic_mio_department_icon_facilities
		special_trait_background = yes

		relative_position_id = generic_mio_trait_heavy_assault_gun_improvements

		position = { x = 2 y = 0 }  
		
		visible = {
			FROM = { original_tag = JAP }
		}

		available = {
			FROM = {
				has_completed_focus = JAP_foreign_tank_modernization_cooperation
				NOT = { has_country_flag = JAP_mio_trait_foreign_research_and_development_cooperation_taken_flag }
			}
		}

		on_complete = {
			custom_effect_tooltip = generic_trait_will_not_be_available_in_other_organizations
			FROM = {
				set_country_flag = JAP_mio_trait_foreign_research_and_development_cooperation_taken_flag
			}
		}

		organization_modifier = {
		    military_industrial_organization_research_bonus = 0.15
		}

		production_bonus = {
			production_capacity_factor = 0.1
		}

		ai_will_do = {
			base = 2
		}
	}

}
