# =====================================================
# 世界革命 - 联合国策�?
# 朝鲜与苏联共�?
# =====================================================

# 为CZD添加世界革命国策�?
focus_tree = {
	id = world_revolution_focus_czd
	
	country = {
		factor = 0
		modifier = {
			add = 10
			tag = CZD
		}
	}
	
	# 不作为默认国策树
	default = no
	reset_on_civil_war = no

	shared_focus = WR_world_revolution
	shared_focus = WR_revolutionary_front
	shared_focus = WR_revolutionary_rear
	shared_focus = WR_liberate_asia
	shared_focus = WR_liberate_europe
	shared_focus = WR_liberate_japan
	shared_focus = WR_liberate_china
	shared_focus = WR_liberate_southeast_asia
	shared_focus = WR_liberate_india
	shared_focus = WR_liberate_germany
	shared_focus = WR_liberate_france
	shared_focus = WR_liberate_italy
	shared_focus = WR_liberate_iberia
	shared_focus = WR_asia_liberated
	shared_focus = WR_europe_liberated
	shared_focus = WR_military_aid_program
	shared_focus = WR_technology_sharing
	shared_focus = WR_ideology_export
	shared_focus = WR_comintern_broadcast
	shared_focus = WR_liberate_americas
	shared_focus = WR_liberate_africa
	shared_focus = WR_liberate_oceania
	shared_focus = WR_end_of_capitalism
}

# =====================================================
# 共享国策定义
# =====================================================

# =========================================================
# 第一层：世界革命起点
# =========================================================

shared_focus = {
	id = WR_world_revolution
	icon = GFX_WR_world_revolution
	x = 35
	y = 15
	cost = 10
	
	available = {
		is_subject = no
		has_government = communism
		if = {
			limit = { tag = CZD }
			NOT = { has_completed_focus = CZD_memories_of_ancient_borders }
		}
	}
	
	bypass = {
	}
	
	cancel_if_invalid = yes
	continue_if_invalid = no
	
	ai_will_do = {
		factor = 10
	}
	
	completion_reward = {
		set_rule = { can_create_factions = yes }
		add_political_power = 100
		add_war_support = 0.10
		add_stability = 0.05
		
		# 设置世界革命标记
		set_country_flag = WR_world_revolution_started
		
		# 初始化世界解放进度变量
		WR_initialize_liberation_progress = yes
		
		# 通知盟友
		every_country = {
			limit = {
				has_government = communism
				NOT = { tag = ROOT }
			}
			country_event = { id = wr_event.1 days = 1 }
		}
		
		custom_effect_tooltip = WR_world_revolution_tt
	}
}

# =========================================================
# 第二层：前线与后�?
# =========================================================

shared_focus = {
	id = WR_revolutionary_front
	icon = GFX_WR_revolutionary_front
	x = -5
	y = 1
	relative_position_id = WR_world_revolution
	prerequisite = { focus = WR_world_revolution }
	cost = 7
	
	ai_will_do = {
		factor = 10
		modifier = {
			factor = 2
			tag = CZD
		}
	}
	
	completion_reward = {
		add_war_support = 0.15
		army_experience = 50
		
		# 解放战争准备
		add_doctrine_cost_reduction = {
			name = WR_front_doctrine_bonus
			cost_reduction = 0.5
			uses = 2
			category = land_doctrine
		}
		
		custom_effect_tooltip = WR_front_line_tt
	}
}

shared_focus = {
	id = WR_revolutionary_rear
	icon = GFX_WR_revolutionary_rear
	x = 5
	y = 1
	relative_position_id = WR_world_revolution
	prerequisite = { focus = WR_world_revolution }
	cost = 7
	
	ai_will_do = {
		factor = 10
		modifier = {
			factor = 2
			tag = SOV
		}
	}
	
	completion_reward = {
		# 本国承受牺牲
		add_ideas = WR_rear_base_construction
		
		# 兄弟国家获得增益
		every_country = {
			limit = {
				has_government = communism
				is_in_faction_with = ROOT
				NOT = { tag = ROOT }
			}
			add_ideas = WR_rear_base_support
			country_event = { id = wr_solidarity.1 days = 1 }
		}
		
		# 广播新闻
		news_event = { id = wr_news.1 hours = 6 }
		
		custom_effect_tooltip = WR_rear_base_tt
	}
}

# =========================================================
# 第三层：解放亚洲/欧洲 总纲
# =========================================================

shared_focus = {
	id = WR_liberate_asia
	icon = GFX_WR_liberate_asia
	x = -3
	y = 1
	relative_position_id = WR_revolutionary_front
	prerequisite = { focus = WR_revolutionary_front }
	cost = 7
	
	ai_will_do = {
		factor = 10
		modifier = {
			factor = 3
			tag = CZD
		}
	}
	
	completion_reward = {
		add_political_power = 50
		add_war_support = 0.05
		
		# 解锁亚洲革命决议类别
		set_country_flag = WR_asia_liberation_unlocked
		
		custom_effect_tooltip = WR_asia_liberation_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.1 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_europe
	icon = GFX_WR_liberate_europe
	x = 3
	y = 1
	relative_position_id = WR_revolutionary_front
	prerequisite = { focus = WR_revolutionary_front }
	cost = 7
	
	ai_will_do = {
		factor = 10
		modifier = {
			factor = 3
			tag = SOV
		}
	}
	
	completion_reward = {
		add_political_power = 50
		add_war_support = 0.05
		
		# 解锁欧洲革命决议类别
		set_country_flag = WR_europe_liberation_unlocked
		
		custom_effect_tooltip = WR_europe_liberation_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.2 days = 1 }
	}
}

# =========================================================
# 第四层：亚洲具体目标
# =========================================================

shared_focus = {
	id = WR_liberate_japan
	icon = GFX_WR_liberate_japan
	x = -3
	y = 1
	relative_position_id = WR_liberate_asia
	prerequisite = { focus = WR_liberate_asia }
	cost = 10
	
	available = {
		JAP = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	bypass = {
		JAP = { has_government = communism }
	}
	
	ai_will_do = {
		factor = 10
		modifier = {
			factor = 5
			tag = CZD
		}
	}
	
	completion_reward = {
		# 解锁支援日本革命决议
		set_country_flag = WR_japan_revolution_unlocked
		
		# 初始化日本革命等级
		if = {
			limit = { NOT = { has_variable = WR_japan_revolution_level } }
			set_variable = { WR_japan_revolution_level = 0 }
		}
		
		custom_effect_tooltip = WR_japan_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.3 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_china
	icon = GFX_WR_liberate_china
	x = -1
	y = 1
	relative_position_id = WR_liberate_asia
	prerequisite = { focus = WR_liberate_asia }
	cost = 10
	
	available = {
		OR = {
			CHI = {
				exists = yes
				NOT = { has_government = communism }
			}
			# 其他中国军阀
			any_country = {
				is_in_faction_with = CHI
				NOT = { has_government = communism }
			}
		}
	}
	
	bypass = {
		CHI = { has_government = communism }
		PRC = { exists = yes }
	}
	
	ai_will_do = {
		factor = 8
	}
	
	completion_reward = {
		set_country_flag = WR_china_revolution_unlocked
		
		if = {
			limit = { NOT = { has_variable = WR_china_revolution_level } }
			set_variable = { WR_china_revolution_level = 0 }
		}
		
		custom_effect_tooltip = WR_china_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.4 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_southeast_asia
	icon = GFX_WR_liberate_southeast_asia
	x = 1
	y = 1
	relative_position_id = WR_liberate_asia
	prerequisite = { focus = WR_liberate_asia }
	cost = 10
	
	ai_will_do = {
		factor = 6
	}
	
	completion_reward = {
		set_country_flag = WR_sea_revolution_unlocked
		
		# 向英国发送解放缅甸的要求（缅甸可能是英属印度的一部分或独立傀儡）
		if = {
			limit = {
				ENG = {
					exists = yes
					NOT = { has_war_with = ROOT }
				}
				OR = {
					# 英国直接拥有缅甸
					ENG = {
						OR = {
							owns_state = 288  # 缅甸
							owns_state = 640  # 掸邦
						}
					}
					# 缅甸作为英国傀儡存在
					AND = {
						BRM = { exists = yes }
						BRM = { is_subject_of = ENG }
					}
					# 英属印度拥有缅甸（早期开局）
					AND = {
						RAJ = { exists = yes }
						RAJ = { is_subject_of = ENG }
						RAJ = {
							OR = {
								owns_state = 288
								owns_state = 640
							}
						}
					}
				}
			}
			ENG = {
				country_event = { id = wr_ultimatum.1 days = 3 }
			}
		}
		
		# 向法国发送解放印度支那的要求
		if = {
			limit = {
				FRA = {
					exists = yes
					NOT = { has_war_with = ROOT }
				}
				OR = {
					# 法国直接拥有印度支那
					FRA = {
						OR = {
							owns_state = 286  # 老挝
							owns_state = 670  # 越南北部
							owns_state = 671  # 越南南部
							owns_state = 741  # 柬埔寨
						}
					}
					# 印度支那作为法国傀儡存在
					AND = {
						VIN = { exists = yes }
						VIN = { is_subject_of = FRA }
					}
				}
			}
			FRA = {
				country_event = { id = wr_ultimatum.2 days = 3 }
			}
		}
		
		# 向荷兰发送解放印尼的要求
		if = {
			limit = {
				HOL = {
					exists = yes
					NOT = { has_war_with = ROOT }
				}
				OR = {
					# 荷兰直接拥有印尼
					HOL = {
						OR = {
							owns_state = 334  # 爪哇
							owns_state = 335  # 苏门答腊
							owns_state = 672  # 婆罗洲
						}
					}
					# 印尼作为荷兰傀儡存在
					AND = {
						INS = { exists = yes }
						INS = { is_subject_of = HOL }
					}
				}
			}
			HOL = {
				country_event = { id = wr_ultimatum.3 days = 3 }
			}
		}
		
		custom_effect_tooltip = WR_sea_ultimatum_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.5 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_india
	icon = GFX_WR_liberate_india
	x = 3
	y = 1
	relative_position_id = WR_liberate_asia
	prerequisite = { focus = WR_liberate_asia }
	cost = 10
	
	available = {
		RAJ = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	bypass = {
		RAJ = { has_government = communism }
	}
	
	ai_will_do = {
		factor = 5
	}
	
	completion_reward = {
		set_country_flag = WR_india_revolution_unlocked
		
		if = {
			limit = { NOT = { has_variable = WR_india_revolution_level } }
			set_variable = { WR_india_revolution_level = 0 }
		}
		
		custom_effect_tooltip = WR_india_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.6 days = 1 }
	}
}

# =========================================================
# 第四层：欧洲具体目标
# =========================================================

shared_focus = {
	id = WR_liberate_germany
	icon = GFX_WR_liberate_germany
	x = -3
	y = 1
	relative_position_id = WR_liberate_europe
	prerequisite = { focus = WR_liberate_europe }
	cost = 10
	
	available = {
		GER = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	bypass = {
		GER = { has_government = communism }
	}
	
	ai_will_do = {
		factor = 10
		modifier = {
			factor = 5
			tag = SOV
		}
	}
	
	completion_reward = {
		set_country_flag = WR_germany_revolution_unlocked
		
		if = {
			limit = { NOT = { has_variable = WR_germany_revolution_level } }
			set_variable = { WR_germany_revolution_level = 0 }
		}
		
		custom_effect_tooltip = WR_germany_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.7 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_france
	icon = GFX_WR_liberate_france
	x = -1
	y = 1
	relative_position_id = WR_liberate_europe
	prerequisite = { focus = WR_liberate_europe }
	cost = 10
	
	available = {
		FRA = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	bypass = {
		FRA = { has_government = communism }
	}
	
	ai_will_do = {
		factor = 8
	}
	
	completion_reward = {
		set_country_flag = WR_france_revolution_unlocked
		
		if = {
			limit = { NOT = { has_variable = WR_france_revolution_level } }
			set_variable = { WR_france_revolution_level = 0 }
		}
		
		custom_effect_tooltip = WR_france_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.8 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_italy
	icon = GFX_WR_liberate_italy
	x = 1
	y = 1
	relative_position_id = WR_liberate_europe
	prerequisite = { focus = WR_liberate_europe }
	cost = 10
	
	available = {
		ITA = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	bypass = {
		ITA = { has_government = communism }
	}
	
	ai_will_do = {
		factor = 7
	}
	
	completion_reward = {
		set_country_flag = WR_italy_revolution_unlocked
		
		if = {
			limit = { NOT = { has_variable = WR_italy_revolution_level } }
			set_variable = { WR_italy_revolution_level = 0 }
		}
		
		custom_effect_tooltip = WR_italy_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.9 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_iberia
	icon = GFX_WR_liberate_iberia
	x = 3
	y = 1
	relative_position_id = WR_liberate_europe
	prerequisite = { focus = WR_liberate_europe }
	cost = 10
	
	available = {
		OR = {
			SPR = {
				exists = yes
				NOT = { has_government = communism }
			}
			POR = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
	}
	
	bypass = {
		SPR = { has_government = communism }
		POR = { has_government = communism }
	}
	
	ai_will_do = {
		factor = 5
	}
	
	completion_reward = {
		set_country_flag = WR_iberia_revolution_unlocked
		
		if = {
			limit = { NOT = { has_variable = WR_iberia_revolution_level } }
			set_variable = { WR_iberia_revolution_level = 0 }
		}
		
		custom_effect_tooltip = WR_iberia_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.10 days = 1 }
	}
}

# =========================================================
# 第五层：亚洲/欧洲解放完成
# =========================================================

shared_focus = {
	id = WR_asia_liberated
	icon = GFX_WR_asia_liberated
	x = 0
	y = 2
	relative_position_id = WR_liberate_asia
	prerequisite = { 
		focus = WR_liberate_japan 
		focus = WR_liberate_china
		focus = WR_liberate_southeast_asia
		focus = WR_liberate_india
	}
	cost = 5
	
	available = {
		# 中国和日本都是共产主义或都停止抵抗
		JAP = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		CHI = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
	}
	
	ai_will_do = {
		factor = 15
	}
	
	completion_reward = {
		set_country_flag = WR_asia_liberation_complete
		
		# 增加世界解放进度
		WR_add_liberation_progress = yes
		custom_effect_tooltip = WR_liberation_progress_tt
		
		# 解锁其他大洲
		custom_effect_tooltip = WR_asia_complete_tt
	}
}

shared_focus = {
	id = WR_europe_liberated
	icon = GFX_WR_europe_liberated
	x = 0
	y = 2
	relative_position_id = WR_liberate_europe
	prerequisite = { 
		focus = WR_liberate_germany 
		focus = WR_liberate_france
		focus = WR_liberate_italy
		focus = WR_liberate_iberia
	}
	cost = 5
	
	available = {
		# 德国、法国、苏联、英国、意大利都是共产主义或都停止抵抗
		GER = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		FRA = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		SOV = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		ENG = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		ITA = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
	}
	
	ai_will_do = {
		factor = 15
	}
	
	completion_reward = {
		set_country_flag = WR_europe_liberation_complete
		
		# 增加世界解放进度
		WR_add_liberation_progress = yes
		custom_effect_tooltip = WR_liberation_progress_tt
		
		custom_effect_tooltip = WR_europe_complete_tt
	}
}

# =========================================================
# 后方分支：援助与输出
# =========================================================

shared_focus = {
	id = WR_military_aid_program
	icon = GFX_WR_military_aid
	x = -2
	y = 1
	relative_position_id = WR_revolutionary_rear
	prerequisite = { focus = WR_revolutionary_rear }
	cost = 7
	
	ai_will_do = {
		factor = 8
	}
	
	completion_reward = {
		# 本国承受牺牲
		add_ideas = WR_volunteer_corps
		
		# 兄弟国家获得增益和装备
		every_country = {
			limit = {
				has_government = communism
				is_in_faction_with = ROOT
				NOT = { tag = ROOT }
			}
			add_ideas = WR_volunteer_corps_support
			add_equipment_to_stockpile = {
				type = infantry_equipment
				amount = 3000
				producer = ROOT
			}
			country_event = { id = wr_solidarity.2 days = 1 }
		}
		
		# 广播新闻
		news_event = { id = wr_news.2 hours = 6 }
		
		custom_effect_tooltip = WR_military_aid_tt
	}
}

shared_focus = {
	id = WR_technology_sharing
	icon = GFX_WR_technology_sharing
	x = 0
	y = 1
	relative_position_id = WR_revolutionary_rear
	prerequisite = { focus = WR_revolutionary_rear }
	cost = 7
	
	ai_will_do = {
		factor = 8
	}
	
	completion_reward = {
		# 本国承受牺牲 - 将最优秀的科研人才派往兄弟国家
		add_ideas = WR_tech_sharing_sacrifice
		
		# 兄弟国家获得增益
		every_country = {
			limit = {
				has_government = communism
				is_in_faction_with = ROOT
				NOT = { tag = ROOT }
			}
			add_ideas = WR_tech_sharing_support
			country_event = { id = wr_solidarity.5 days = 1 }
		}
		
		# 广播新闻
		news_event = { id = wr_news.5 hours = 6 }
		
		custom_effect_tooltip = WR_technology_sharing_tt
	}
}

shared_focus = {
	id = WR_ideology_export
	icon = GFX_WR_ideology_export
	x = 2
	y = 1
	relative_position_id = WR_revolutionary_rear
	prerequisite = { focus = WR_revolutionary_rear }
	cost = 7
	
	ai_will_do = {
		factor = 10
	}
	
	completion_reward = {
		# 本国承受牺牲
		add_ideas = WR_ideology_spread
		
		# 兄弟国家获得增益
		every_country = {
			limit = {
				has_government = communism
				is_in_faction_with = ROOT
				NOT = { tag = ROOT }
			}
			add_ideas = WR_ideology_spread_support
			country_event = { id = wr_solidarity.3 days = 1 }
		}
		
		# 全球共产主义渗透
		every_country = {
			limit = {
				NOT = { has_government = communism }
				NOT = { has_war_with = ROOT }
			}
			add_timed_idea = {
				idea = WR_communist_infiltration
				days = 730
			}
		}
		
		# 广播新闻
		news_event = { id = wr_news.3 hours = 6 }
		
		custom_effect_tooltip = WR_ideology_export_tt
	}
}

shared_focus = {
	id = WR_comintern_broadcast
	icon = GFX_WR_comintern_broadcast
	x = 0
	y = 2
	relative_position_id = WR_revolutionary_rear
	prerequisite = { 
		focus = WR_military_aid_program
		focus = WR_technology_sharing
		focus = WR_ideology_export
	}
	cost = 10
	
	ai_will_do = {
		factor = 12
	}
	
	completion_reward = {
		# 本国承受牺牲
		add_ideas = WR_global_broadcast_network
		
		# 兄弟国家获得增益
		every_country = {
			limit = {
				has_government = communism
				is_in_faction_with = ROOT
				NOT = { tag = ROOT }
			}
			add_ideas = WR_global_broadcast_support
			country_event = { id = wr_solidarity.4 days = 1 }
		}
		
		# 广播新闻
		news_event = { id = wr_news.4 hours = 6 }
		
		custom_effect_tooltip = WR_broadcast_tt
	}
}

# =========================================================
# 第六层：其他大洲（需完成亚欧）
# =========================================================

shared_focus = {
	id = WR_liberate_americas
	icon = GFX_WR_liberate_americas
	x = -2
	y = 1
	relative_position_id = WR_asia_liberated
	prerequisite = { 
		focus = WR_asia_liberated 
	}
	prerequisite = {
		focus = WR_europe_liberated
	}
	cost = 10
	
	ai_will_do = {
		factor = 10
	}
	
	completion_reward = {
		set_country_flag = WR_americas_revolution_unlocked
		
		add_war_support = 0.10
		add_political_power = 100
		
		custom_effect_tooltip = WR_americas_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.11 days = 1 }
	}
}

# --- 美洲具体国家 ---

shared_focus = {
	id = WR_liberate_mexico
	icon = GFX_WR_liberate_mexico
	x = -2
	y = 1
	relative_position_id = WR_liberate_americas
	prerequisite = { focus = WR_liberate_americas }
	cost = 7
	
	available = {
		MEX = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	ai_will_do = {
		factor = 8
	}
	
	completion_reward = {
		if = {
			limit = { NOT = { has_variable = WR_mexico_revolution_level } }
			set_variable = { WR_mexico_revolution_level = 0 }
		}
		
		MEX = {
			add_timed_idea = {
				idea = WR_revolutionary_undercurrent_1
				days = 365
			}
		}
		
		custom_effect_tooltip = WR_mexico_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.12 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_brazil
	icon = GFX_WR_liberate_brazil
	x = 0
	y = 1
	relative_position_id = WR_liberate_americas
	prerequisite = { focus = WR_liberate_americas }
	cost = 7
	
	available = {
		BRA = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	ai_will_do = {
		factor = 8
	}
	
	completion_reward = {
		if = {
			limit = { NOT = { has_variable = WR_brazil_revolution_level } }
			set_variable = { WR_brazil_revolution_level = 0 }
		}
		
		BRA = {
			add_timed_idea = {
				idea = WR_revolutionary_undercurrent_1
				days = 365
			}
		}
		
		custom_effect_tooltip = WR_brazil_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.13 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_argentina
	icon = GFX_WR_liberate_argentina
	x = 2
	y = 1
	relative_position_id = WR_liberate_americas
	prerequisite = { focus = WR_liberate_americas }
	cost = 7
	
	available = {
		ARG = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	ai_will_do = {
		factor = 7
	}
	
	completion_reward = {
		if = {
			limit = { NOT = { has_variable = WR_argentina_revolution_level } }
			set_variable = { WR_argentina_revolution_level = 0 }
		}
		
		ARG = {
			add_timed_idea = {
				idea = WR_revolutionary_undercurrent_1
				days = 365
			}
		}
		
		custom_effect_tooltip = WR_argentina_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.14 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_usa
	icon = GFX_WR_liberate_usa
	x = 0
	y = 2
	relative_position_id = WR_liberate_americas
	prerequisite = { 
		focus = WR_liberate_mexico 
		focus = WR_liberate_brazil
		focus = WR_liberate_argentina
	}
	cost = 15
	
	available = {
		USA = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	ai_will_do = {
		factor = 15
	}
	
	completion_reward = {
		if = {
			limit = { NOT = { has_variable = WR_usa_revolution_level } }
			set_variable = { WR_usa_revolution_level = 0 }
		}
		
		USA = {
			add_timed_idea = {
				idea = WR_revolutionary_undercurrent_1
				days = 365
			}
		}
		
		add_war_support = 0.10
		
		custom_effect_tooltip = WR_usa_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.15 days = 1 }
	}
}

shared_focus = {
	id = WR_americas_liberated
	icon = GFX_WR_americas_liberated
	x = 0
	y = 3
	relative_position_id = WR_liberate_americas
	prerequisite = { focus = WR_liberate_usa }
	cost = 5
	
	available = {
		# 美国、墨西哥、巴西、阿根廷都是共产主义或都停止抵抗
		USA = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		MEX = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		BRA = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		ARG = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
	}
	
	ai_will_do = {
		factor = 15
	}
	
	completion_reward = {
		set_country_flag = WR_americas_liberation_complete
		
		# 增加世界解放进度
		WR_add_liberation_progress = yes
		custom_effect_tooltip = WR_liberation_progress_tt
		
		custom_effect_tooltip = WR_americas_complete_tt
	}
}

# =========================================================
# 非洲分支
# =========================================================

shared_focus = {
	id = WR_liberate_africa
	icon = GFX_WR_liberate_africa
	x = 3
	y = 1
	relative_position_id = WR_asia_liberated
	prerequisite = { 
		focus = WR_asia_liberated 
	}
	prerequisite = {
		focus = WR_europe_liberated
	}
	cost = 10
	
	ai_will_do = {
		factor = 8
	}
	
	completion_reward = {
		set_country_flag = WR_africa_revolution_unlocked
		
		add_political_power = 100
		
		custom_effect_tooltip = WR_africa_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.16 days = 1 }
	}
}

# --- 非洲具体国家 ---

shared_focus = {
	id = WR_liberate_egypt
	icon = GFX_WR_liberate_egypt
	x = -1
	y = 1
	relative_position_id = WR_liberate_africa
	prerequisite = { focus = WR_liberate_africa }
	cost = 7
	
	available = {
		EGY = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	ai_will_do = {
		factor = 8
	}
	
	completion_reward = {
		if = {
			limit = { NOT = { has_variable = WR_egypt_revolution_level } }
			set_variable = { WR_egypt_revolution_level = 0 }
		}
		
		EGY = {
			add_timed_idea = {
				idea = WR_revolutionary_undercurrent_1
				days = 365
			}
		}
		
		custom_effect_tooltip = WR_egypt_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.17 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_ethiopia
	icon = GFX_WR_liberate_ethiopia
	x = 1
	y = 1
	relative_position_id = WR_liberate_africa
	prerequisite = { focus = WR_liberate_africa }
	cost = 7
	
	available = {
		ETH = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	ai_will_do = {
		factor = 7
	}
	
	completion_reward = {
		if = {
			limit = { NOT = { has_variable = WR_ethiopia_revolution_level } }
			set_variable = { WR_ethiopia_revolution_level = 0 }
		}
		
		ETH = {
			add_timed_idea = {
				idea = WR_revolutionary_undercurrent_1
				days = 365
			}
		}
		
		custom_effect_tooltip = WR_ethiopia_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.18 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_south_africa
	icon = GFX_WR_liberate_south_africa
	x = 0
	y = 2
	relative_position_id = WR_liberate_africa
	prerequisite = { 
		focus = WR_liberate_egypt 
		focus = WR_liberate_ethiopia
	}
	cost = 10
	
	available = {
		SAF = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	ai_will_do = {
		factor = 8
	}
	
	completion_reward = {
		if = {
			limit = { NOT = { has_variable = WR_saf_revolution_level } }
			set_variable = { WR_saf_revolution_level = 0 }
		}
		
		SAF = {
			add_timed_idea = {
				idea = WR_revolutionary_undercurrent_1
				days = 365
			}
		}
		
		custom_effect_tooltip = WR_south_africa_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.19 days = 1 }
	}
}

shared_focus = {
	id = WR_africa_liberated
	icon = GFX_WR_africa_liberated
	x = 0
	y = 3
	relative_position_id = WR_liberate_africa
	prerequisite = { focus = WR_liberate_south_africa }
	cost = 5
	
	available = {
		# 埃及、埃塞俄比亚、南非都是共产主义或都停止抵抗
		EGY = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		ETH = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		SAF = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
	}
	
	ai_will_do = {
		factor = 12
	}
	
	completion_reward = {
		set_country_flag = WR_africa_liberation_complete
		
		# 增加世界解放进度
		WR_add_liberation_progress = yes
		custom_effect_tooltip = WR_liberation_progress_tt
		
		custom_effect_tooltip = WR_africa_complete_tt
	}
}

# =========================================================
# 大洋洲分支
# =========================================================

shared_focus = {
	id = WR_liberate_oceania
	icon = GFX_WR_liberate_oceania
	x = 2
	y = 1
	relative_position_id = WR_europe_liberated
	prerequisite = { 
		focus = WR_asia_liberated 
	}
	prerequisite = {
		focus = WR_europe_liberated
	}
	cost = 10
	
	ai_will_do = {
		factor = 6
	}
	
	completion_reward = {
		set_country_flag = WR_oceania_revolution_unlocked
		
		add_political_power = 75
		
		custom_effect_tooltip = WR_oceania_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.20 days = 1 }
	}
}

# --- 大洋洲具体国家 ---

shared_focus = {
	id = WR_liberate_australia
	icon = GFX_WR_liberate_australia
	x = -1
	y = 1
	relative_position_id = WR_liberate_oceania
	prerequisite = { focus = WR_liberate_oceania }
	cost = 10
	
	available = {
		AST = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	ai_will_do = {
		factor = 8
	}
	
	completion_reward = {
		if = {
			limit = { NOT = { has_variable = WR_australia_revolution_level } }
			set_variable = { WR_australia_revolution_level = 0 }
		}
		
		AST = {
			add_timed_idea = {
				idea = WR_revolutionary_undercurrent_1
				days = 365
			}
		}
		
		custom_effect_tooltip = WR_australia_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.21 days = 1 }
	}
}

shared_focus = {
	id = WR_liberate_new_zealand
	icon = GFX_WR_liberate_new_zealand
	x = 1
	y = 1
	relative_position_id = WR_liberate_oceania
	prerequisite = { focus = WR_liberate_oceania }
	cost = 7
	
	available = {
		NZL = {
			exists = yes
			NOT = { has_government = communism }
		}
	}
	
	ai_will_do = {
		factor = 6
	}
	
	completion_reward = {
		if = {
			limit = { NOT = { has_variable = WR_nzl_revolution_level } }
			set_variable = { WR_nzl_revolution_level = 0 }
		}
		
		NZL = {
			add_timed_idea = {
				idea = WR_revolutionary_undercurrent_1
				days = 365
			}
		}
		
		custom_effect_tooltip = WR_new_zealand_revolution_tt
		
		# 解放宣言事件
		country_event = { id = wr_liberation.22 days = 1 }
	}
}

shared_focus = {
	id = WR_oceania_liberated
	icon = GFX_WR_oceania_liberated
	x = 0
	y = 2
	relative_position_id = WR_liberate_oceania
	prerequisite = { 
		focus = WR_liberate_australia 
		focus = WR_liberate_new_zealand
	}
	cost = 5
	
	available = {
		# 澳大利亚、新西兰都是共产主义或都停止抵抗
		AST = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
		NZL = {
			OR = {
				has_government = communism
				has_capitulated = yes
				exists = no
			}
		}
	}
	
	ai_will_do = {
		factor = 10
	}
	
	completion_reward = {
		set_country_flag = WR_oceania_liberation_complete
		
		# 增加世界解放进度
		WR_add_liberation_progress = yes
		custom_effect_tooltip = WR_liberation_progress_tt
		
		custom_effect_tooltip = WR_oceania_complete_tt
	}
}

# =========================================================
# 最终层：资本主义的终结
# =========================================================

shared_focus = {
	id = WR_end_of_capitalism
	icon = GFX_WR_end_of_capitalism
	x = 0
	y = 1
	relative_position_id = WR_africa_liberated
	prerequisite = { focus = WR_americas_liberated }
	prerequisite = { focus = WR_africa_liberated }
	prerequisite = { focus = WR_oceania_liberated }
	cost = 20
	
	available = {
		# 主要资本主义国家都已变成共产主义或被征服
		USA = {
			OR = {
				has_government = communism
				exists = no
				is_subject_of = ROOT
			}
		}
		# 至少控制了全�?0%的工�?
		num_of_factories > 200
	}
	
	ai_will_do = {
		factor = 100
	}
	
	completion_reward = {
		# 触发结局事件
		country_event = { id = wr_event.100 }
		
		# 增加世界解放进度（最终阶段）
		WR_add_liberation_progress = yes
		custom_effect_tooltip = WR_liberation_progress_tt
		
		# 设置游戏标记
		set_global_flag = WR_capitalism_ended
		
		custom_effect_tooltip = WR_end_of_capitalism_tt
	}
}
