ability = {
	force_attack = {
		name = ABILITY_FORCE_ATTACK
		desc = ABILITY_FORCE_ATTACK_DESC
		
		sound_effect = command_power_ability_offensive
		
		type = army_leader
		
		allowed = {
			is_leading_army_group = no
			is_border_war = no
			OWNER = {
				if = {
					limit = {
						has_dlc = "Waking the Tiger"
					}
					NOT = { 
						has_completed_focus = CHI_dare_to_die_corps 
						has_completed_focus = JAP_advance_one_hundred_million_fireballs  
						has_completed_focus = JAP_tennoheika_banzai  
						has_completed_focus = CHI_sea_dare_to_die_corps  
					}
				}

				if = {
					limit = {
						has_dlc = "No Compromise, No Surrender"
					}
					NOT = { 
						has_completed_focus = CHI_know_thy_enemy
					}
				}
			}
		}
		
		ai_will_do = { #EAI
			base = -1

			modifier = {
				FROM = {
					EAI_MILITARY_ABILITY_force_attack = yes
				}

				set_temp_variable = { tmp = num_units_offensive_combats }
				divide_temp_variable = { tmp = num_units }
				check_variable = { tmp > 0.1 }

				add = 1000
			}

			modifier = {
				FROM = {
					EAI_MILITARY_ABILITY_force_attack_HOLD = yes
				}

				add = -2000
			}

			modifier = {
				FROM = {
					has_war_support > 0.8
					NOT = { has_country_flag = EAI_MILITARY_trend_losing_war }
				}

				set_temp_variable = { tmp = num_units_offensive_combats }
				divide_temp_variable = { tmp = num_units }
				check_variable = { tmp > 0.5 }
				check_variable = { avg_offensive_combat_status < 0.5 }
				
				add = 2
			}

			modifier = {
				add = -2

				FROM = {
					has_country_flag = EAI_MILITARY_trend_losing_war
					original_tag = SOV
					has_war_with = GER
				}

				date < 1943.1.1
			}
		}
		
		cost = 0.22
		duration = 168
		
		one_time_effect = {
			add_temporary_buff_to_units = {
				combat_offense = 0.2
				combat_breakthrough = 0.25
				org_damage_multiplier = -1.0
				str_damage_multiplier = 0.6
				war_support_reduction_on_damage = 0.2
				cannot_retreat_while_attacking = 1.0
				
				days = 7
				tooltip = ABILITY_FORCE_ATTACK_TOOLTIP
			}
		}
	}
		
	last_stand = {
		name = ABILITY_LAST_STAND
		desc = ABILITY_LAST_STAND_DESC
		
		sound_effect = command_power_ability_offensive
		
		type = army_leader
		
		allowed = {
			is_leading_army_group = no
			is_border_war = no
			OWNER = {
				NOT = {
					has_completed_focus = JAP_warrior_spirit
					has_completed_focus = SPA_cultivate_fanaticism
					has_completed_focus = SWE_winter_drill
					has_completed_focus = JAP_issue_the_senjinkun_military_code
					has_completed_focus = JAP_indoctrination_in_the_military_academy
					has_completed_focus = PHI_utang_na_loob
				}
			}
		}
		
		cost = 0.22
		duration = 168
		
		one_time_effect = {
			add_temporary_buff_to_units = {
				combat_defense = 0.2
				combat_entrenchment = 0.25
				org_damage_multiplier = -1.0
				str_damage_multiplier = 0.6
				war_support_reduction_on_damage = 0.2
				cannot_retreat_while_defending = 1.0
				
				days = 7
				tooltip = ABILITY_LAST_STAND_TOOLTIP
			}
		}
		
		ai_will_do = { #EAI
			base = -1

			modifier = {
				FROM = {
					EAI_MILITARY_ABILITY_last_stand = yes
				}

				set_temp_variable = { tmp = num_units_defensive_combats }
				divide_temp_variable = { tmp = num_units }
				check_variable = { tmp > 0.1 }

				add = 2
			}

			modifier = {
				FROM = {
					EAI_MILITARY_ABILITY_last_stand_HOLD = yes
				}

				add = -2000
			}

			modifier = {
				FROM = {
					has_war_support > 0.8
					has_country_flag = EAI_MILITARY_trend_losing_war
				}

				set_temp_variable = { tmp = num_units_defensive_combats }
				divide_temp_variable = { tmp = num_units }
				check_variable = { tmp > 0.5 }
				check_variable = { avg_defensive_combat_status < 0.5 }
				
				add = 2
			}
			
			modifier = {
				add = -2

				FROM = {
					original_tag = GER
					has_war_with = SOV
					NOT = { has_country_flag = EAI_MILITARY_trend_losing_war }
				}

				date < 1943.1.1
			}

			modifier = { # ethiopia too op
				add = -2

				FROM = {
					date < 1940.1.1
					original_tag = ETH
					has_war_with = ITA
					ITA = { is_ai = yes }
				}
			}
		}
	}
	
	staff_office_plan = {
		name = ABILITY_STAFF_OFFICE_PLAN
		desc = ABILITY_STAFF_OFFICE_PLAN_DESC
		
		sound_effect = command_power_ability_defensive
		
		type = army_leader
		
		allowed = {
			is_border_war = no
			OWNER = {
				NOT = {
					has_completed_focus = JAP_the_art_of_warfare
				}
			}
		}
		
		cost = 0.12
		duration = 168
		
		unit_modifiers = {
			planning_speed = 4.0
		}
		
		
		ai_will_do = { #EAI
			base = -1

			modifier = {
				FROM = {
					EAI_MILITARY_ABILITY_staff_office_plan = yes
				}

				add = 1000
			}

			modifier = {
				FROM = {
					EAI_MILITARY_ABILITY_staff_office_plan_HOLD = yes
				}

				add = -2000
			}

			modifier = {
				add = 2

				FROM = {
					command_power > 50
				}

				check_variable = { avg_unit_planning_ratio < 0.5 }
				check_variable = { unit_ratio_ready_for_plan > 0.5 }
			}
		}
	}
	
	
	siege_artillery = {
		name = ABILITY_SIEGE_ARTILLERY
		desc = ABILITY_SIEGE_ARTILLERY_DESC
		
		type = army_leader
		
		allowed = {
			has_ability = siege_artillery
			is_border_war = no
		}
		
		unit_modifiers = {
			fort = {
				attack = 0.2
			}
			fortification_damage = 2.0
			fortification_collateral_chance = 2.0
		}
		cost = 0.1
		duration = 168
		
		
		ai_will_do = { #EAI
			base = -1

			modifier = {
				FROM = {
					has_country_flag = EAI_MILITARY_ABILITY_siege_artillery
				}

				add = 10
			}

			modifier = {
				FROM = {
					command_power > 30
				}
				
				set_temp_variable = { temp = num_units_offensive_combats }
				check_variable = { temp > 6 }
				set_temp_variable = { temp2 = num_units_offensive_combats_against@fort }
				divide_temp_variable = { temp2 = temp }
				check_variable = { temp2 > 0.5 }
				
				add = 2
			}
		}
	}
	
	glider_planes = {
		name = ABILITY_GLIDER_PLANES_ARTILLERY
		desc = ABILITY_GLIDER_PLANES_ARTILLERY_DESC
		
		type = army_leader
		
		allowed = {
			has_ability = glider_planes
			is_border_war = no
		}
		
		unit_modifiers = {
			paratrooper_weight_factor = -0.10
			paradrop_organization_factor = 2.0
			paratrooper_aa_defense = 0.5
		}
		
		cost = 0.1
		duration = 168

		ai_will_do = { #EAI
			base = -1
		}
	}
	faster_naval_invasion_planning = {
		name = ABILITY_FASTER_NAVAL_PLANNING
		desc = ABILITY_FASTER_NAVAL_PLANNING_DESC
		
		type = army_leader
		
		allowed = {
			has_ability = faster_naval_invasion_planning
			is_border_war = no
		}
		
		unit_modifiers = {
			naval_invasion_prep_speed = 0.5
		}
		
		cost = 0.1
		duration = 168

		ai_will_do = { #EAI
			base = -1
		}
	}
	
	probing_attack = {
		name = ABILITY_PROBING_ATTACK
		desc = ABILITY_PROBING_ATTACK_DESC
		
		type = army_leader
		
		allowed = {
			has_ability = probing_attack
			is_border_war = no
		}
		
		unit_modifiers = {
			dont_lose_dig_in_on_attack = 1.0
			offence = -0.2
		}
		
		cancelable = yes
		cost = 0.1
		duration = -1

		ai_will_do = { #EAI
			base = -1
		}
	}
	
	makeshift_bridges = {
		name = ABILITY_MAKESHIFT_BRIDGES
		desc = ABILITY_MAKESHIFT_BRIDGES_DESC
		
		type = army_leader
		
		allowed = {
			has_ability = makeshift_bridges
			is_border_war = no
		}
		
		
		unit_modifiers = {
			river_crossing_factor = -0.4
			river = {
				attack = 0.2
			}
		}
		
		cost = 0.1
		duration = 168
		
		ai_will_do = { #EAI
			base = -1
			modifier = {
				FROM = {
					command_power > 30
				}
				check_variable = { num_units_crossing_river > 5 }
				
				add = 2
			}
		}
	}
	
	extra_suplies = {
		name = ABILITY_EXTRA_SUPLIES
		desc = ABILITY_EXTRA_SUPLIES_DESC
		
		type = army_leader
		
		allowed = {
			has_ability = extra_suplies
			is_border_war = no
			OWNER = {
				NOT = { has_country_flag = has_quinine }
			}
		}
		
		unit_modifiers = {
			no_supply_grace = 168
		}
		
		one_time_effect = {
			supply_units = 168
		}
		
		cost = 0.2
		duration = 168
		cooldown = 504

		ai_will_do = { #EAI
			base = -1

			modifier = {
				add = 2

				FROM = {
					command_power > 50
				}
			}
		}
	}
	
	requisition_winter_gear = {
		name = ABILITY_REQUISITION_WINTER_GEAR
		desc = ABILITY_REQUISITION_WINTER_GEAR_DESC
		
		type = army_leader
		
		allowed = {
			has_ability = requisition_winter_gear
			is_border_war = no
		}
		
		unit_modifiers = {
			acclimatization_cold_climate_gain_factor = 0.5
		}
		
		cost = 0.1
		duration = 168
		
		ai_will_do = { #EAI
			base = -1

			modifier = {
				FROM = {
					command_power > 50
				}
				check_variable = { num_units_on_climate@cold_climate > 8 }
				set_temp_variable = { temp = avg_units_acclimation@cold_climate }
				divide_temp_variable = { temp =  num_units }
				check_variable = { temp < 0.5 }
				
				add = 2
			}
		}
	}
}