TR_AI_LAW_upgrade = {

	TR_AI_LAW_upgrade_economy_law = yes
	TR_AI_LAW_upgrade_conscription_law = yes
}

TR_AI_LAW_upgrade_economy_law = {

	if = {
		limit = {
			TR_AI_LAW_upgrade_economy_law = yes
		}

		set_temp_variable = { TR_AI_eco_law_cost = modifier@economy_cost_factor }
		add_to_temp_variable = { TR_AI_eco_law_cost = 1 }
		multiply_temp_variable = { TR_AI_eco_law_cost = 150 }

		if = { limit = { set_temp_variable = { _check_pp = TR_AI_eco_law_cost } TR_AI_PP_has_check_pp = yes }
		
			if = { limit = { TR_AI_LAW_get_partial_economic_mobilisation = yes }

				set_temp_variable = { _pp_cost = TR_AI_eco_law_cost }
				TR_AI_PP_pay_pp_cost = yes
				if = { limit = { has_country_flag = TR_AI_pp_logging } log = "SOURCE: TR_AI_LAW_upgrade_economy_law" }
				add_ideas = partial_economic_mobilisation
				
				if = { limit = { has_country_flag = TR_AI_law_logging } log = "[GetYear] [GetMonth] | AI | [Root.GetName] | ECONOMY LAW: partial_economic_mobilisation (script)" }
			}

			else_if = { limit = { TR_AI_LAW_get_war_economy = yes } 
		
				set_temp_variable = { _pp_cost = TR_AI_eco_law_cost }
				TR_AI_PP_pay_pp_cost = yes
				if = { limit = { has_country_flag = TR_AI_pp_logging } log = "SOURCE: TR_AI_LAW_upgrade_economy_law" }
				add_ideas = war_economy
				
				if = { limit = { has_country_flag = TR_AI_law_logging } log = "[GetYear] [GetMonth] | AI | [Root.GetName] | ECONOMY LAW: tot_economic_mobilisation (script)" }
			}

			else_if = { limit = { TR_AI_LAW_get_tot_economic_mobilisation = yes } 

				set_temp_variable = { _pp_cost = TR_AI_eco_law_cost }
				TR_AI_PP_pay_pp_cost = yes
				if = { limit = { has_country_flag = TR_AI_pp_logging } log = "SOURCE: TR_AI_LAW_upgrade_economy_law" }
				add_ideas = tot_economic_mobilisation
				
				if = { limit = { has_country_flag = TR_AI_law_logging } log = "[GetYear] [GetMonth] | AI | [Root.GetName] | ECONOMY LAW: tot_economic_mobilisation (script)" }
			}
	
		}
	}
}

TR_AI_LAW_upgrade_conscription_law = {

	if = {
		limit = {
			TR_AI_LAW_upgrade_manpower_law = yes
		}

		set_temp_variable = { TR_AI_man_law_cost = modifier@mobilization_laws_cost_factor }
		add_to_temp_variable = { TR_AI_man_law_cost = 1 }
		multiply_temp_variable = { TR_AI_man_law_cost = 150 }

		if = { limit = { set_temp_variable = { _check_pp = TR_AI_man_law_cost } TR_AI_PP_has_check_pp = yes } 
		
			if = { limit = { TR_AI_LAW_get_extensive_conscription = yes }
			
				set_temp_variable = { _pp_cost = TR_AI_man_law_cost }
				TR_AI_PP_pay_pp_cost = yes
				if = { limit = { has_country_flag = TR_AI_pp_logging } log = "SOURCE: EAI_LAW_upgrade_conscription_law" }
                add_ideas = extensive_conscription
				
				if = { limit = { has_country_flag = TR_AI_law_logging } log = "[GetYear] [GetMonth] | AI | [Root.GetName] | CONSCRIPTION LAW: extensive_conscription (script) current mp = [?manpower_k|0]k current army = [?deployed_army_manpower_k]k" } 
			}

			else_if = { limit = { TR_AI_LAW_get_service_by_requirement = yes }

				set_temp_variable = { _pp_cost = TR_AI_man_law_cost }
				TR_AI_PP_pay_pp_cost = yes
				if = { limit = { has_country_flag = TR_AI_pp_logging } log = "SOURCE: EAI_LAW_upgrade_conscription_law" }
                add_ideas = service_by_requirement
				
				if = { limit = { has_country_flag = TR_AI_law_logging } log = "[GetYear] [GetMonth] | AI | [Root.GetName] | CONSCRIPTION LAW: service_by_requirement (script) current mp = [?manpower_k|0]k current army = [?deployed_army_manpower_k]k" } 
			}

			else_if = { limit = { TR_AI_LAW_get_all_adults_serve = yes }

				set_temp_variable = { _pp_cost = TR_AI_man_law_cost }
				TR_AI_PP_pay_pp_cost = yes
				if = { limit = { has_country_flag = TR_AI_pp_logging } log = "SOURCE: EAI_LAW_upgrade_conscription_law" }
                add_ideas = all_adults_serve
				
				if = { limit = { has_country_flag = TR_AI_law_logging } log = "[GetYear] [GetMonth] | AI | [Root.GetName] | CONSCRIPTION LAW: all_adults_serve (script) current mp = [?manpower_k|0]k current army = [?deployed_army_manpower_k]k" } 
			}

		}
	}
}