# 朝鲜总督府联合作战决议
# 完成"大陆联合反攻"国策后解锁
# 必须与CHI或PRC结盟才能使用

CZD_joint_offensive_category = {
	
	icon = generic_military
	
	allowed = {
		tag = CZD
	}
	
	visible = {
		has_country_flag = CZD_continental_counter_offensive_unlocked
		OR = {
			is_in_faction_with = CHI
			is_in_faction_with = PRC
		}
	}

	# ==========================================
	# 1. 请求志愿军支援
	# ==========================================
	CZD_request_chinese_volunteers = {
		icon = generic_army_support
		
		allowed = { tag = CZD }
		
		visible = {
			has_country_flag = CZD_continental_counter_offensive_unlocked
			OR = {
				is_in_faction_with = CHI
				is_in_faction_with = PRC
			}
			has_war = yes
		}
		
		available = {
			has_war = yes
			NOT = { has_country_flag = CZD_chinese_volunteers_active }
			OR = {
				AND = {
					is_in_faction_with = CHI
					CHI = { has_manpower > 100000 }
				}
				AND = {
					is_in_faction_with = PRC
					PRC = { has_manpower > 100000 }
				}
			}
		}
		
		cost = 50
		
		days_re_enable = 180
		
		ai_will_do = {
			base = 10
			modifier = {
				factor = 2
				surrender_progress > 0.1
			}
		}
		
		complete_effect = {
			set_country_flag = { flag = CZD_chinese_volunteers_active days = 90 }
			
			# 获得人力
			add_manpower = 30000
			
			# 获得临时精神
			add_timed_idea = {
				idea = CZD_chinese_volunteer_forces
				days = 90
			}
			
			custom_effect_tooltip = CZD_chinese_volunteers_tt
		}
	}
	
	# ==========================================
	# 2. 请求装备援助
	# ==========================================
	CZD_request_equipment_aid = {
		icon = generic_industry
		
		allowed = { tag = CZD }
		
		visible = {
			has_country_flag = CZD_continental_counter_offensive_unlocked
			OR = {
				is_in_faction_with = CHI
				is_in_faction_with = PRC
			}
		}
		
		available = {
			NOT = { has_country_flag = CZD_equipment_aid_cooldown }
			OR = {
				AND = {
					is_in_faction_with = CHI
					CHI = { has_equipment = { infantry_equipment > 2000 } }
				}
				AND = {
					is_in_faction_with = PRC
					PRC = { has_equipment = { infantry_equipment > 2000 } }
				}
			}
		}
		
		cost = 25
		
		days_re_enable = 120
		
		ai_will_do = {
			base = 5
			modifier = {
				factor = 3
				has_equipment = { infantry_equipment < 1000 }
			}
		}
		
		complete_effect = {
			set_country_flag = { flag = CZD_equipment_aid_cooldown days = 120 }
			
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = 3000
				producer = CHI
			}
			add_equipment_to_stockpile = {
				type = support_equipment
				amount = 300
				producer = CHI
			}
			
			custom_effect_tooltip = CZD_equipment_aid_tt
		}
	}
	
	# ==========================================
	# 3. 协同进攻计划 - 针对特定省份
	# ==========================================
	CZD_coordinated_offensive = {
		icon = GFX_decision_border_war
		
		allowed = { tag = CZD }
		
		visible = {
			has_country_flag = CZD_continental_counter_offensive_unlocked
			OR = {
				is_in_faction_with = CHI
				is_in_faction_with = PRC
			}
			has_war_with = JAP
		}
		
		available = {
			has_war_with = JAP
			command_power > 25
			NOT = { has_country_flag = CZD_coordinated_offensive_active }
		}
		
		custom_cost_trigger = {
			command_power > 24.9
		}
		custom_cost_text = decision_cost_command_power_25
		
		days_re_enable = 60
		
		ai_will_do = {
			base = 10
			modifier = {
				factor = 2
				has_war_with = JAP
			}
		}
		
		complete_effect = {
			add_command_power = -25
			set_country_flag = { flag = CZD_coordinated_offensive_active days = 30 }
			
			# 临时进攻加成
			add_timed_idea = {
				idea = CZD_coordinated_offensive_bonus
				days = 30
			}
			
			custom_effect_tooltip = CZD_coordinated_offensive_tt
		}
	}
	
	# ==========================================
	# 4. 情报共享 - 获取对敌人的情报优势
	# ==========================================
	CZD_intelligence_sharing = {
		icon = generic_intel
		
		allowed = { tag = CZD }
		
		visible = {
			has_country_flag = CZD_continental_counter_offensive_unlocked
			OR = {
				is_in_faction_with = CHI
				is_in_faction_with = PRC
			}
			has_war = yes
		}
		
		available = {
			has_war = yes
			NOT = { has_country_flag = CZD_intelligence_sharing_active }
			OR = {
				AND = {
					is_in_faction_with = CHI
					CHI = { has_war_with = JAP }
				}
				AND = {
					is_in_faction_with = PRC
					PRC = { has_war_with = JAP }
				}
			}
		}
		
		cost = 35
		
		days_re_enable = 90
		
		ai_will_do = {
			base = 8
		}
		
		complete_effect = {
			set_country_flag = { flag = CZD_intelligence_sharing_active days = 60 }
			
			# 情报加成
			add_timed_idea = {
				idea = CZD_shared_intelligence
				days = 60
			}
			
			# 对日本的情报网络
			if = {
				limit = { has_war_with = JAP }
				JAP = {
					add_timed_idea = {
						idea = CZD_infiltrated_networks
						days = 60
					}
				}
			}
			
			custom_effect_tooltip = CZD_intelligence_sharing_tt
		}
	}
	
	# ==========================================
	# 5. 联合海上封锁 - 需要海军配合
	# ==========================================
	CZD_joint_naval_blockade = {
		icon = generic_naval
		
		allowed = { tag = CZD }
		
		visible = {
			has_country_flag = CZD_continental_counter_offensive_unlocked
			OR = {
				is_in_faction_with = CHI
				is_in_faction_with = PRC
			}
			has_war_with = JAP
			has_navy_size = { size > 10 }
		}
		
		available = {
			has_war_with = JAP
			NOT = { has_country_flag = CZD_naval_blockade_active }
			has_navy_size = { size > 10 }
		}
		
		cost = 50
		
		days_re_enable = 180
		
		ai_will_do = {
			base = 5
			modifier = {
				factor = 2
				has_navy_size = { size > 30 }
			}
		}
		
		complete_effect = {
			set_country_flag = { flag = CZD_naval_blockade_active days = 120 }
			
			# 对日本的海上封锁效果
			JAP = {
				add_timed_idea = {
					idea = CZD_naval_blockade_effect
					days = 120
				}
			}
			
			custom_effect_tooltip = CZD_naval_blockade_tt
		}
	}
	
	# ==========================================
	# 6. 总攻击令 - 最终决战
	# ==========================================
	CZD_final_offensive = {
		icon = generic_ignite_civil_war
		
		allowed = { tag = CZD }
		
		visible = {
			has_country_flag = CZD_continental_counter_offensive_unlocked
			OR = {
				is_in_faction_with = CHI
				is_in_faction_with = PRC
			}
			has_war_with = JAP
		}
		
		available = {
			has_war_with = JAP
			command_power > 75
			NOT = { has_country_flag = CZD_final_offensive_launched }
			# 需要一定的战争进展
			JAP = {
				surrender_progress > 0.25
			}
		}
		
		fire_only_once = yes
		
		custom_cost_trigger = {
			command_power > 74.9
		}
		custom_cost_text = decision_cost_command_power_75
		
		ai_will_do = {
			base = 100
		}
		
		complete_effect = {
			add_command_power = -75
			set_country_flag = CZD_final_offensive_launched
			
			# 强力临时加成
			add_timed_idea = {
				idea = CZD_final_offensive_spirit
				days = 60
			}
			
			# 所有阵营成员也获得加成
			every_country = {
				limit = {
					is_in_faction_with = ROOT
					has_war_with = JAP
					NOT = { tag = ROOT }
				}
				add_timed_idea = {
					idea = CZD_allied_final_push
					days = 60
				}
			}
			
			# 战争支持度大增
			add_war_support = 0.10
			
			custom_effect_tooltip = CZD_final_offensive_tt
		}
	}
}
