# =========================================================
# 对日战争 决议组
# =========================================================
# 此决议组在CZD与日本处于战争期间可见
# 包含：请求与谈（成功率随时间增加）+ 支援抗战决议

CZD_war_with_japan_category = {

	# =========================================================
	# 1. 请求与日本和谈 (核心决议 - 成功率递增机制)
	# =========================================================
	CZD_request_peace_with_japan = {
		icon = GFX_decision_generic_political_power
		days_re_enable = 30
		cost = 50
		
		allowed = { tag = CZD }
		
		visible = {
			has_war_with = JAP
		}
		
		available = {
			has_political_power > 50
		}
		
		complete_effect = {
			# 记录一次请求，用于计算成功率
			add_to_variable = { var = CZD_peace_request_attempts value = 1 }
			
			# 触发事件，事件内部根据尝试次数计算成功概率
			country_event = { id = czd_warpeace.1 }
		}
		
		ai_will_do = { factor = 0 }
	}

	# =========================================================
	# 2. 支援决议 (可重复触发)
	# =========================================================
	
	# 2.1 运送补给给游击队
	CZD_send_supplies_to_resistance = {
		icon = GFX_decision_generic_arms_trade
		days_re_enable = 60
		cost = 30
		
		allowed = { tag = CZD }
		visible = { has_war_with = JAP }
		available = { has_political_power > 30 }
		
		complete_effect = {
			add_political_power = -25
			add_equipment_to_stockpile = { type = infantry_equipment_0 amount = 2000 }
			country_event = { id = czd_support.1 }
		}
		
	 
	}

	# 2.2 发送医疗援助
	CZD_send_medical_aid = {
		icon = GFX_decision_generic_research
		days_re_enable = 50
		cost = 20
		
		allowed = { tag = CZD }
		visible = { has_war_with = JAP }
		available = { has_political_power > 20 }
		
		complete_effect = {
			add_political_power = -20
			add_stability = 0.02
			add_war_support = 0.01
			country_event = { id = czd_support.2 }
		}
		
		ai_will_do = { factor = 3 }
	}

	# 2.3 资助流亡抗日组织 - 在敌后建立游击队网络
	CZD_fund_exiled_resistance = {
		icon = GFX_decision_generic_form_nation
		days_re_enable = 100
		cost = 75
		
		allowed = { tag = CZD }
		visible = { has_war_with = JAP }
		available = { 
			has_political_power > 75
			has_manpower > 5000
		}
		
		complete_effect = {
			add_political_power = -75
			add_manpower = -1000
			
			# 记录资助次数
			if = {
				limit = { NOT = { has_variable = CZD_resistance_network_level } }
				set_variable = { CZD_resistance_network_level = 0 }
			}
			add_to_variable = { CZD_resistance_network_level = 1 }
			
			# 根据资助次数给予不同效果
			if = {
				limit = { check_variable = { CZD_resistance_network_level < 3 } }
				# 初级网络：小规模破坏
				JAP = {
					add_timed_idea = {
						idea = CZD_resistance_sabotage_1
						days = 90
					}
				}
				country_event = { id = czd_support.3 }
			}
			else_if = {
				limit = { check_variable = { CZD_resistance_network_level < 6 } }
				# 中级网络：显著破坏 + 情报优势
				JAP = {
					add_timed_idea = {
						idea = CZD_resistance_sabotage_2
						days = 120
					}
				}
				add_timed_idea = {
					idea = CZD_intelligence_advantage
					days = 120
				}
				country_event = { id = czd_support.4 }
			}
			else = {
				# 高级网络：大规模破坏 + 可能引发起义
				JAP = {
					add_timed_idea = {
						idea = CZD_resistance_sabotage_3
						days = 150
					}
				}
				add_timed_idea = {
					idea = CZD_intelligence_advantage
					days = 150
				}
				# 有概率在敌占区触发起义
				random_list = {
					60 = { country_event = { id = czd_support.5 } }
					40 = { country_event = { id = czd_support.6 } }
				}
			}
		}
		
		ai_will_do = { factor = 3 }
	}

	# 2.4 策反伪军 - 瓦解敌人兵力
	CZD_subvert_collaborator_troops = {
		icon = GFX_decision_generic_secret_deal
		days_re_enable = 90
		cost = 100
		
		allowed = { tag = CZD }
		visible = { 
			has_war_with = JAP
			has_variable = CZD_resistance_network_level
			check_variable = { CZD_resistance_network_level > 2 }
		}
		available = { 
			has_political_power > 100
			has_army_manpower = { size > 50000 }
		}
		
		complete_effect = {
			add_political_power = -100
			
			# 策反成功，获得部队
			random_list = {
				70 = {
					# 成功策反
					add_manpower = 10000
					army_experience = 10
					country_event = { id = czd_support.10 }
				}
				30 = {
					# 策反失败，损失情报人员
					add_manpower = -2000
					add_stability = -0.02
					country_event = { id = czd_support.11 }
				}
			}
		}
		
		ai_will_do = { factor = 2 }
	}

	# 2.5 发动敌后总攻势 - 终极决议
	CZD_launch_rear_offensive = {
		icon = GFX_decision_generic_nationalism
		
		allowed = { tag = CZD }
		visible = { 
			has_war_with = JAP
			has_variable = CZD_resistance_network_level
			check_variable = { CZD_resistance_network_level > 5 }
		}
		available = { 
			has_political_power > 150
			has_manpower > 20000
			custom_trigger_tooltip = {
				tooltip = CZD_resistance_network_ready_tt
				check_variable = { CZD_resistance_network_level > 5 }
			}
		}
		
		fire_only_once = yes
		cost = 150
		
		complete_effect = {
			add_political_power = -150
			add_manpower = -2000
			
			# 敌后总攻势效果
			JAP = {
				add_timed_idea = {
					idea = CZD_rear_offensive_chaos
					days = 180
				}
				add_stability = -0.15
				add_war_support = -0.10
			}
			
			# 我方获得进攻加成
			add_timed_idea = {
				idea = CZD_final_offensive_momentum
				days = 180
			}
			
			country_event = { id = czd_support.20 }
		}
		
		ai_will_do = { factor = 5 }
	}

}
