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

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

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

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


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

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


JAP_kure_naval_arsenal_organization = {
	include = generic_battle_line_ship_organization
	icon = GFX_idea_kure_naval_arsenal
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
	available = {
		FROM = {
			OR = {
				has_completed_focus = JAP_supremacy_of_the_battlefleet
				has_completed_focus = JAP_the_ultimate_battleship
			}
		}
	}
	
	add_trait = { 
		token = AUS_mio_trait_range_speed
		name = AUS_mio_trait_range_speed
		icon = GFX_generic_mio_department_icon_ship_capital_ship_quality
		special_trait_background = yes

		position = { x=2 y=0 }
		relative_position_id = generic_mio_trait_combat_information_center

		all_parents = { generic_mio_trait_secondary_fire_director_control }
		any_parent =  { generic_mio_trait_super_heavy_shells generic_mio_trait_semi_armor_piercing_shells generic_mio_trait_high_velocity_guns }


		equipment_bonus = {
			naval_speed = 0.05
			naval_range = 0.05
			build_cost_ic = 0.001
		}
	}

	add_trait = { 
		token = AUS_mio_trait_production_speed
		name = AUS_mio_trait_production_speed
		icon = GFX_generic_mio_department_icon_ship_capital_ship_production
		special_trait_background = yes

		position = { x=2 y=1 }
		relative_position_id = generic_mio_trait_hardened_critical_components

		all_parents = { generic_mio_trait_secondary_fire_director_control generic_mio_trait_hardened_critical_components }
		


		equipment_bonus = {
			build_cost_ic = -0.05		
		}
	}
}

JAP_yokosuka_naval_arsenal_organization = {
	include = generic_task_force_ship_organization
	icon = GFX_idea_yokosuka_naval_arsenal
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
}

JAP_maizuru_naval_arsenal_organization = {
	include = generic_escort_ship_organization
	icon = GFX_idea_maizuru_naval_arsenal
	
	allowed = {	 
		OR = {
			tag = JAP 
			AND = {
				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
				}
			}
		}
	}
}

JAP_sasebo_naval_arsenal_organization = {
	include = generic_raider_ship_organization
	icon = GFX_idea_sasebo_naval_arsenal
	allowed = {	 
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
}

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

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

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


JAP_mitsubishi_organization = {
	include = generic_high_agility_fighter_aircraft_organization
	icon = GFX_idea_mitsubishi
	
	allowed = {	 
		OR = {
			tag = JAP 
			AND = {
				tag = ETH
				has_dlc = "By Blood Alone"
			}
		}
	}
	
	visible = {
		IF = {
			limit = {
				FROM = { original_tag = ETH }
			}
			FROM = { has_completed_focus = ETH_invite_foreign_industrialists }
		}
	}
	
	initial_trait = {
		name = generic_mio_initial_trait_high_agility_fighters_designer
		
		organization_modifier = {
			military_industrial_organization_funds_gain = 0.05
		}

		equipment_bonus = {
			air_range = 0.05
			air_defence = -0.05
		}
	}
	
	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 } }
		}
		ELSE = {
			FROM = { has_completed_focus = JAP_agility_focus }
		}

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

JAP_aichi_organization = {
	include = generic_range_focused_aircraft_organization
	icon = GFX_idea_aichi
	allowed = {	
		tag = JAP
	}
	available = {
		FROM = { has_completed_focus = JAP_range_focus }
	}
	
	initial_trait = {
		name = generic_mio_initial_trait_range_focused_aircraft_designer

		organization_modifier = {
			military_industrial_organization_funds_gain = 0.05
		}

		limit_to_equipment_type = { mio_cat_eq_all_small_plane mio_cat_eq_all_medium_plane }
		
		equipment_bonus = {
			air_range = 0.15
			air_defence = -0.05
		}
	}
}

JAP_nakajima_organization = {
	include = generic_heavy_aircraft_organization
	icon = GFX_idea_nakajima
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
	
	initial_trait = {
		name = generic_mio_initial_trait_heavy_aircraft_designer

		limit_to_equipment_type = { large_plane_airframe large_plane_maritime_patrol_plane_airframe }
		organization_modifier = {
			military_industrial_organization_research_bonus = 0.05
			military_industrial_organization_funds_gain = 0.05
		}
		
		equipment_bonus = {
			air_range = 0.05
			air_defence = -0.05
		}
	}
}

JAP_yokosuka_organization = {
	include = generic_naval_aircraft_organization 
	icon = GFX_idea_yokosuka
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
	
	initial_trait = {
		name = generic_mio_initial_trait_naval_aircraft_designer

		organization_modifier = {
			military_industrial_organization_funds_gain = 0.1
		}
		equipment_bonus = {
			air_range = 0.05
			air_defence = -0.05
		}
	}
	
	    override_trait = {
        token = generic_mio_trait_internal_torpedo_mountings
        position = { x=1 y=0 }
    }

    add_trait = { 
        token = DEN_mio_trait_sub_detection
        name = generic_mio_trait_submarine_hunters
        icon = GFX_generic_mio_trait_icon_sub_detection
        special_trait_background = yes

        all_parents = {
            generic_mio_trait_navigation_equipment
        }

        position = { x=-2 y=1 }
        relative_position_id = generic_mio_trait_navigation_equipment

        mutually_exclusive = { DEN_mio_trait_naval_detection }

        equipment_bonus = {
            naval_strike_targetting = 0.05
        }
    }
    
    add_trait = { 
        token = DEN_mio_trait_naval_detection
        name = generic_mio_trait_naval_strike
        icon = GFX_generic_mio_department_icon_plane_naval_bomber
        special_trait_background = yes

        all_parents = {
            generic_mio_trait_navigation_equipment
        }

        position = { x=-1 y=1 }
        relative_position_id = generic_mio_trait_navigation_equipment

        mutually_exclusive = { DEN_mio_trait_sub_detection }

        equipment_bonus = {
            naval_strike_attack = 0.05
        }
    }

    add_trait = { 
        token = DEN_mio_trait_standardized_production_flyvemaskinevaerksted
        name = generic_mio_initial_trait_standardized_production
        icon = GFX_generic_mio_department_icon_plane_general_line_efficiency
        special_trait_background = yes

        position = { x=1 y=1 }
        relative_position_id = generic_mio_trait_navigation_equipment
        
        any_parent = { generic_mio_trait_navigation_equipment }
        

        production_bonus = {
            production_capacity_factor = 0.05
        }
    }
}



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

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


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

JAP_tokyo_arsenal_organization = {
	include = generic_infantry_equipment_organization
	icon = GFX_idea_tokyo_arsenal
	allowed = {	
		tag = JAP
		has_dlc = "Arms Against Tyranny"
	}
}

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

JAP_nissan_organization = {
	include = generic_motorized_mechanized_organization 
	icon = GFX_idea_nissan
	allowed = {	 
		OR = {
			tag = JAP 
			AND = {
				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_nissan_organization_flag
				}
			}
		}
	}
}



JAP_mitsubishi_tank_organization = {
	include = generic_mobile_tank_organization
	icon = GFX_idea_mitsubishi
	name = JAP_mitsubishi_organization
	
	allowed = { tag = JAP 	}

} 

JAP_mitsubishi_ships_organization = {
	include = generic_refurbishment_repair_organization
	icon = GFX_idea_mitsubishi
	name = JAP_mitsubishi_organization
	
	allowed = { tag = JAP 	}
	available = {
		OR = { 
		  FROM = { has_completed_focus = JAP_the_ultimate_battleship }
		  FROM = { has_completed_focus = JAP_supremacy_of_the_battlefleet }
		}
	}
} 

JAP_sumitomo_ships_organization = {
	include = generic_black_sea_fleet_organization
	icon = GFX_idea_sumitomo
	name = sumitomo
	allowed = { 
		tag = JAP
	}
	
	available = {
		FROM = { has_completed_focus = JAP_modern_escorts }
	}
	
	initial_trait = {
		name = ROM_mio_trait_coastal_defense_production
	}
}

JAP_kawasaki_planes_organization = {
	include = generic_general_aircraft_organization
	icon = GFX_idea_kawasaki
	name = kawasaki
	
	allowed = { tag = JAP }
	
	available = {
		OR = { 
		    FROM = { has_completed_focus = JAP_unified_fighter_development }
		}
		
	}
} 

