# INSTRUCTIONS:
# -------------
# is_triggered_only - Triggered from within the code or by event effects. DO NOT REMOVE THE STOCK ONES.
# mutual - The CB effects will also be used by the defender in peace treaties
# months - The number of months this CB will be valid. Only works for triggered CBs.
# prerequisites - A condition that automatically activates a CB. Does not work for triggered CBs. 'THIS' scope is the target country.
# badboy_factor - Multiplied with any badboy increase normally associated with a peace option.
# prestige_factor - Multiplied with any prestige increase normally associated with a peace option.
# peace_cost_factor - Multiplied with the cost of the peace options in the peace treaty
# po_xxx - Peace options. If toggled on, badboy_factor and prestige_factor are multiplied with any associated base changes to these (see defines.txt.)
# allowed_states - If 'po_demand_states' is on, badboy_factor applies to these provinces. 'THIS' scope is us.
# on_add - effect triggered when war goal added (triggering country's scope)

# The peace options are:
#po_annex
#po_demand_state
#po_add_to_sphere
#po_disarmament
#po_reparations
#po_transfer_provinces
#po_remove_prestige
#po_release_puppet
#po_status_quo

# NOTE: The order in which the peace options are listed is the order in which the AI will normally prioritize them in peace treaties

# TRIGGERED - Triggered from within the code or by event effects
# --------------------------------------------------------------

status_quo = {
	sprite_index = 1
	is_triggered_only = yes
	months = 12
	
	is_valid = {
		always = no
	}

	break_truce_prestige_factor = 5
	break_truce_infamy_factor = 2
	break_truce_militancy_factor = 2
	truce_months = 0
	
	badboy_factor = 1
	prestige_factor = 1
	peace_cost_factor = 1
	penalty_factor = 1
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
	
	po_status_quo = yes
	
	war_name = WAR_NAME
}

# Conquest
conquest = {
	sprite_index = 2
	is_triggered_only = yes
	months = 12
	
	is_valid = {
		# only one state or unciv
		or = {
			and = { 
				civilized = no
				NOT = { number_of_states = 5 }
			}
			not = { number_of_states = 2 }
		}
		is_independant = yes
	}

	badboy_factor = 2
	prestige_factor = 5
	peace_cost_factor = 1
	penalty_factor = 1
	
	break_truce_prestige_factor = 5
	break_truce_infamy_factor = 2
	break_truce_militancy_factor = 2
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
	
	po_annex = yes
	
	war_name = WAR_CONQUEST_NAME
}

# Civil war
civil_war = {
	sprite_index = 2
	is_triggered_only = yes
	months = 1
	
	is_valid = {
		# hack to make un-selectable in interface >_<
		is_greater_power = no
		is_greater_power = yes
	}

	badboy_factor = 0
	prestige_factor = 1
	peace_cost_factor = 1
	penalty_factor = 1
	is_civil_war = yes #this is a civil war

	break_truce_prestige_factor = 5
	break_truce_infamy_factor = 2
	break_truce_militancy_factor = 2
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1

	po_annex = yes
	
	war_name = CIVIL_WAR_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}

# Sphere of Influence Gain
add_to_sphere = {
	sprite_index = 3
	is_triggered_only = yes
	months = 12

	badboy_factor = 2
	prestige_factor = 2
	peace_cost_factor = 50
	penalty_factor = 1

	break_truce_prestige_factor = 5
	break_truce_infamy_factor = 2
	break_truce_militancy_factor = 2
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1

	is_valid = {
		this = { is_greater_power = yes }
		is_greater_power = no
		is_independant = yes
		part_of_sphere = no
	}
	
	po_add_to_sphere = yes
	
	war_name = WAR_ADD_SPHERE_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}

take_from_sphere = {
	sprite_index = 4
	is_triggered_only = yes
	months = 12
	
	badboy_factor = 2
	prestige_factor = 3
	peace_cost_factor = 20
	penalty_factor = 1

	break_truce_prestige_factor = 5
	break_truce_infamy_factor = 2
	break_truce_militancy_factor = 2
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1

	is_valid = {
		this = { is_greater_power = yes }
		is_greater_power = yes
	}
	
	# THIS - us
	# FROM - country scope is possible match?
	# war target country of goal is scope
	allowed_countries = {
		is_sphere_leader_of = FROM
	}
	
	po_add_to_sphere = yes
	
	war_name = WAR_TAKE_SPHERE_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}

# Acquire Core State
acquire_core_state = {
	sprite_index = 5
	is_triggered_only = yes
	months = 12

	badboy_factor = 0
	prestige_factor = 5
	peace_cost_factor = 0.7
	penalty_factor = 1
	always = yes

	break_truce_prestige_factor = 5
	break_truce_infamy_factor = 2
	break_truce_militancy_factor = 2
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1

	is_valid = {
		number_of_states = 2 # annex if you want their last state
		any_owned_province = {
			is_core = THIS
		}
	}
	
	allowed_states = {
		any_owned_province = {
			is_core = THIS
		}
		not = { any_owned_province = { is_capital = yes } }
	}

	po_demand_state = yes
	
	war_name = WAR_TAKE_CORE_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}

# Annex Core Country
annex_core_country = {
	sprite_index = 5
	is_triggered_only = yes
	months = 12

	badboy_factor = 0
	prestige_factor = 5
	peace_cost_factor = 0.7
	penalty_factor = 1
	always = yes

	break_truce_prestige_factor = 5
	break_truce_infamy_factor = 2
	break_truce_militancy_factor = 2
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1

	is_valid = {
		any_owned_province = {
			is_core = THIS
		}
		NOT = {
			any_owned_province = {
				NOT = {
					is_core = THIS
				}
			}
		}
	}

	po_annex = yes
	
	war_name = WAR_RESTORE_ORDER_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}

# Gain control of State
acquire_state = {
	sprite_index = 6
	is_triggered_only = yes
	months = 12

	badboy_factor = 2
	prestige_factor = 2
	peace_cost_factor = 1
	penalty_factor = 1

	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 2
	break_truce_militancy_factor = 2
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1

	is_valid = {
		number_of_states = 2 # annex if you want their last state
		any_owned_province = {
			not = { is_core = THIS }
			is_colonial = no
		}
		OR = {
			AND = {
				civilized = yes
				THIS = {
					civilized = yes
				}
			}
			AND = {
				civilized = no
				THIS = {
					civilized = no
				}
			}
		}
		is_independant = yes
	}
	
	allowed_states = {
		is_colonial = no
		any_owned_province = {
			not = {	is_core = THIS }
			is_colonial = no
		}
		not = { any_owned_province = { is_capital = yes } }
	}

	po_demand_state = yes
	
	war_name = WAR_TAKE_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}

# Place in the Sun
place_in_the_sun = {
	sprite_index = 7
	is_triggered_only = yes
	months = 12

	badboy_factor = 1.8
	prestige_factor = 2
	peace_cost_factor = 0.9
	penalty_factor = 1

	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 1
	break_truce_militancy_factor = 1
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1

	is_valid = {
		any_owned_province = {
			is_colonial = yes
		}	
	}
	
	allowed_states = {
		is_colonial = yes
	}

	po_demand_state = yes

	war_name = WAR_COLONIAL_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}

# Cut Down to size
cut_down_to_size = {
	sprite_index = 8
	is_triggered_only = yes
	months = 12

	badboy_factor = 1.1
	prestige_factor = 1
	peace_cost_factor = 25
	penalty_factor = 1

	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 1
	break_truce_militancy_factor = 1
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1

	po_disarmament = yes
	po_reparations = yes

	war_name = WAR_NAME
	
	is_valid = {
		is_disarmed = no
	}
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}

# Free Peoples
free_peoples = {
	sprite_index = 9
	is_triggered_only = yes
	months = 12

	badboy_factor = 1
	prestige_factor = 1
	peace_cost_factor = 1
	penalty_factor = 1

	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 1
	break_truce_militancy_factor = 1
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1

	# THIS - us
	# FROM - country scope is possible match?
	# war target country of goal is scope
	allowed_countries = {
		number_of_states = 2
		NOT = {
			tag = FROM
			this_culture_union = FROM	
		}
		from = {
			OR = {
				exists = yes
				NOT = {
						OR = {
							tag = GER
							tag = SCA
							tag = ITA
							tag = YUG
							tag = ROM
							tag = CZH
						}
					}
				}
			}
		
		any_owned_province = {
			is_core = FROM
			NOT =
			{
				is_core = THIS
			}
		}
		is_releasable_vassal = FROM
	}

	# THIS - us
	# FROM - country scope is possible match?
	# war target country of goal's state
	allowed_states = {
		any_owned_province = {
			is_core = FROM
		}
		#not = { any_owned_province = { is_capital = yes } } #code can deal with capitals they get new state
	}

	po_transfer_provinces = yes

	war_name = WAR_FREE_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}

# Release Puppet
release_puppet = {
	sprite_index = 10
	is_triggered_only = yes
	months = 12

	badboy_factor = 1
	prestige_factor = 1
	peace_cost_factor = 5
	penalty_factor = 1

	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 1
	break_truce_militancy_factor = 1
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1

	is_valid = {
		num_of_vassals = 1
	}
	
	# THIS - us
	# FROM - country scope is possible match?
	# war target country of goal is scope
	allowed_countries = {
		is_our_vassal = FROM
	}
	
	po_release_puppet = yes

	war_name = WAR_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}


# Humiliate
humiliate = {
	sprite_index = 11
	is_triggered_only = yes
	months = 12

	badboy_factor = 0.8
	prestige_factor = 1
	peace_cost_factor = 15
	penalty_factor = 1
	
	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 1
	break_truce_militancy_factor = 1
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1
	
	po_remove_prestige = yes
	
	war_name = WAR_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.25
		}
	}
}

# Demand Concession
demand_concession_casus_belli = {
	sprite_index = 7
	is_triggered_only = yes
	months = 0
	
	badboy_factor = 0.8
	prestige_factor = 0.1
	peace_cost_factor = 0.6
	penalty_factor = 1

	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 1
	break_truce_militancy_factor = 1
	truce_months = 12
	
	good_relation_prestige_factor = 0
	good_relation_infamy_factor = 0
	good_relation_militancy_factor = 0
	
	always = no

	is_valid = {
		THIS = {
			civilized = yes
		}
		civilized = no
		number_of_states = 2
	}
	
	allowed_states = {
		any_owned_province = {
			is_colonial = no
		}
		not = { any_owned_province = { is_capital = yes } }
	}
	
	po_demand_state = yes
	
	war_name = WAR_CONCESSION_NAME

	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.1
		}
	}
}

# Establish Protectorate
establish_protectorate_casus_belli = {
	sprite_index = 7
	is_triggered_only = yes
	months = 0
	
	badboy_factor = 0.8
	prestige_factor = 1
	peace_cost_factor = 1
	penalty_factor = 1

	break_truce_prestige_factor = 5
	break_truce_infamy_factor = 2
	break_truce_militancy_factor = 2
	truce_months = 12
	
	good_relation_prestige_factor = 0
	good_relation_infamy_factor = 0
	good_relation_militancy_factor = 0
	
	always = no
	
	is_valid = {
		THIS = {
			civilized = yes
		}
		OR = {
			NOT = {
				number_of_states = 2 
			}
			AND = {
				THIS = {
					AND = {
						is_greater_power = yes
						nationalism_n_imperialism = 1
					}
				}
				NOT = { number_of_states = 5 }
			}
		}
		civilized = no
	}
	
	po_annex = yes
	
	war_name = WAR_PROTECTORATE_NAME

	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.1
		}
	}
}

# Unification Humiliate
unification_humiliate_cb = {
	sprite_index = 11
	is_triggered_only = yes
	months = 12

	badboy_factor = 0.8
	prestige_factor = 1
	peace_cost_factor = 10
	penalty_factor = 1
	
	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 1
	break_truce_militancy_factor = 1
	truce_months = 0
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1
	
	always = yes
	
	is_valid = {
		culture_has_union_tag = yes
		THIS = {
			is_greater_power = yes
		}
		is_greater_power = yes
		is_culture_group = THIS
		NOT = { is_cultural_union = THIS }
	}
	
	po_clear_union_sphere = yes
	
	war_name = UNIFICATION_HUMILIATE_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.1
		}
	}
}

# Unification Demand State
unification_casus_belli = {
	sprite_index = 5
	is_triggered_only = no
	months = 12
	
	badboy_factor = 0
	prestige_factor = 1
	peace_cost_factor = 1
	penalty_factor = 1

	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 1
	break_truce_militancy_factor = 1
	truce_months = 12
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1
	
	always = yes
	
	is_valid = {
		culture_has_union_tag = yes
		THIS = {
			is_greater_power = yes
			is_cultural_union = no
		}
		NOT = {
			is_culture_group = THIS
		}
		number_of_states = 2
		any_state = {
			any_owned_province = {
				any_core = {
					this_culture_union = this_union
					is_cultural_union = yes
				}
			}
			not = { any_owned_province = { is_capital = yes } }
		}
	}
	allowed_states = {
		any_owned_province = {
			any_core = {
				this_culture_union = this_union
				is_cultural_union = yes
			}
		}
		not = { any_owned_province = { is_capital = yes } }
	}
	
	po_demand_state = yes
	
	war_name = WAR_UNIFICATION_NAME

	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.1
		}
	}
}

#Unification Annex
unification_annex_casus_belli = {
	sprite_index = 5
	is_triggered_only = no
	months = 12
	
	badboy_factor = 0
	prestige_factor = 0
	peace_cost_factor = 1
	penalty_factor = 1

	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 1
	break_truce_militancy_factor = 1
	truce_months = 12
	
	good_relation_prestige_factor = 1
	good_relation_infamy_factor = 1
	good_relation_militancy_factor = 1
	
	always = yes
	
	is_valid = {
		culture_has_union_tag = yes
		THIS = {
			is_greater_power = yes
			is_cultural_union = no
		}
		NOT = {
			is_culture_group = THIS
		}
		NOT = {
			number_of_states = 2
		}
		any_owned_province = {
			any_core = {
				this_culture_union = this_union
				is_cultural_union = yes
			}
		}
	}
	
	po_annex = yes
	
	war_name = WAR_UNIFICATION_ANNEX_NAME

	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.1
		}
	}
}

# Bad Boy
rude_boy = {
	sprite_index = 11
	is_triggered_only = no
	months = 12

	badboy_factor = 0
	prestige_factor = 0.5
	peace_cost_factor = 1.5
	penalty_factor = 1

	break_truce_prestige_factor = 1
	break_truce_infamy_factor = 1
	break_truce_militancy_factor = 1
	truce_months = 0
	
	good_relation_prestige_factor = 0
	good_relation_infamy_factor = 0
	good_relation_militancy_factor = 0
	
	always = yes

	is_valid = {
		badboy = 1
	}
	
	po_remove_prestige = yes
	po_disarmament = yes
	po_reparations = yes
	
	war_name = WAR_RUDEBOI_NAME
	
	on_add = {
		move_issue_percentage = { 
			from = jingoism 
			to = pro_military
			value = 0.1
		}
	}
}
