# =====================================================
# 世界革命 - 决议系统
# 分类定义在 categories/WR_categories.txt
# =====================================================

WR_revolution_category = {

	# =========================================================
	# 日本革命
	# =========================================================
	
	WR_support_japan_revolution = {
		icon = generic_civil_support
		
		visible = {
			has_country_flag = WR_japan_revolution_unlocked
			JAP = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 50
			NOT = { has_war_with = JAP }
		}
		
		cost = 50
		days_re_enable = 30
		
		complete_effect = {
			add_to_variable = { WR_japan_revolution_level = 1 }
			clamp_variable = { var = WR_japan_revolution_level min = 0 max = 3 }
			
			JAP = {
				if = {
					limit = { 
						ROOT = { check_variable = { WR_japan_revolution_level = 1 } }
						NOT = { has_idea = WR_revolutionary_undercurrent_1 }
					}
					add_timed_idea = { idea = WR_revolutionary_undercurrent_1 days = 180 }
				}
				else_if = {
					limit = { 
						ROOT = { check_variable = { WR_japan_revolution_level = 2 } }
					}
					remove_ideas = WR_revolutionary_undercurrent_1
					add_timed_idea = { idea = WR_revolutionary_undercurrent_2 days = 180 }
				}
				else_if = {
					limit = { 
						ROOT = { check_variable = { WR_japan_revolution_level = 3 } }
					}
					remove_ideas = WR_revolutionary_undercurrent_2
					add_timed_idea = { idea = WR_revolutionary_undercurrent_3 days = 180 }
				}
			}
			
			custom_effect_tooltip = WR_support_revolution_tt
		}
	}
	
	# 日本革命策略 - 触发事件链
	WR_japan_revolution_strategy = {
		icon = generic_propaganda
		
		visible = {
			has_country_flag = WR_japan_revolution_unlocked
			JAP = {
				exists = yes
				NOT = { has_government = communism }
			}
			NOT = { has_country_flag = WR_japan_strategy_started }
		}
		
		available = {
			has_political_power > 100
			NOT = { has_war_with = JAP }
			check_variable = { WR_japan_revolution_level > 0 }
		}
		
		cost = 100
		fire_only_once = yes
		
		complete_effect = {
			set_country_flag = WR_japan_strategy_started
			custom_effect_tooltip = WR_revolution_strategy_tt
			hidden_effect = {
				country_event = { id = wr_strategy.1 days = 3 }
			}
		}
	}
	
	# 派遣顾问到日本
	WR_send_advisors_japan = {
		icon = generic_political_discourse
		
		visible = {
			has_country_flag = WR_japan_revolution_unlocked
			JAP = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 25
			NOT = { has_war_with = JAP }
		}
		
		cost = 25
		days_re_enable = 60
		
		complete_effect = {
			JAP = {
				add_popularity = { ideology = communism popularity = 0.03 }
			}
			custom_effect_tooltip = WR_send_advisors_tt
		}
	}
	
	# 资助日本共产党
	WR_fund_jcp = {
		icon = generic_prepare_civil_war
		
		visible = {
			has_country_flag = WR_japan_revolution_unlocked
			JAP = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 75
			NOT = { has_war_with = JAP }
		}
		
		cost = 75
		days_re_enable = 90
		
		complete_effect = {
			JAP = {
				add_popularity = { ideology = communism popularity = 0.05 }
				add_stability = -0.03
			}
			custom_effect_tooltip = WR_fund_party_tt
		}
	}
	
	WR_special_military_operation_japan = {
		icon = generic_ignite_civil_war
		
		visible = {
			has_country_flag = WR_japan_revolution_unlocked
			JAP = {
				has_country_flag = WR_suppression_triggered
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 100
			has_war_support > 0.5
			NOT = { has_war_with = JAP }
		}
		
		cost = 100
		fire_only_once = yes
		
		complete_effect = {
			create_wargoal = {
				type = liberate_wargoal
				target = JAP
			}
			add_timed_idea = { idea = WR_liberation_war_spirit days = 365 }
			country_event = { id = wr_event.50 }
			custom_effect_tooltip = WR_special_operation_tt
		}
	}

	# =========================================================
	# 中国革命
	# =========================================================
	
	WR_support_china_revolution = {
		icon = generic_civil_support
		
		visible = {
			has_country_flag = WR_china_revolution_unlocked
			CHI = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 50
			NOT = { has_war_with = CHI }
		}
		
		cost = 50
		days_re_enable = 30
		
		complete_effect = {
			add_to_variable = { WR_china_revolution_level = 1 }
			clamp_variable = { var = WR_china_revolution_level min = 0 max = 3 }
			
			CHI = {
				if = {
					limit = { 
						ROOT = { check_variable = { WR_china_revolution_level = 1 } }
						NOT = { has_idea = WR_revolutionary_undercurrent_1 }
					}
					add_timed_idea = { idea = WR_revolutionary_undercurrent_1 days = 180 }
				}
				else_if = {
					limit = { 
						ROOT = { check_variable = { WR_china_revolution_level = 2 } }
					}
					remove_ideas = WR_revolutionary_undercurrent_1
					add_timed_idea = { idea = WR_revolutionary_undercurrent_2 days = 180 }
				}
				else_if = {
					limit = { 
						ROOT = { check_variable = { WR_china_revolution_level = 3 } }
					}
					remove_ideas = WR_revolutionary_undercurrent_2
					add_timed_idea = { idea = WR_revolutionary_undercurrent_3 days = 180 }
				}
			}
			
			custom_effect_tooltip = WR_support_revolution_tt
		}
	}
	
	# 中国革命策略 - 触发事件链
	WR_china_revolution_strategy = {
		icon = generic_propaganda
		
		visible = {
			has_country_flag = WR_china_revolution_unlocked
			CHI = {
				exists = yes
				NOT = { has_government = communism }
			}
			NOT = { has_country_flag = WR_china_strategy_started }
		}
		
		available = {
			has_political_power > 100
			NOT = { has_war_with = CHI }
			check_variable = { WR_china_revolution_level > 0 }
		}
		
		cost = 100
		fire_only_once = yes
		
		complete_effect = {
			set_country_flag = WR_china_strategy_started
			custom_effect_tooltip = WR_revolution_strategy_tt
			hidden_effect = {
				country_event = { id = wr_strategy.10 days = 3 }
			}
		}
	}
	
	# 派遣顾问到中国
	WR_send_advisors_china = {
		icon = generic_political_discourse
		
		visible = {
			has_country_flag = WR_china_revolution_unlocked
			CHI = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 25
			NOT = { has_war_with = CHI }
		}
		
		cost = 25
		days_re_enable = 60
		
		complete_effect = {
			CHI = {
				add_popularity = { ideology = communism popularity = 0.03 }
			}
			custom_effect_tooltip = WR_send_advisors_tt
		}
	}
	
	# 资助中国共产党
	WR_fund_ccp = {
		icon = generic_prepare_civil_war
		
		visible = {
			has_country_flag = WR_china_revolution_unlocked
			CHI = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 75
			NOT = { has_war_with = CHI }
		}
		
		cost = 75
		days_re_enable = 90
		
		complete_effect = {
			CHI = {
				add_popularity = { ideology = communism popularity = 0.05 }
				add_stability = -0.03
			}
			custom_effect_tooltip = WR_fund_party_tt
		}
	}
	
	WR_special_military_operation_china = {
		icon = generic_ignite_civil_war
		
		visible = {
			has_country_flag = WR_china_revolution_unlocked
			CHI = {
				has_country_flag = WR_suppression_triggered
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 100
			has_war_support > 0.5
			NOT = { has_war_with = CHI }
		}
		
		cost = 100
		fire_only_once = yes
		
		complete_effect = {
			create_wargoal = {
				type = liberate_wargoal
				target = CHI
			}
			add_timed_idea = { idea = WR_liberation_war_spirit days = 365 }
			country_event = { id = wr_event.51 }
			custom_effect_tooltip = WR_special_operation_tt
		}
	}

	# =========================================================
	# 德国革命
	# =========================================================
	
	WR_support_germany_revolution = {
		icon = generic_civil_support
		
		visible = {
			has_country_flag = WR_germany_revolution_unlocked
			GER = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 50
			NOT = { has_war_with = GER }
		}
		
		cost = 50
		days_re_enable = 30
		
		complete_effect = {
			add_to_variable = { WR_germany_revolution_level = 1 }
			clamp_variable = { var = WR_germany_revolution_level min = 0 max = 3 }
			
			GER = {
				if = {
					limit = { 
						ROOT = { check_variable = { WR_germany_revolution_level = 1 } }
						NOT = { has_idea = WR_revolutionary_undercurrent_1 }
					}
					add_timed_idea = { idea = WR_revolutionary_undercurrent_1 days = 180 }
				}
				else_if = {
					limit = { 
						ROOT = { check_variable = { WR_germany_revolution_level = 2 } }
					}
					remove_ideas = WR_revolutionary_undercurrent_1
					add_timed_idea = { idea = WR_revolutionary_undercurrent_2 days = 180 }
				}
				else_if = {
					limit = { 
						ROOT = { check_variable = { WR_germany_revolution_level = 3 } }
					}
					remove_ideas = WR_revolutionary_undercurrent_2
					add_timed_idea = { idea = WR_revolutionary_undercurrent_3 days = 180 }
				}
			}
			
			custom_effect_tooltip = WR_support_revolution_tt
		}
	}
	
	# 德国革命策略 - 触发事件链
	WR_germany_revolution_strategy = {
		icon = generic_propaganda
		
		visible = {
			has_country_flag = WR_germany_revolution_unlocked
			GER = {
				exists = yes
				NOT = { has_government = communism }
			}
			NOT = { has_country_flag = WR_germany_strategy_started }
		}
		
		available = {
			has_political_power > 100
			NOT = { has_war_with = GER }
			check_variable = { WR_germany_revolution_level > 0 }
		}
		
		cost = 100
		fire_only_once = yes
		
		complete_effect = {
			set_country_flag = WR_germany_strategy_started
			custom_effect_tooltip = WR_revolution_strategy_tt
			hidden_effect = {
				country_event = { id = wr_strategy.20 days = 3 }
			}
		}
	}
	
	# 派遣顾问到德国
	WR_send_advisors_germany = {
		icon = generic_political_discourse
		
		visible = {
			has_country_flag = WR_germany_revolution_unlocked
			GER = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 25
			NOT = { has_war_with = GER }
		}
		
		cost = 25
		days_re_enable = 60
		
		complete_effect = {
			GER = {
				add_popularity = { ideology = communism popularity = 0.03 }
			}
			custom_effect_tooltip = WR_send_advisors_tt
		}
	}
	
	# 资助德国共产党
	WR_fund_kpd = {
		icon = generic_prepare_civil_war
		
		visible = {
			has_country_flag = WR_germany_revolution_unlocked
			GER = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 75
			NOT = { has_war_with = GER }
		}
		
		cost = 75
		days_re_enable = 90
		
		complete_effect = {
			GER = {
				add_popularity = { ideology = communism popularity = 0.05 }
				add_stability = -0.03
			}
			custom_effect_tooltip = WR_fund_party_tt
		}
	}
	
	WR_special_military_operation_germany = {
		icon = generic_ignite_civil_war
		
		visible = {
			has_country_flag = WR_germany_revolution_unlocked
			GER = {
				has_country_flag = WR_suppression_triggered
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 100
			has_war_support > 0.5
			NOT = { has_war_with = GER }
		}
		
		cost = 100
		fire_only_once = yes
		
		complete_effect = {
			create_wargoal = {
				type = liberate_wargoal
				target = GER
			}
			add_timed_idea = { idea = WR_liberation_war_spirit days = 365 }
			country_event = { id = wr_event.52 }
			custom_effect_tooltip = WR_special_operation_tt
		}
	}

	# =========================================================
	# 法国革命
	# =========================================================
	
	WR_support_france_revolution = {
		icon = generic_civil_support
		
		visible = {
			has_country_flag = WR_france_revolution_unlocked
			FRA = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 50
			NOT = { has_war_with = FRA }
		}
		
		cost = 50
		days_re_enable = 30
		
		complete_effect = {
			add_to_variable = { WR_france_revolution_level = 1 }
			clamp_variable = { var = WR_france_revolution_level min = 0 max = 3 }
			
			FRA = {
				if = {
					limit = { 
						ROOT = { check_variable = { WR_france_revolution_level = 1 } }
						NOT = { has_idea = WR_revolutionary_undercurrent_1 }
					}
					add_timed_idea = { idea = WR_revolutionary_undercurrent_1 days = 180 }
				}
				else_if = {
					limit = { 
						ROOT = { check_variable = { WR_france_revolution_level = 2 } }
					}
					remove_ideas = WR_revolutionary_undercurrent_1
					add_timed_idea = { idea = WR_revolutionary_undercurrent_2 days = 180 }
				}
				else_if = {
					limit = { 
						ROOT = { check_variable = { WR_france_revolution_level = 3 } }
					}
					remove_ideas = WR_revolutionary_undercurrent_2
					add_timed_idea = { idea = WR_revolutionary_undercurrent_3 days = 180 }
				}
			}
			
			custom_effect_tooltip = WR_support_revolution_tt
		}
	}
	
	# 法国革命策略 - 触发事件链
	WR_france_revolution_strategy = {
		icon = generic_propaganda
		
		visible = {
			has_country_flag = WR_france_revolution_unlocked
			FRA = {
				exists = yes
				NOT = { has_government = communism }
			}
			NOT = { has_country_flag = WR_france_strategy_started }
		}
		
		available = {
			has_political_power > 100
			NOT = { has_war_with = FRA }
			check_variable = { WR_france_revolution_level > 0 }
		}
		
		cost = 100
		fire_only_once = yes
		
		complete_effect = {
			set_country_flag = WR_france_strategy_started
			custom_effect_tooltip = WR_revolution_strategy_tt
			hidden_effect = {
				country_event = { id = wr_strategy.30 days = 3 }
			}
		}
	}
	
	# 派遣顾问到法国
	WR_send_advisors_france = {
		icon = generic_political_discourse
		
		visible = {
			has_country_flag = WR_france_revolution_unlocked
			FRA = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 25
			NOT = { has_war_with = FRA }
		}
		
		cost = 25
		days_re_enable = 60
		
		complete_effect = {
			FRA = {
				add_popularity = { ideology = communism popularity = 0.03 }
			}
			custom_effect_tooltip = WR_send_advisors_tt
		}
	}
	
	# 资助法国共产党
	WR_fund_pcf = {
		icon = generic_prepare_civil_war
		
		visible = {
			has_country_flag = WR_france_revolution_unlocked
			FRA = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 75
			NOT = { has_war_with = FRA }
		}
		
		cost = 75
		days_re_enable = 90
		
		complete_effect = {
			FRA = {
				add_popularity = { ideology = communism popularity = 0.05 }
				add_stability = -0.03
			}
			custom_effect_tooltip = WR_fund_party_tt
		}
	}
	
	WR_special_military_operation_france = {
		icon = generic_ignite_civil_war
		
		visible = {
			has_country_flag = WR_france_revolution_unlocked
			FRA = {
				has_country_flag = WR_suppression_triggered
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 100
			has_war_support > 0.5
			NOT = { has_war_with = FRA }
		}
		
		cost = 100
		fire_only_once = yes
		
		complete_effect = {
			create_wargoal = {
				type = liberate_wargoal
				target = FRA
			}
			add_timed_idea = { idea = WR_liberation_war_spirit days = 365 }
			country_event = { id = wr_event.53 }
			custom_effect_tooltip = WR_special_operation_tt
		}
	}

	# =========================================================
	# 美国革命（终极目标）
	# =========================================================
	
	WR_support_usa_revolution = {
		icon = generic_civil_support
		
		visible = {
			has_country_flag = WR_americas_revolution_unlocked
			USA = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 75
			NOT = { has_war_with = USA }
		}
		
		cost = 75
		days_re_enable = 30
		
		complete_effect = {
			add_to_variable = { WR_usa_revolution_level = 1 }
			clamp_variable = { var = WR_usa_revolution_level min = 0 max = 3 }
			
			USA = {
				if = {
					limit = { 
						ROOT = { check_variable = { WR_usa_revolution_level = 1 } }
						NOT = { has_idea = WR_revolutionary_undercurrent_1 }
					}
					add_timed_idea = { idea = WR_revolutionary_undercurrent_1 days = 180 }
				}
				else_if = {
					limit = { 
						ROOT = { check_variable = { WR_usa_revolution_level = 2 } }
					}
					remove_ideas = WR_revolutionary_undercurrent_1
					add_timed_idea = { idea = WR_revolutionary_undercurrent_2 days = 180 }
				}
				else_if = {
					limit = { 
						ROOT = { check_variable = { WR_usa_revolution_level = 3 } }
					}
					remove_ideas = WR_revolutionary_undercurrent_2
					add_timed_idea = { idea = WR_revolutionary_undercurrent_3 days = 180 }
				}
			}
			
			custom_effect_tooltip = WR_support_revolution_tt
		}
	}
	
	# 美国革命策略 - 触发事件链
	WR_usa_revolution_strategy = {
		icon = generic_propaganda
		
		visible = {
			has_country_flag = WR_americas_revolution_unlocked
			USA = {
				exists = yes
				NOT = { has_government = communism }
			}
			NOT = { has_country_flag = WR_usa_strategy_started }
		}
		
		available = {
			has_political_power > 150
			NOT = { has_war_with = USA }
			check_variable = { WR_usa_revolution_level > 0 }
		}
		
		cost = 150
		fire_only_once = yes
		
		complete_effect = {
			set_country_flag = WR_usa_strategy_started
			custom_effect_tooltip = WR_revolution_strategy_usa_tt
			hidden_effect = {
				country_event = { id = wr_strategy.40 days = 3 }
			}
		}
	}
	
	# 派遣顾问到美国
	WR_send_advisors_usa = {
		icon = generic_political_discourse
		
		visible = {
			has_country_flag = WR_americas_revolution_unlocked
			USA = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 35
			NOT = { has_war_with = USA }
		}
		
		cost = 35
		days_re_enable = 60
		
		complete_effect = {
			USA = {
				add_popularity = { ideology = communism popularity = 0.02 }
			}
			custom_effect_tooltip = WR_send_advisors_tt
		}
	}
	
	# 资助美国共产党
	WR_fund_cpusa = {
		icon = generic_prepare_civil_war
		
		visible = {
			has_country_flag = WR_americas_revolution_unlocked
			USA = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 100
			NOT = { has_war_with = USA }
		}
		
		cost = 100
		days_re_enable = 90
		
		complete_effect = {
			USA = {
				add_popularity = { ideology = communism popularity = 0.04 }
				add_stability = -0.02
			}
			custom_effect_tooltip = WR_fund_party_tt
		}
	}
	
	# 渗透美国工会
	WR_infiltrate_usa_unions = {
		icon = generic_industry
		
		visible = {
			has_country_flag = WR_americas_revolution_unlocked
			USA = {
				exists = yes
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 50
			NOT = { has_war_with = USA }
		}
		
		cost = 50
		days_re_enable = 120
		
		complete_effect = {
			USA = {
				add_popularity = { ideology = communism popularity = 0.03 }
				add_timed_idea = { idea = WR_labor_unrest days = 180 }
			}
			custom_effect_tooltip = WR_infiltrate_unions_tt
		}
	}
	
	WR_special_military_operation_usa = {
		icon = generic_ignite_civil_war
		
		visible = {
			has_country_flag = WR_americas_revolution_unlocked
			USA = {
				has_country_flag = WR_suppression_triggered
				NOT = { has_government = communism }
			}
		}
		
		available = {
			has_political_power > 150
			has_war_support > 0.6
			NOT = { has_war_with = USA }
		}
		
		cost = 150
		fire_only_once = yes
		
		complete_effect = {
			create_wargoal = {
				type = liberate_wargoal
				target = USA
			}
			add_timed_idea = { idea = WR_liberation_war_spirit days = 365 }
			country_event = { id = wr_event.60 }
			custom_effect_tooltip = WR_special_operation_usa_tt
		}
	}
	
	# =========================================================
	# 通用支援决议
	# =========================================================
	
	# 国际广播攻势
	WR_international_broadcast_offensive = {
		icon = generic_political_discourse
		
		visible = {
			has_completed_focus = WR_comintern_broadcast
		}
		
		available = {
			has_political_power > 50
		}
		
		cost = 50
		days_re_enable = 60
		
		complete_effect = {
			every_country = {
				limit = {
					NOT = { has_government = communism }
					NOT = { has_war_with = ROOT }
				}
				add_popularity = { ideology = communism popularity = 0.01 }
			}
			custom_effect_tooltip = WR_broadcast_offensive_tt
		}
	}
	
	# 派遣国际纵队
	WR_send_international_brigades = {
		icon = generic_army_support
		
		visible = {
			has_completed_focus = WR_military_aid_program
			any_country = {
				has_government = communism
				has_war = yes
				NOT = { tag = ROOT }
			}
		}
		
		available = {
			has_political_power > 75
			has_manpower > 5000
		}
		
		cost = 75
		days_re_enable = 180
		
		complete_effect = {
			add_manpower = -5000
			random_country = {
				limit = {
					has_government = communism
					has_war = yes
					NOT = { tag = ROOT }
				}
				add_manpower = 5000
				country_event = { id = wr_event.70 }
			}
			custom_effect_tooltip = WR_international_brigades_tt
		}
	}
	
	# 武器援助计划
	WR_weapons_aid_program = {
		icon = generic_military_support
		
		visible = {
			has_completed_focus = WR_military_aid_program
		}
		
		available = {
			has_equipment = { infantry_equipment > 1000 }
		}
		
		cost = 25
		days_re_enable = 90
		
		complete_effect = {
			random_country = {
				limit = {
					has_government = communism
					NOT = { tag = ROOT }
					is_in_faction_with = ROOT
				}
				send_equipment = {
					type = infantry_equipment
					amount = 1000
				}
			}
			custom_effect_tooltip = WR_weapons_aid_tt
		}
	}
}
