establish_puppet_state = {
	category = influence

	alert_index = 6
	alert_tooltip = establish_puppet_state_alert_tooltip

	require_acceptance = yes

	is_visible = {
		can_create_subject_type = {
			subject = FROM
			subject_type = puppet_state
		}
	}

	is_allowed = {
		can_create_subject_type = {
			subject = FROM
			subject_type = puppet_state
		}
		prestige = 0
		is_at_war = no
		FROM = { is_at_war = no }
		FROM = {
			capital_scope = { trade_range = ROOT }
		}
		FROM = {
			NOT = { total_development = 300 }
		}
	}

	on_accept = {
		if = {
			limit = {
				can_create_subject_type = {
					subject = FROM
					subject_type = puppet_state
				}
				prestige = 0
				is_at_war = no
				FROM = { is_at_war = no }
				FROM = {
					capital_scope = { trade_range = ROOT }
				}
				FROM = {
					NOT = { total_development = 300 }
				}
			}
			create_subject = {
				subject = FROM
				subject_type = puppet_state
				keep_liberty_desire = yes
			}
			FROM = {
				country_event = { id = subjects_expanded_puppet_state_events.1 }
			}
		}
	}

	on_decline = {
		if = {
			limit = {
				can_create_subject_type = {
					subject = FROM
					subject_type = puppet_state
				}
				prestige = 0
				is_at_war = no
				FROM = { is_at_war = no }
				FROM = {
					capital_scope = { trade_range = ROOT }
				}
				FROM = {
					NOT = { total_development = 300 }
				}
			}
			FROM = {
				clr_country_flag = declined_establish_puppet_state_@ROOT
				set_country_flag = declined_establish_puppet_state_@ROOT
			}
			add_opinion = {
				who = FROM
				modifier = declined_establish_puppet_state_opinion
			}
		}
	}

	ai_acceptance = {
		add_entry = {
			name = FROM_IS_SUBJECT_AT_RIVAL_BORDER
			limit = {
				FROM = {
					is_subject_of = ROOT
				}
				OR = {
					any_rival_country = {
						is_neighbor_of = FROM
					}
					any_enemy_country = {
						is_neighbor_of = FROM
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 30
			}
		}
		add_entry = {
			name = FROM_IS_MONARCHY
			limit = {
				FROM = {
					government = monarchy
				}
			}
			export_to_variable = {
				which = ai_value
				value = 50
			}
			multiply_variable = { which = ai_value value = -1 }
		}
		add_entry = {
			name = FROM_HAS_OTHER_IDEOLOGY
			limit = {
				OR = {
					# Fascist Government Type
					AND = {
						OR = {
							has_reform = fascist_government
							has_reform = military_government
							has_reform = presidential_despot_reform
						}
						FROM = {
							NOT = { has_reform = fascist_government }
							NOT = { has_reform = military_government }
							NOT = { has_reform = presidential_despot_reform }
						}
					}
					# Communist Government Type
					AND = {
						OR = {
							has_reform = peasants_republic
							has_reform = communist_government
						}
						FROM = {
							NOT = { has_reform = peasants_republic }
							NOT = { has_reform = communist_government }
						}
					}
					# Capitalist Government Type
					AND = {
						OR = {
							has_reform = administrative_monarchy
							has_reform = constitutional_monarchy
							has_reform = merchants_reform
							has_reform = oligarchy_reform
							has_reform = administrative_republic
							has_reform = constitutional_republic
							has_reform = bureaucratic_despotism
							has_reform = english_monarchy
							has_reform = trading_city
							has_reform = dutch_republic
							has_reform = american_republic
							has_reform = federal_republic
						}
						FROM = {
							NOT = { has_reform = administrative_monarchy }
							NOT = { has_reform = constitutional_monarchy }
							NOT = { has_reform = merchants_reform }
							NOT = { has_reform = oligarchy_reform }
							NOT = { has_reform = administrative_republic }
							NOT = { has_reform = constitutional_republic }
							NOT = { has_reform = bureaucratic_despotism }
							NOT = { has_reform = english_monarchy }
							NOT = { has_reform = trading_city }
							NOT = { has_reform = dutch_republic }
							NOT = { has_reform = american_republic }
							NOT = { has_reform = federal_republic }
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 50
			}
			multiply_variable = { which = ai_value value = -1 }
		}
		add_entry = {
			name = NOT_RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 50
			}
			multiply_variable = { which = ai_value value = -1 }
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 200
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 200
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 190
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 200
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 190
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 180
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 190
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 180
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 170
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 180
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 170
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 160
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 170
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 160
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 150
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 160
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 150
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 140
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 150
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 140
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 130
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 140
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 130
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 120
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 130
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 120
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 110
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 120
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 110
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 100
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 110
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 100
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 90
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 100
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 90
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 80
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 90
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 80
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 70
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 80
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 70
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 60
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 70
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 60
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 50
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 60
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 50
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 40
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 50
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 40
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 30
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 40
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 30
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 20
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 30
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 20
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
						value = 10
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 20
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 10
			}
		}
		add_entry = {
			name = RELEASED_FROM_IN_A_WAR
			limit = {
				FROM = {
					has_opinion_modifier = {
						modifier = released_in_peace
						who = ROOT
					}
					NOT = {
						has_opinion_modifier = {
							modifier = released_in_peace
							who = ROOT
							value = 10
						}
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 1
			}
		}
		add_entry = {
			name = OPINION
			export_to_variable = {
				which = ai_value
				value = opinion
				who = FROM
				with = ROOT
			}
			divide_variable = { which = ai_value value = 4 }
		}
		add_entry = {
			name = FROM_ATTITUDE_TOWARDS_ROOT
			limit = {
				FROM = {
					ai_attitude = { who = ROOT attitude = attitude_neutral }
				}
			}
			export_to_variable = {
				which = ai_value
				value = 20
			}
			multiply_variable = { which = ai_value value = -1 }
		}
		add_entry = {
			name = FROM_ATTITUDE_TOWARDS_ROOT
			limit = {
				FROM = {
					OR = {
						ai_attitude = { who = ROOT attitude = attitude_hostile }
						ai_attitude = { who = ROOT attitude = attitude_outraged }
					}
				}
			}
			export_to_variable = {
				which = ai_value
				value = 1000
			}
			multiply_variable = { which = ai_value value = -1 }
		}
		add_entry = {
			name = MODIFIER_DIPLO_SKILL
			export_to_variable = {
				which = ai_value
				value = modifier:diplomatic_reputation
			}
			multiply_variable = { which = ai_value value = 3 }
		}
		add_entry = {
			name = FROM_HAS_AT_LEAST_HALF_OF_ROOT_TOTAL_DEVELOPMENT
			limit = {
				variable_arithmetic_trigger = {
					export_to_variable = {
						which = our_total_development
						value = trigger_value:total_development
					}
					export_to_variable = {
						which = their_total_development
						value = trigger_value:total_development
						who = FROM
					}
					divide_variable = { which = our_total_development value = 2 }

					check_variable = { which = their_total_development which = our_total_development }
				}
			}
			export_to_variable = {
				which = ai_value
				value = 1000
			}
			multiply_variable = { which = ai_value value = -1 }
		}
		add_entry = {
			name = FROM_HAS_SUBJECTS
			limit = {
				any_country = {
					is_subject_of = FROM
				}
			}
			export_to_variable = {
				which = ai_value
				value = 1000
			}
			multiply_variable = { which = ai_value value = -1 }
		}
		add_entry = {
			name = BORDER_DISTANCE
			export_to_variable = {
				which = ai_value
				value = border_distance
				who = FROM
				with = ROOT
			}
			multiply_variable = { which = ai_value value = -0.5 }
		}
		add_entry = {
			name = ROOT_FROM_MILITARY_POWER_COMPARED
			limit = {
				variable_arithmetic_trigger = {
					export_to_variable = {
						which = our_mil_tech
						value = trigger_value:mil_tech
					}
					export_to_variable = {
						which = their_mil_tech
						value = trigger_value:mil_tech
						who = FROM
					}
					export_to_variable = {
						which = our_army_size
						value = trigger_value:army_size
					}
					export_to_variable = {
						which = their_army_size
						value = trigger_value:army_size
						who = FROM
					}
					export_to_variable = {
						which = military_power
						value = 0
					}
					divide_variable = { which = our_army_size value = 10 }
					divide_variable = { which = their_army_size value = -10 }
					change_variable = { which = our_army_size which = their_army_size }
					multiply_variable = { which = their_mil_tech value = -1 }
					change_variable = { which = our_mil_tech which = their_mil_tech }
					multiply_variable = { which = our_mil_tech value = 3 }
					change_variable = { which = military_power which = our_army_size }
					change_variable = { which = military_power which = our_mil_tech }
					NOT = { check_variable = { which = military_power value = -49 } }
				}
			}
			export_to_variable = {
				which = ai_value
				value = 50
			}
			multiply_variable = { which = ai_value value = -1 }
		}
		add_entry = {
			name = ROOT_FROM_MILITARY_POWER_COMPARED
			limit = {
				variable_arithmetic_trigger = {
					export_to_variable = {
						which = our_mil_tech
						value = trigger_value:mil_tech
					}
					export_to_variable = {
						which = their_mil_tech
						value = trigger_value:mil_tech
						who = FROM
					}
					export_to_variable = {
						which = our_army_size
						value = trigger_value:army_size
					}
					export_to_variable = {
						which = their_army_size
						value = trigger_value:army_size
						who = FROM
					}
					export_to_variable = {
						which = military_power
						value = 0
					}
					divide_variable = { which = our_army_size value = 10 }
					divide_variable = { which = their_army_size value = -10 }
					change_variable = { which = our_army_size which = their_army_size }
					multiply_variable = { which = their_mil_tech value = -1 }
					change_variable = { which = our_mil_tech which = their_mil_tech }
					multiply_variable = { which = our_mil_tech value = 3 }
					change_variable = { which = military_power which = our_army_size }
					change_variable = { which = military_power which = our_mil_tech }
					check_variable = { which = military_power value = -49 }
					NOT = { check_variable = { which = military_power value = 50 } }
				}
			}
			export_to_variable = {
				which = ai_value
				value = 0
			}
			export_to_variable = {
				which = our_mil_tech
				value = trigger_value:mil_tech
			}
			export_to_variable = {
				which = their_mil_tech
				value = trigger_value:mil_tech
				who = FROM
			}
			export_to_variable = {
				which = our_army_size
				value = trigger_value:army_size
			}
			export_to_variable = {
				which = their_army_size
				value = trigger_value:army_size
				who = FROM
			}
			divide_variable = { which = our_army_size value = 10 }
			divide_variable = { which = their_army_size value = -10 }
			change_variable = { which = our_army_size which = their_army_size }
			multiply_variable = { which = their_mil_tech value = -1 }
			change_variable = { which = our_mil_tech which = their_mil_tech }
			multiply_variable = { which = our_mil_tech value = 3 }
			change_variable = { which = ai_value which = our_army_size }
			change_variable = { which = ai_value which = our_mil_tech }
		}
		add_entry = {
			name = ROOT_FROM_MILITARY_POWER_COMPARED
			limit = {
				variable_arithmetic_trigger = {
					export_to_variable = {
						which = our_mil_tech
						value = trigger_value:mil_tech
					}
					export_to_variable = {
						which = their_mil_tech
						value = trigger_value:mil_tech
						who = FROM
					}
					export_to_variable = {
						which = our_army_size
						value = trigger_value:army_size
					}
					export_to_variable = {
						which = their_army_size
						value = trigger_value:army_size
						who = FROM
					}
					export_to_variable = {
						which = military_power
						value = 0
					}
					divide_variable = { which = our_army_size value = 10 }
					divide_variable = { which = their_army_size value = -10 }
					change_variable = { which = our_army_size which = their_army_size }
					multiply_variable = { which = their_mil_tech value = -1 }
					change_variable = { which = our_mil_tech which = their_mil_tech }
					multiply_variable = { which = our_mil_tech value = 3 }
					change_variable = { which = military_power which = our_army_size }
					change_variable = { which = military_power which = our_mil_tech }
					check_variable = { which = military_power value = 50 }
				}
			}
			export_to_variable = {
				which = ai_value
				value = 50
			}
		}
		add_entry = {
			name = ROOT_FROM_ECONOMIC_POWER_COMPARED
			limit = {
				variable_arithmetic_trigger = {
					export_to_variable = {
						which = eco_power
						value = 60
					}
					export_to_variable = {
						which = our_total_development
						value = trigger_value:total_development
					}
					export_to_variable = {
						which = their_total_development
						value = trigger_value:total_development
						who = FROM
					}
					multiply_variable = { which = their_total_development which = their_total_development }
					divide_variable = { which = our_total_development which = their_total_development }
					multiply_variable = { which = eco_power which = our_total_development }
					change_variable = { which = eco_power value = -90 }

					check_variable = { which = eco_power value = -49 }
					NOT = { check_variable = { which = eco_power value = 50 } }
				}
			}
			export_to_variable = {
				which = ai_value
				value = 60
			}
			export_to_variable = {
				which = our_total_development
				value = trigger_value:total_development
			}
			export_to_variable = {
				which = their_total_development
				value = trigger_value:total_development
				who = FROM
			}
			multiply_variable = { which = their_total_development which = their_total_development }
			divide_variable = { which = our_total_development which = their_total_development }
			multiply_variable = { which = ai_value which = our_total_development }
			change_variable = { which = ai_value value = -90 }
		}
		add_entry = {
			name = ROOT_FROM_ECONOMIC_POWER_COMPARED
			limit = {
				variable_arithmetic_trigger = {
					export_to_variable = {
						which = eco_power
						value = 60
					}
					export_to_variable = {
						which = our_total_development
						value = trigger_value:total_development
					}
					export_to_variable = {
						which = their_total_development
						value = trigger_value:total_development
						who = FROM
					}
					multiply_variable = { which = their_total_development which = their_total_development }
					divide_variable = { which = our_total_development which = their_total_development }
					multiply_variable = { which = eco_power which = our_total_development }
					change_variable = { which = eco_power value = -90 }

					NOT = { check_variable = { which = eco_power value = -49 } }
				}
			}
			export_to_variable = {
				which = ai_value
				value = 50
			}
			multiply_variable = { which = ai_value value = -1 }
		}
		add_entry = {
			name = ROOT_FROM_ECONOMIC_POWER_COMPARED
			limit = {
				variable_arithmetic_trigger = {
					export_to_variable = {
						which = eco_power
						value = 60
					}
					export_to_variable = {
						which = our_total_development
						value = trigger_value:total_development
					}
					export_to_variable = {
						which = their_total_development
						value = trigger_value:total_development
						who = FROM
					}
					multiply_variable = { which = their_total_development which = their_total_development }
					divide_variable = { which = our_total_development which = their_total_development }
					multiply_variable = { which = eco_power which = our_total_development }
					change_variable = { which = eco_power value = -90 }

					check_variable = { which = eco_power value = 50 }
				}
			}
			export_to_variable = {
				which = ai_value
				value = 50
			}
		}
		add_entry = {
			name = FROM_IS_IMPERIAL_CITY
			limit = {
				FROM = {
					has_reform = free_city
				}
			}
			export_to_variable = {
				which = ai_value
				value = 1000
			}
			multiply_variable = { which = ai_value value = -1 }
		}
	}

	ai_will_do = {
		num_of_free_diplomatic_relations = 1
		FROM = {
			OR = {
				NOT = { has_country_flag = declined_establish_puppet_state_@ROOT }
				had_country_flag = { flag = declined_establish_puppet_state_@ROOT days = 1825 }
			}
			NOT = { is_subject_of = ROOT }
		}
		is_revolution_target = no
		OR = {
			is_neighbor_of = FROM
			any_rival_country = {
				is_neighbor_of = FROM
			}
		}
		OR = {
			AND = {
				is_great_power = yes
				NOT = { great_power_rank = 4 }
			}
			tag = USA
			tag = ENG
			tag = GBR
			tag = RUS
			tag = SOV
			# Fascist Government Type
			has_reform = fascist_government
			has_reform = military_government
			has_reform = presidential_despot_reform
			# Communist Government Type
			has_reform = peasants_republic
			has_reform = communist_government
			# Capitalist Government Type
			has_reform = administrative_monarchy
			has_reform = constitutional_monarchy
			has_reform = merchants_reform
			has_reform = oligarchy_reform
			has_reform = administrative_republic
			has_reform = constitutional_republic
			has_reform = bureaucratic_despotism
			has_reform = english_monarchy
			has_reform = trading_city
			has_reform = dutch_republic
			has_reform = american_republic
			has_reform = federal_republic
		}
	}
}

cancel_puppet_state = {
	category = influence

	require_acceptance = no

	is_visible = {
		FROM = {
			is_subject_of = ROOT
			is_subject_of_type = puppet_state
		}
	}

	is_allowed = {
		hidden_trigger = {
			FROM = {
				is_subject_of = ROOT
				is_subject_of_type = puppet_state
			}
		}
		is_at_war = no
		FROM = { is_at_war = no }
		NOT = { truce_with = FROM }
	}

	on_accept = {
		if = {
			limit = {
				FROM = {
					is_subject_of = ROOT
					is_subject_of_type = puppet_state
				}
				is_at_war = no
				FROM = { is_at_war = no }
				NOT = { truce_with = FROM }
			}
			if = {
				limit = {
					NOT = { full_idea_group = diplomatic_ideas }
				}
				add_stability = -1
			}
			add_prestige = -20
			FROM = {
				grant_independence = yes
				country_event = { id = subjects_expanded_puppet_state_events.2 }
				add_opinion = {
					who = ROOT
					modifier = released_puppet_state
				}
			}
			add_truce_with = FROM
		}
	}

	ai_will_do = {
		OR = {
			stability = 1
			adm_power = 300
			full_idea_group = diplomatic_ideas
		}
		NOT = {
			OR = {
				total_development = 300
				AND = {
					is_great_power = yes
					NOT = { great_power_rank = 4 }
				}
				tag = USA
				tag = ENG
				tag = GBR
				tag = RUS
				tag = SOV
				# Fascist Government Type
				has_reform = fascist_government
				has_reform = military_government
				has_reform = presidential_despot_reform
				# Communist Government Type
				has_reform = peasants_republic
				has_reform = communist_government
				# Capitalist Government Type
				has_reform = administrative_monarchy
				has_reform = constitutional_monarchy
				has_reform = merchants_reform
				has_reform = oligarchy_reform
				has_reform = administrative_republic
				has_reform = constitutional_republic
				has_reform = bureaucratic_despotism
				has_reform = english_monarchy
				has_reform = trading_city
				has_reform = dutch_republic
				has_reform = american_republic
				has_reform = federal_republic
			}
		}
	}
}