# Level down effects of shattered wehrmacht
GER_scenario_wehrmacht_level_down = {
		if = {
		limit = {
			has_idea = GER_shattered_wehrmacht_4
		}
		swap_ideas = {
			remove_idea = GER_shattered_wehrmacht_4
			add_idea = GER_renewed_wehrmacht
		}
	}
	else_if = {
		limit = {
			has_idea = GER_shattered_wehrmacht
		}
		swap_ideas = {
			remove_idea = GER_shattered_wehrmacht
			add_idea = GER_shattered_wehrmacht_2
		}
	}
	else_if = {
		limit = {
			has_idea = GER_shattered_wehrmacht_2
		}
		swap_ideas = {
			remove_idea = GER_shattered_wehrmacht_2
			add_idea = GER_shattered_wehrmacht_3
		}
	}
	else_if = {
		limit = {
			has_idea = GER_shattered_wehrmacht_3
		}
		swap_ideas = {
			remove_idea = GER_shattered_wehrmacht_3
			add_idea = GER_shattered_wehrmacht_4
		}
	}
}

# Level down effects of mass disloyalty
GER_scenario_disloyalty_level_down = {
		if = {
		limit = {
			has_idea = GER_disloyalty
		}
		remove_ideas = GER_disloyalty
	}
	else_if = {
		limit = {
			has_idea = GER_disloyalty_4
		}
		swap_ideas = {
			remove_idea = GER_disloyalty_4
			add_idea = GER_disloyalty_3
		}
	}
	else_if = {
		limit = {
			has_idea = GER_disloyalty_3
		}
		swap_ideas = {
			remove_idea = GER_disloyalty_3
			add_idea = GER_disloyalty_2
		}
	}
	else_if = {
		limit = {
			has_idea = GER_disloyalty_2
		}
		swap_ideas = {
			remove_idea = GER_disloyalty_2
			add_idea = GER_disloyalty
		}
	}
}


# Level up effects of shattered wehrmacht
GER_scenario_wehrmacht_level_up = {
	if = {
		limit = {
			has_idea = GER_shattered_wehrmacht_2
		}
		swap_ideas = {
			remove_idea = GER_shattered_wehrmacht_2
			add_idea = GER_shattered_wehrmacht
		}
	}
	else_if = {
		limit = {
			has_idea = GER_shattered_wehrmacht_3
		}
		swap_ideas = {
			remove_idea = GER_shattered_wehrmacht_3
			add_idea = GER_shattered_wehrmacht_2
		}
	}
	else_if = {
		limit = {
			has_idea = GER_shattered_wehrmacht_4
		}
		swap_ideas = {
			remove_idea = GER_shattered_wehrmacht_4
			add_idea = GER_shattered_wehrmacht_3
		}
	}
	else_if = {
		limit = {
			has_idea = GER_renewed_wehrmacht
		}
		swap_ideas = {
			remove_idea = GER_renewed_wehrmacht
			add_idea = GER_shattered_wehrmacht_4
		}
	}
}

# Level up effects of mass disloyalty
GER_scenario_disloyalty_level_up = {
		if = {
		limit = {
			has_idea = GER_disloyalty_3
		}
		swap_ideas = {
			remove_idea = GER_disloyalty_3
			add_idea = GER_disloyalty_4
		}
	}
	else_if = {
		limit = {
			has_idea = GER_disloyalty_2
		}
		swap_ideas = {
			remove_idea = GER_disloyalty_2
			add_idea = GER_disloyalty_3
		}
	}
	else_if = {
		limit = {
			has_idea = GER_disloyalty
		}
		swap_ideas = {
			remove_idea = GER_disloyalty
			add_idea = GER_disloyalty_2
		}
	}
}

# Level down effects of The Setting Sun
JAP_scenario_setting_sun_level_down = {
		if = {
		limit = {
			has_idea = JAP_shattered_army
		}
		remove_ideas = JAP_shattered_army
	}
	else_if = {
		limit = {
			has_idea = JAP_shattered_army_4
		}
		swap_ideas = {
			remove_idea = JAP_shattered_army_4
			add_idea = JAP_shattered_army_3
		}
	}
	else_if = {
		limit = {
			has_idea = JAP_shattered_army_3
		}
		swap_ideas = {
			remove_idea = JAP_shattered_army_3
			add_idea = JAP_shattered_army_2
		}
	}
	else_if = {
		limit = {
			has_idea = JAP_shattered_army_2
		}
		swap_ideas = {
			remove_idea = JAP_shattered_army_2
			add_idea = JAP_shattered_army
		}
	}
}

# Level up effects of The Setting Sun
JAP_scenario_setting_sun_level_up = {
		if = {
		limit = {
			has_idea = JAP_shattered_army_3
		}
		swap_ideas = {
			remove_idea = JAP_shattered_army_3
			add_idea = JAP_shattered_army_4
		}
	}
	else_if = {
		limit = {
			has_idea = JAP_shattered_army_2
		}
		swap_ideas = {
			remove_idea = JAP_shattered_army_2
			add_idea = JAP_shattered_army_3
		}
	}
	else_if = {
		limit = {
			has_idea = JAP_shattered_army
		}
		swap_ideas = {
			remove_idea = JAP_shattered_army
			add_idea = JAP_shattered_army_2
		}
	}
}

# Level down effects of Disaster at Leyte Gulf
JAP_scenario_disaster_leyte_gulf_level_down = {
	if = {
		limit = {
			has_idea = JAP_defeat_at_leyte_gulf_4
		}
		remove_ideas = JAP_defeat_at_leyte_gulf_4
	}
	else_if = {
		limit = {
			has_idea = JAP_defeat_at_leyte_gulf
		}
		swap_ideas = {
			remove_idea = JAP_defeat_at_leyte_gulf
			add_idea = JAP_defeat_at_leyte_gulf_2
		}
	}
	else_if = {
		limit = {
			has_idea = JAP_defeat_at_leyte_gulf_2
		}
		swap_ideas = {
			remove_idea = JAP_defeat_at_leyte_gulf_2
			add_idea = JAP_defeat_at_leyte_gulf_3
		}
	}
	else_if = {
		limit = {
			has_idea = JAP_defeat_at_leyte_gulf_3
		}
		swap_ideas = {
			remove_idea = JAP_defeat_at_leyte_gulf_3
			add_idea = JAP_defeat_at_leyte_gulf_4
		}
	}
}

JAP_modify_army_modifier = {
	if = {
		limit = { 
			has_dynamic_modifier = { modifier = JAP_army_modifier }
		}
		custom_effect_tooltip = JAP_modify_army_modifier_tt
	}
}

JAP_set_military_offensive_effect = {
	set_country_flag = JAP_military_offensive_in_progress_flag
			every_state = {
				limit = {
					state = 607
				}
				add_dynamic_modifier = {
					modifier = JAP_chinese_military_offensive
					days = 50
					scope = JAP
				}
			}	
}

JAP_set_military_offensive_effect_hunan = {
	set_country_flag = JAP_military_offensive_in_progress_flag
			every_state = {
				limit = {
					state = 602
				}
				add_dynamic_modifier = {
					modifier = JAP_chinese_military_offensive
					days = 30
					scope = JAP
				}
			}	
}

JAP_set_military_offensive_effect_guanxi = {
	set_country_flag = JAP_military_offensive_in_progress_flag
			every_state = {
				limit = {
					state = 599
				}
				add_dynamic_modifier = {
					modifier = JAP_chinese_military_offensive
					days = 30
					scope = JAP
				}
			}	
}

JAP_clean_military_offensive_effect = {
	clr_country_flag = JAP_military_offensive_in_progress_flag
		every_state = {
			limit = {
				OR = {
					state = 620
					state = 607
					state = 602
				}
			}
		remove_dynamic_modifier = { modifier = JAP_chinese_military_offensive }
	}
}

JAP_set_military_offensive_effect = {
			every_state = {
				limit = {
					OR = {
						state = 526
					}
				}
				add_dynamic_modifier = {
					modifier = JAP_okinawa_defense
					days = 50
					scope = JAP
				}
			}	
}
JAP_clean_military_offensive_effect = {
		every_state = {
			limit = {
				OR = {
					state = 526
				}
			}
		remove_dynamic_modifier = { modifier = JAP_okinawa_defense }
	}
}