# =========================================================
# 世界革命系统 - 脚本效果
# =========================================================

# 增加世界解放进度并重新计算动态修正变量
WR_add_liberation_progress = {
	# 增加进度值（默认+1，可通过 liberation_amount 覆盖）
	if = {
		limit = { 
			is_variable_defined = liberation_amount 
		}
		add_to_variable = { WR_liberation_progress = liberation_amount }
	}
	else = {
		add_to_variable = { WR_liberation_progress = 1 }
	}
	
	# 确保进度不超过6
	clamp_variable = {
		var = WR_liberation_progress
		min = 0
		max = 6
	}
	
	# 重新计算各项加成变量
	WR_recalculate_liberation_bonuses = yes
}

# 重新计算解放进度带来的各项加成
WR_recalculate_liberation_bonuses = {
	# 政治力量: 每阶段 +3% (最大 +18%)
	set_variable = { WR_liberation_pp_var = WR_liberation_progress }
	multiply_variable = { WR_liberation_pp_var = 0.03 }
	
	# 稳定度: 每阶段 +2.5% (最大 +15%)
	set_variable = { WR_liberation_stability_var = WR_liberation_progress }
	multiply_variable = { WR_liberation_stability_var = 0.025 }
	
	# 战争支持: 每阶段 +2.5% (最大 +15%)
	set_variable = { WR_liberation_war_support_var = WR_liberation_progress }
	multiply_variable = { WR_liberation_war_support_var = 0.025 }
	
	# 研究速度: 每阶段 +1.5% (最大 +9%)
	set_variable = { WR_liberation_research_var = WR_liberation_progress }
	multiply_variable = { WR_liberation_research_var = 0.015 }
	
	# 工厂产能: 每阶段 +1.5% (最大 +9%)
	set_variable = { WR_liberation_industry_var = WR_liberation_progress }
	multiply_variable = { WR_liberation_industry_var = 0.015 }
	
	# 陆军士气: 每阶段 +2% (最大 +12%)
	set_variable = { WR_liberation_morale_var = WR_liberation_progress }
	multiply_variable = { WR_liberation_morale_var = 0.02 }
}

# 初始化世界解放进度（在开始时调用）
WR_initialize_liberation_progress = {
	set_variable = { WR_liberation_progress = 0 }
	set_variable = { WR_liberation_pp_var = 0 }
	set_variable = { WR_liberation_stability_var = 0 }
	set_variable = { WR_liberation_war_support_var = 0 }
	set_variable = { WR_liberation_research_var = 0 }
	set_variable = { WR_liberation_industry_var = 0 }
	set_variable = { WR_liberation_morale_var = 0 }
}
