# 朝鲜总督府边境战争决议
# 渡过图们江国策解锁后，允许对接壤的所有中国核心领土（CHI的核心）控制者发动边境战争
# 胜利方获得领土

CZD_border_war_category = {

	# ==========================================
	# 通用边境战争决议 - 自动检测所有接壤的CHI核心省份
	# ==========================================
	
	# 吉林边境战争 (328 - 与咸镜1028接壤) - CHI核心
	CZD_border_war_jilin = {
		icon = border_war
		
		allowed = { tag = CZD }
		
		visible = {
			has_completed_focus = CZD_cross_the_tumen
			328 = {
				is_core_of = CHI
				NOT = { is_controlled_by = ROOT }
			}
			1028 = { is_controlled_by = ROOT }
		}
		
		available = {
			has_war = no
			328 = { controller = { NOT = { tag = ROOT } } }
			NOT = { has_country_flag = CZD_border_war_active }
			divisions_in_state = {
				state = 1028
				size > 0
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 328
				state = 1028
			}
		}
		
		fire_only_once = no
		days_re_enable = 10
		
		cost = 25
		
		complete_effect = {
			set_country_flag = CZD_border_war_active
			set_variable = { CZD_border_war_target_state = 328 }
			set_variable = { CZD_border_war_attacker_state = 1028 }
			activate_mission = CZD_border_war_mission
			
			start_border_war = {
				change_state_after_war = yes
				combat_width = 120
				minimum_duration_in_days = 30
				
				attacker = {
					state = 1028
					num_provinces = 3
					on_win = CZD_border_war.1
					on_lose = CZD_border_war.2
					on_cancel = CZD_border_war.3
					
					leader_score = {
						base = 1
						modifier = { skill > 2 factor = 5 }
						modifier = { skill > 3 factor = 10 }
					}
					dig_in_factor = 0.5
					terrain_factor = 1.0
				}
				
				defender = {
					state = 328
					num_provinces = 3
					on_win = CZD_border_war.2
					on_lose = CZD_border_war.1
					on_cancel = CZD_border_war.3
				}
			}
		}
	}
	
	# 安东边境战争 (715 - 与平安527接壤) - CHI核心
	CZD_border_war_andong = {
		icon = border_war
		
		allowed = { tag = CZD }
		
		visible = {
			has_completed_focus = CZD_cross_the_tumen
			715 = {
				is_core_of = CHI
				NOT = { is_controlled_by = ROOT }
			}
			328 = { is_controlled_by = ROOT }
		}
		
		available = {
			has_war = no
			715 = { controller = { NOT = { tag = ROOT } } }
			NOT = { has_country_flag = CZD_border_war_active }
			divisions_in_state = {
				state = 328
				size > 0
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 715
				state = 328
			}
		}
		
		fire_only_once = no
		days_re_enable = 90
		
		cost = 25
		
		complete_effect = {
			set_country_flag = CZD_border_war_active
			set_variable = { CZD_border_war_target_state = 715 }
			set_variable = { CZD_border_war_attacker_state = 328 }
			activate_mission = CZD_border_war_mission
			
			start_border_war = {
				change_state_after_war = yes
				combat_width = 120
				minimum_duration_in_days = 30
				
				attacker = {
					state = 328
					num_provinces = 3
					on_win = CZD_border_war.1
					on_lose = CZD_border_war.2
					on_cancel = CZD_border_war.3
					
					leader_score = {
						base = 1
						modifier = { skill > 2 factor = 5 }
						modifier = { skill > 3 factor = 10 }
					}
					dig_in_factor = 0.5
					terrain_factor = 1.0
				}
				
				defender = {
					state = 715
					num_provinces = 3
					on_win = CZD_border_war.2
					on_lose = CZD_border_war.1
					on_cancel = CZD_border_war.3
				}
			}
		}
	}
	
	# 辽宁边境战争 (716 - 与安东715接壤，需要先获得安东) - CHI核心
	CZD_border_war_liaoning = {
		icon = border_war
		
		allowed = { tag = CZD }
		
		visible = {
			has_completed_focus = CZD_cross_the_tumen
			716 = {
				is_core_of = CHI
				NOT = { is_controlled_by = ROOT }
			}
			715 = { is_controlled_by = ROOT }
		}
		
		available = {
			has_war = no
			716 = { controller = { NOT = { tag = ROOT } } }
			NOT = { has_country_flag = CZD_border_war_active }
			divisions_in_state = {
				state = 715
				size > 0
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 716
				state = 715
			}
		}
		
		fire_only_once = no
		days_re_enable = 90
		
		cost = 25
		
		complete_effect = {
			set_country_flag = CZD_border_war_active
			set_variable = { CZD_border_war_target_state = 716 }
			set_variable = { CZD_border_war_attacker_state = 715 }
			activate_mission = CZD_border_war_mission
			
			start_border_war = {
				change_state_after_war = yes
				combat_width = 120
				minimum_duration_in_days = 30
				
				attacker = {
					state = 715
					num_provinces = 3
					on_win = CZD_border_war.1
					on_lose = CZD_border_war.2
					on_cancel = CZD_border_war.3
					
					leader_score = {
						base = 1
						modifier = { skill > 2 factor = 5 }
						modifier = { skill > 3 factor = 10 }
					}
					dig_in_factor = 0.5
					terrain_factor = 1.0
				}
				
				defender = {
					state = 716
					num_provinces = 3
					on_win = CZD_border_war.2
					on_lose = CZD_border_war.1
					on_cancel = CZD_border_war.3
				}
			}
		}
	}
	
	# 黑龙江边境战争 (717 - 与吉林328接壤，需要先获得吉林) - CHI核心
	CZD_border_war_heilongjiang = {
		icon = border_war
		
		allowed = { tag = CZD }
		
		visible = {
			has_completed_focus = CZD_cross_the_tumen
			717 = {
				is_core_of = CHI
				NOT = { is_controlled_by = ROOT }
			}
			328 = { is_controlled_by = ROOT }
		}
		
		available = {
			has_war = no
			717 = { controller = { NOT = { tag = ROOT } } }
			NOT = { has_country_flag = CZD_border_war_active }
			divisions_in_state = {
				state = 328
				size > 0
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 717
				state = 328
			}
		}
		
		fire_only_once = no
		days_re_enable = 90
		
		cost = 25
		
		complete_effect = {
			set_country_flag = CZD_border_war_active
			set_variable = { CZD_border_war_target_state = 717 }
			set_variable = { CZD_border_war_attacker_state = 328 }
			activate_mission = CZD_border_war_mission
			
			start_border_war = {
				change_state_after_war = yes
				combat_width = 120
				minimum_duration_in_days = 30
				
				attacker = {
					state = 328
					num_provinces = 3
					on_win = CZD_border_war.1
					on_lose = CZD_border_war.2
					on_cancel = CZD_border_war.3
					
					leader_score = {
						base = 1
						modifier = { skill > 2 factor = 5 }
						modifier = { skill > 3 factor = 10 }
					}
					dig_in_factor = 0.5
					terrain_factor = 1.0
				}
				
				defender = {
					state = 717
					num_provinces = 3
					on_win = CZD_border_war.2
					on_lose = CZD_border_war.1
					on_cancel = CZD_border_war.3
				}
			}
		}
	}
	
	# 北满边境战争 (714 - 与吉林328接壤) - CHI核心
	CZD_border_war_beiman = {
		icon = border_war
		
		allowed = { tag = CZD }
		
		visible = {
			has_completed_focus = CZD_cross_the_tumen
			714 = {
				is_core_of = CHI
				NOT = { is_controlled_by = ROOT }
			}
			328 = { is_controlled_by = ROOT }
		}
		
		available = {
			has_war = no
			714 = { controller = { NOT = { tag = ROOT } } }
			NOT = { has_country_flag = CZD_border_war_active }
			divisions_in_state = {
				state = 328
				size > 0
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 714
				state = 328
			}
		}
		
		fire_only_once = no
		days_re_enable = 90
		
		cost = 25
		
		complete_effect = {
			set_country_flag = CZD_border_war_active
			set_variable = { CZD_border_war_target_state = 714 }
			set_variable = { CZD_border_war_attacker_state = 328 }
			activate_mission = CZD_border_war_mission
			
			start_border_war = {
				change_state_after_war = yes
				combat_width = 120
				minimum_duration_in_days = 30
				
				attacker = {
					state = 328
					num_provinces = 3
					on_win = CZD_border_war.1
					on_lose = CZD_border_war.2
					on_cancel = CZD_border_war.3
					
					leader_score = {
						base = 1
						modifier = { skill > 2 factor = 5 }
						modifier = { skill > 3 factor = 10 }
					}
					dig_in_factor = 0.5
					terrain_factor = 1.0
				}
				
				defender = {
					state = 714
					num_provinces = 3
					on_win = CZD_border_war.2
					on_lose = CZD_border_war.1
					on_cancel = CZD_border_war.3
				}
			}
		}
	}
	
	# 外兴安岭边境战争 (761 - 与北满714接壤) - CHI核心
	CZD_border_war_waixinganling = {
		icon = border_war
		
		allowed = { tag = CZD }
		
		visible = {
			has_completed_focus = CZD_cross_the_tumen
			761 = {
				is_core_of = CHI
				NOT = { is_controlled_by = ROOT }
			}
			714 = { is_controlled_by = ROOT }
		}
		
		available = {
			has_war = no
			761 = { controller = { NOT = { tag = ROOT } } }
			NOT = { has_country_flag = CZD_border_war_active }
			divisions_in_state = {
				state = 714
				size > 0
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 761
				state = 714
			}
		}
		
		fire_only_once = no
		days_re_enable = 90
		
		cost = 25
		
		complete_effect = {
			set_country_flag = CZD_border_war_active
			set_variable = { CZD_border_war_target_state = 761 }
			set_variable = { CZD_border_war_attacker_state = 714 }
			activate_mission = CZD_border_war_mission
			
			start_border_war = {
				change_state_after_war = yes
				combat_width = 120
				minimum_duration_in_days = 30
				
				attacker = {
					state = 714
					num_provinces = 3
					on_win = CZD_border_war.1
					on_lose = CZD_border_war.2
					on_cancel = CZD_border_war.3
					
					leader_score = {
						base = 1
						modifier = { skill > 2 factor = 5 }
						modifier = { skill > 3 factor = 10 }
					}
					dig_in_factor = 0.5
					terrain_factor = 1.0
				}
				
				defender = {
					state = 761
					num_provinces = 3
					on_win = CZD_border_war.2
					on_lose = CZD_border_war.1
					on_cancel = CZD_border_war.3
				}
			}
		}
	}
	
	# 热河边境战争 (610 - 与辽宁716接壤) - CHI核心
	CZD_border_war_rehe = {
		icon = border_war
		
		allowed = { tag = CZD }
		
		visible = {
			has_completed_focus = CZD_cross_the_tumen
			610 = {
				is_core_of = CHI
				NOT = { is_controlled_by = ROOT }
			}
			716 = { is_controlled_by = ROOT }
		}
		
		available = {
			has_war = no
			610 = { controller = { NOT = { tag = ROOT } } }
			NOT = { has_country_flag = CZD_border_war_active }
			divisions_in_state = {
				state = 716
				size > 0
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 610
				state = 716
			}
		}
		
		fire_only_once = no
		days_re_enable = 90
		
		cost = 25
		
		complete_effect = {
			set_country_flag = CZD_border_war_active
			set_variable = { CZD_border_war_target_state = 610 }
			set_variable = { CZD_border_war_attacker_state = 716 }
			activate_mission = CZD_border_war_mission
			
			start_border_war = {
				change_state_after_war = yes
				combat_width = 120
				minimum_duration_in_days = 30
				
				attacker = {
					state = 716
					num_provinces = 3
					on_win = CZD_border_war.1
					on_lose = CZD_border_war.2
					on_cancel = CZD_border_war.3
					
					leader_score = {
						base = 1
						modifier = { skill > 2 factor = 5 }
						modifier = { skill > 3 factor = 10 }
					}
					dig_in_factor = 0.5
					terrain_factor = 1.0
				}
				
				defender = {
					state = 610
					num_provinces = 3
					on_win = CZD_border_war.2
					on_lose = CZD_border_war.1
					on_cancel = CZD_border_war.3
				}
			}
		}
	}
	
	


    # 察哈尔边境战争 (611 - 与热河610接壤) - CHI核心
	CZD_border_war_chahar = {
		icon = border_war
		
		allowed = { tag = CZD }
		
		visible = {
			has_completed_focus = CZD_cross_the_tumen
			611 = {
				is_core_of = CHI
				NOT = { is_controlled_by = ROOT }
			}
			610 = { is_controlled_by = ROOT }
		}
		
		available = {
			has_war = no
			611 = { controller = { NOT = { tag = ROOT } } }
			NOT = { has_country_flag = CZD_border_war_active }
			divisions_in_state = {
				state = 610
				size > 0
			}
		}
		
		highlight_states = {
			highlight_state_targets = {
				state = 611
				state = 610
			}
		}
		
		fire_only_once = no
		days_re_enable = 90
		
		cost = 25
		
		complete_effect = {
			set_country_flag = CZD_border_war_active
			set_variable = { CZD_border_war_target_state = 611 }
			set_variable = { CZD_border_war_attacker_state = 610 }
			activate_mission = CZD_border_war_mission
			
			start_border_war = {
				change_state_after_war = yes
				combat_width = 120
				minimum_duration_in_days = 30
				
				attacker = {
					state = 610
					num_provinces = 3
					on_win = CZD_border_war.1
					on_lose = CZD_border_war.2
					on_cancel = CZD_border_war.3
					
					leader_score = {
						base = 1
						modifier = { skill > 2 factor = 5 }
						modifier = { skill > 3 factor = 10 }
					}
					dig_in_factor = 0.5
					terrain_factor = 1.0
				}
				
				defender = {
					state = 611
					num_provinces = 3
					on_win = CZD_border_war.2
					on_lose = CZD_border_war.1
					on_cancel = CZD_border_war.3
				}
			}
		}
	}
	
	# ==========================================
	# 边境战争通用任务
	# ==========================================
	CZD_border_war_mission = {
		icon = border_war
		
		allowed = { always = no }
		
		available = {
			hidden_trigger = { always = no }
		}
		
		days_mission_timeout = 120
		
		cancel_trigger = {
			NOT = { has_country_flag = CZD_border_war_active }
		}
		
		cancel_effect = {
			clr_country_flag = CZD_border_war_active
		}
		
		timeout_effect = {
			clr_country_flag = CZD_border_war_active
		}
	}
}
