# INSTRUCTIONS:
# -------------
# is_triggered_only - Triggered from within the code or by event effects. DO NOT REMOVE THE STOCK ONES.
# 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.
# no_opinion_hit - If yes you get no negative opinion from this
#
# ROOT = attacker
# FROM = target
#
# 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
# --------------------------------------------------------------

cb_war_on_empire = {
	valid_for_subject = no

	prerequisites_self = {
		has_country_flag = fra_enable_war_on_the_empire_cb_flag
	}

	prerequisites = {
		FROM = { is_part_of_hre = yes } 
	}

	war_goal = war_empire_cb_wgt
}


# Restoration of recently broken PU
cb_restore_personal_union = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 240

	prerequisites_self = {
		OR = {
			government = monarchy
			has_government_attribute = has_dutch_election
		}
		is_revolutionary = no
	}

	prerequisites = {
		FROM = {
			OR = {
				government = monarchy
				has_reform = ambrosian_republic
				# has_reform = military_dictatorship_reform
				has_country_flag = neapolitan_republic
			}
			is_subject = no
		}
	}

	war_goal = take_capital_personal_union
}

#Hundred Years War
cb_hundred_years_war = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 240

	prerequisites_self = {
		OR = {
			government = monarchy
			has_government_attribute = has_dutch_election
		}
		is_revolutionary = no
	}

	prerequisites = {
		FROM = {
			OR = {
				government = monarchy
				has_reform = ambrosian_republic
				# has_reform = military_dictatorship_reform
				has_country_flag = neapolitan_republic
			}
			is_subject = no
		}
	}

	war_goal = take_capital_hundred_years_war
}

# Defected province
cb_defection = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 12

	war_goal = take_core_defection
}

# Cancelled loan
cb_loan_cancelled = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 12

	war_goal = superiority_loan
}

# Hostile spy discovered
cb_spy_discovered = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 12

	war_goal = superiority_spy
}

# Vassal that broke free
cb_disloyal_vassal = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 120

	war_goal = take_capital_disloyal
}

# A HRE prince has been annexed
cb_hre_attacked = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 60

	war_goal = take_province_hre
}

# War of Honor
cb_insult = {
	valid_for_subject = no

	is_triggered_only = yes

	months = 12

	war_goal = superiority_insult_mutual
}

# Dishonored an alliance
cb_dishonored_call = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 96

	war_goal = superiority_insult
}

# CB for vassalization missions
cb_vassalize_mission = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 120

	war_goal = take_capital_vassalize
}

# CB for fabricated claim on throne. (from events)
cb_fabricated_claims = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 12

	war_goal = take_capital_fabricated_claims
}

# CB for Emperor against HRE members that refuse religious conformance
cb_religious_conformance = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 24

	war_goal = take_capital_conformance
}

# Friction along a border
cb_border_war = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 12

	war_goal = take_border
}

# Trade War (from events and others)
cb_trade_war_triggered = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 24

	war_goal = superiority_trade

	attacker_disabled_po = {
		po_demand_provinces
		po_revoke_cores
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
	}
}

cb_trade_conflict = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 24

	war_goal = blockade_ports

	attacker_disabled_po = {
		po_demand_provinces
		po_revoke_cores
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_form_personal_union
		po_become_tributary_state
		po_subjugate_tributary_state
		po_transfer_vassals
	}
}

cb_trade_conflict_triggered = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 24

	war_goal = blockade_ports_mutual

	attacker_disabled_po = {
		po_demand_provinces
		po_revoke_cores
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_form_personal_union
		po_become_tributary_state
		po_subjugate_tributary_state
		po_transfer_vassals
	}
}

cb_trade_league_conflict = {
	valid_for_subject = no

	prerequisites_self = {
		is_trade_league_leader = yes
	}

	prerequisites = {
		can_justify_trade_conflict = FROM
	}
	months = 24

	war_goal = blockade_ports

	attacker_disabled_po = {
		po_demand_provinces
		po_revoke_cores
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
	}
}

cb_annex = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 24

	war_goal = annex_country
}

cb_change_government = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 120

	war_goal = war_goal_change_government
}

# AUTOMATIC - Constantly in effect while 'prerequisites' is true
# --------------------------------------------------------------

# Post Great Peasants War CB against HRE peasants
cb_change_government_great_peasants_war = {
	valid_for_subject = no

	prerequisites_self = {
		OR = {
			has_global_flag = condemned_peasant_republics
			AND = {
				is_emperor = yes
				has_global_flag = great_peasants_war_flag
			}
		}
		is_part_of_hre = yes
		NOT = { has_government_attribute = is_peasants_republic }
		OR = {
			is_emperor = yes
			is_neighbor_of = FROM
		}
		NOT = { government = republic }
	}

	prerequisites = {
		FROM = {
			has_government_attribute = is_peasants_republic
			is_part_of_hre = yes
		}
	}

	war_goal = war_goal_change_government
}

cb_peasants_war_for_peasants = {
	valid_for_subject = no
	
	prerequisites_self = {
		OR = {
			has_global_flag = great_peasants_war_flag
			has_global_flag = gpw_peasants_win_major
		}
		is_part_of_hre = yes
		has_government_attribute = is_peasants_republic
	}

	prerequisites = {
		FROM = {
			NOT = { government = republic }
			is_part_of_hre = yes
		}
		is_neighbor_of = FROM
	}
	
	war_goal = war_goal_peasants_change_government	
}

# One OPM can try to humiliate another OPM.
cb_humiliate = {
	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Conquest of Paradise"
		government = native
		is_revolutionary = no
	}

	prerequisites = {
		NOT = {
			truce_with = FROM
			num_of_cities = 2
			FROM = {
				num_of_cities = 2
			}
		}
		is_neighbor_of = FROM
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_become_vassal
		po_subjugate_vassal
	}

	war_goal = humiliate
}


# Temporary claim CB (mostly used by missions)
cb_conquest = {

	prerequisites = {
		claim = FROM
	}

	war_goal = take_claim
}

# We can take core provinces at no badboy
cb_core = {

	prerequisites = {
		core_claim = FROM
	}

	war_goal = take_core
}

# Independence War
cb_independence_war = {
	exclusive = yes
	independence = yes

	prerequisites_self = {
		is_subject_other_than_tributary_trigger = yes
		NOT = { has_country_flag = burgundy_during_imperial_incident }
	}

	prerequisites = {
		is_subject_of = FROM
		NOT = { is_colonial_nation_of = FROM }
		OR = {
			AND = {
				NOT = { has_reform = daimyo }
				NOT = {
					AND = {
						tag = SOO
						has_government_attribute = is_pirate_republic_reform
					}
				}
				NOT = {
					has_country_flag = ikko_ikki_peasants_flag
				}
			}
			NOT = { from = { has_reform = shogunate } }
		}
	}

	war_goal = defend_capital_independence
}

# Colonial Independence
cb_colonial_independence_war = {
	exclusive = yes
	independence = yes

	prerequisites_self = {
		is_subject = yes
	}

	prerequisites = {
		is_colonial_nation_of = FROM
	}

	war_goal = defend_capital_independence
}

# Triggered Independence - Used for the Sultan's relative rebels
cb_triggered_independence_war = {
	exclusive = yes
	independence = yes
	is_triggered_only = yes
	months = 12

	war_goal = defend_capital_independence
}

# Nationalism
cb_nationalist = {

	prerequisites_self = {
		dip_tech = 68
		is_free_or_tributary_trigger = yes
		is_revolutionary = no
	}

	prerequisites = {
		culture_group_claim = FROM
	}

	war_goal = take_province_nationalist
}

# Napoleonic era imperialism
cb_imperial = {
	valid_for_subject = no

	prerequisites_self = {
		OR = {
			dip_tech = 68
			invasion_nation = yes
		}
		NOT = { has_reform = multi_party_system }
		NOT = { has_country_modifier = european_union }
		is_free_or_tributary_trigger = yes
		is_revolutionary = no
		NOT = { has_reform = war_against_the_world_doctrine_reform }
	}

	war_goal = take_capital_imperial
}



cb_hegemon = {
	valid_for_subject = no

	prerequisites_self = {
		is_hegemon = no
	}

	prerequisites = {
		from = { is_hegemon = yes }
	}

	war_goal = take_capital_imperial
}


# War Against the World CB for pirates
cb_war_against_the_world = {
	valid_for_subject = no

	prerequisites_self = {
		has_reform = war_against_the_world_doctrine_reform
		is_free_or_tributary_trigger = yes
		is_revolutionary = no
	}

	war_goal = take_capital_pirates
}

# Daimyo on Japan
cb_daimyo_annex = {
	valid_for_subject = no
	exclusive = yes
	independence = yes

	prerequisites_self = {
		is_subject = yes
		is_revolutionary = no
	}

	prerequisites = {
		OR = {
			vassal_of = FROM
			junior_union_with = FROM
		}
		OR = {
			has_reform = daimyo
			AND = {
				tag = SOO
				has_government_attribute = is_pirate_republic_reform
			}
			has_country_flag = ikko_ikki_peasants_flag
		}
		from = { has_reform = shogunate }
	}

	war_goal = annex_country_japan
}

cb_independent_daimyo_annex = {
	valid_for_subject = no
	exclusive = yes

	prerequisites_self = {
		is_subject = no
		is_revolutionary = no
	}

	prerequisites = {
		NOT = {
			vassal_of = FROM
			junior_union_with = FROM
		}
		OR = {
			has_reform = indep_daimyo
			AND = {
				tag = SOO
				has_government_attribute = is_pirate_republic_reform
			}
			has_country_flag = ikko_ikki_peasants_flag
		}
		from = { has_reform = shogunate }
	}

	war_goal = annex_country_japan
}

cb_shogun_annex = {
	valid_for_subject = no

	prerequisites_self = {
		has_reform = shogunate
		is_revolutionary = no
	}

	prerequisites = {
		from = {
			OR = {
				has_reform = daimyo
				AND = {
					tag = SOO
					has_government_attribute = is_pirate_republic_reform
				}
				has_country_flag = ikko_ikki_peasants_flag
			}
			OR = {
				num_of_cities = 10
				is_subject = no
			}
		}
	}

	war_goal = annex_country_japan
}

# Sengoku - Daimyo infighting
cb_sengoku = {
	valid_for_subject = no

	prerequisites_self = {
		is_subject = yes
		is_revolutionary = no
		OR = {
			has_reform = daimyo
			AND = {
				tag = SOO
				has_government_attribute = is_pirate_republic_reform
			}
			has_country_flag = ikko_ikki_peasants_flag
		}
	}

	prerequisites = {
		is_neighbor_of = FROM
		from = {
			OR = {
				has_reform = daimyo
				AND = {
					tag = SOO
					has_government_attribute = is_pirate_republic_reform
				}
				has_country_flag = ikko_ikki_peasants_flag
			}
			is_subject = yes
		}
	}

	war_goal = annex_country_japan
}

# Revolutionary CB
cb_revolutionary = {
	valid_for_subject = no

	prerequisites_self = {
		cb_on_government_enemies = yes
		is_revolutionary = no
		NOT = {
			has_reform = papacy_reform
			has_reform = steppe_horde
			has_government_attribute = has_dutch_election
			has_reform = celestial_empire
			has_reform = iqta
			has_reform = mamluk_government
			has_reform = daimyo
			has_reform = shogunate
			has_reform = colonial_government
			government = native
			has_reform = caliphate_reform
			has_reform = caliphate_theocratic_reform 
		}
	}

	prerequisites = {
		is_neighbor_of = FROM
		FROM = {
			NOT = {
				has_reform = papacy_reform
				has_reform = steppe_horde
				has_government_attribute = has_dutch_election
				has_reform = celestial_empire
				has_reform = iqta
				has_reform = mamluk_government
				has_reform = daimyo
				has_reform = shogunate
				has_reform = colonial_government
				government = native
				has_reform = caliphate_reform
				has_reform = caliphate_theocratic_reform 
			}
		}
		OR = {
			AND = {
				government = monarchy
				FROM = { government = republic }
			}
			AND = {
				government = republic
				NOT = { FROM = { government = republic } }
			}
			AND = {
				NOT = { has_reform = communist_government }
				FROM = { has_reform = communist_government }
			}
			AND = {
				has_reform = communist_government
				FROM = { NOT = { has_reform = communist_government } }
			}
			AND = {
				has_reform = fascist_government
				FROM = { NOT = { has_reform = fascist_government } }
			}
			AND = {
				NOT = { has_reform = fascist_government }
				FROM = { has_reform = fascist_government }
			}
		}
	}

	war_goal = war_goal_change_government_mutual
}

# Colonialist CB
cb_colonial = {

	prerequisites_self = {
		is_revolutionary = no
	}

	prerequisites = {
		colony_claim = FROM
	}

	war_goal = take_colony
}

# Liberation CB
cb_liberation = {

	prerequisites_self = {
		has_country_flag = fra_liberation_wars_enabled
	}

	war_goal = take_capital_liberation
}

# Holy War
cb_crusade = {
	valid_for_subject = no
	holy_war = yes

	prerequisites_self = {
		is_revolutionary = no
		NOT = { has_government_attribute = has_upgraded_holy_wars }
		NOT = { religion = secularism }
	}

	prerequisites = {
		is_neighbor_of = FROM
		NOT = { religion_group = FROM }
		NOT = {	has_matching_religion = FROM }
		OR = {
			AND = {
				crusade_target = { tag = FROM }
				religion = catholic
			}
			AND = {
				FROM = {
					NOT = {
						religion_group = muslim 
					}
					any_owned_province = {
						has_province_flag = jihad_target_province_flag
					}
				}
				religion_group = muslim
				has_global_flag = active_jihad
				OR = {
					has_country_flag = jihad_caller
					any_country = {
						has_country_flag = jihad_caller
						religion = ROOT
					}
				}
			}
			cb_on_religious_enemies = yes
		}
	}

	war_goal = superiority_crusade
}

# Holy War
cb_crusade_pheasants = {
	valid_for_subject = no
	holy_war = yes
	is_triggered_only = yes
	months = 60
	
	prerequisites_self = {
		NOT = { religion = secularism }
	}

	prerequisites = {
		NOT = {
			has_casus_belli = {
				type = cb_crusade
				target = from
			}
		}
		NOT = { religion_group = FROM }
		NOT = {	has_matching_religion = FROM }
	}

	war_goal = superiority_crusade
}

# Defender of the Faith
cb_defender_of_the_faith = {
	valid_for_subject = no

	prerequisites_self = {
		is_defender_of_faith = yes
		cb_on_religious_enemies = yes
		is_revolutionary = no
	}

	prerequisites = {
		is_neighbor_of = FROM
		NOT = {	has_matching_religion = FROM }
		OR = {
			hre_religion_treaty = no
			capital_scope = { is_part_of_hre = no }
			FROM = { capital_scope = { is_part_of_hre = no } }
		}
	}

	war_goal = defend_country_faith
}

# Purging of Heresy
cb_heretic = {
	valid_for_subject = no

	prerequisites_self = {
		is_revolutionary = no
	}

	prerequisites = {
		is_neighbor_of = FROM
		religion_group = from
		NOT = {	has_matching_religion = FROM }
		OR = {
			cb_on_religious_enemies = yes
			FROM = { has_ruler_flag = hussite_heretic }
		}
		OR = {
			NOT = { has_dlc = "Art of War" }
			hre_religion_treaty = no
			capital_scope = { is_part_of_hre = no }
			FROM = { capital_scope = { is_part_of_hre = no } }
		}
	}

	war_goal = superiority_heretic
}

# Holy War
cb_external_perfectionism = {
	valid_for_subject = no
	holy_war = yes

	prerequisites_self = {
		has_dlc = "Mandate of Heaven"
		religion = confucianism
		is_revolutionary = no
		OR = {
			full_idea_group = humanist_ideas	#Oh, the irony
			cb_on_religious_enemies = yes
		}
	}

	prerequisites = {
		is_neighbor_of = FROM
		FROM = { NOT = { religion = ROOT } }
	}

	war_goal = superiority_crusade
}

# Excommunication War
cb_excommunication = {
	valid_for_subject = no

	prerequisites_self = {
		religion = catholic
		is_excommunicated = no
		is_revolutionary = no
	}

	prerequisites = {
		FROM = {
			is_excommunicated = yes
			religion = catholic
		}
		FROM = {
			is_neighbor_of = ROOT
			any_owned_province = {
				OR = {
					is_core = ROOT
					is_claim = ROOT
					any_neighbor_province = {
						owned_by = ROOT
					}
				}
			}
		}
		OR = {
			hre_religion_treaty = no
			capital_scope = { is_part_of_hre = no }
			FROM = { capital_scope = { is_part_of_hre = no } }
		}
	}

	war_goal = take_province_excommunication
}

# Trade War
cb_trade_war = {

	prerequisites_self = {
		is_revolutionary = no
	}

	prerequisites = {

		OR = {
			AND = {
				trade_embargo_by = FROM
				NOT = { FROM = { trade_embargo_by = ROOT } }
			}
			AND = {
				has_government_attribute = is_merchant_republic
				FROM = { has_government_attribute = is_merchant_republic }
			}
		}
	}

	war_goal = superiority_trade_mutual

	attacker_disabled_po = {
		po_demand_provinces
		po_revoke_cores
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
	}
}

# Trade War for embargoed Trade League members
cb_trade_league_dispute = {

	prerequisites_self = {
		is_trade_league_leader = yes
		is_revolutionary = no
	}

	prerequisites = {
		NOT = { ROOT = { trade_embargo_by = FROM } }
		ROOT = { trade_league_embargoed_by = FROM }
	}

	war_goal = superiority_trade_mutual

	attacker_disabled_po = {
		po_demand_provinces
		po_revoke_cores
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
	}
}

# Imperial Ban
cb_imperial_ban = {
	valid_for_subject = no

	prerequisites_self = {
		is_emperor = yes
		is_imperial_ban_allowed = yes
		is_revolutionary = no
	}

	prerequisites = {
		FROM = {
			capital_scope = { is_part_of_hre = no }
			any_owned_province = {
				is_part_of_hre = yes
			}
		}
	}

	war_goal = take_province_ban
}

cb_imperial_ban_incident = {
	valid_for_subject = no

	prerequisites_self = {
		is_emperor = yes
		is_imperial_ban_allowed = yes
		is_revolutionary = no
	}

	prerequisites = {
		FROM = {
			capital_scope = { is_part_of_hre = no }
			any_owned_province = {
				is_part_of_hre = yes
			}
		}
	}

	war_goal = take_capital_ban
}

# Liberate Elector
cb_liberate_elector = {
	valid_for_subject = no

	prerequisites_self = {
		is_emperor = yes
		is_revolutionary = no
	}

	prerequisites = {
		FROM = {
			any_subject_country = {
				is_elector = yes
			}
		}
	}

	war_goal = superiority_liberation
}

# Coalition CB
cb_super_badboy = {
	coalition = yes

	prerequisites_self = {
		num_of_coalition_members = 3
		is_revolutionary = no		
	}

	prerequisites = {
		coalition_target = FROM
		NOT = { FROM = { is_in_coalition_war = yes } }
	}

	war_goal = superiority_punitive
}


# Claim Throne
cb_claim_throne = {
	valid_for_subject = no

	prerequisites_self = {
		is_revolutionary = no
	}

	prerequisites = {
		succession_claim = FROM
	}

	war_goal = take_capital_throne
}

# Horde vs Civilized
cb_horde_vs_civ = {
	valid_for_subject = no

	prerequisites_self = {
		is_nomad = yes
		is_revolutionary = no
	}

	prerequisites = {
		is_neighbor_of = FROM
		FROM = {
			is_nomad = no
		}
	}

	war_goal = superiority_horde
}

# Tribal vs Tribal Feud
cb_tribal_feud = {
	valid_for_subject = no

	prerequisites_self = {
		OR = {
			is_nomad = yes
			has_reform = barbarian_reform
		}
		
		is_revolutionary = no
		
	}

	prerequisites = {
		OR = {
			is_nomad = yes
			has_reform = barbarian_reform
		}
		is_neighbor_of = FROM
	}

	war_goal = take_province_tribal_feud
}

# Revoke electorate
cb_revoke_electorate = {
	no_opinion_hit = yes

	prerequisites_self = {
		NOT = { has_dlc = "Common Sense" } # replaced by revoke elector diploaction
		NOT = { has_dlc = "Art of War" } # breaks league system
		is_emperor = yes
		is_revolutionary = no
	}

	prerequisites = {
		FROM = {
			is_elector = yes
		}
		NOT = { religion = FROM }
	}

	war_goal = revoke_elector
}

# When someone is privateering in a node that you trade and have some power in.
cb_privateers = {
	prerequisites_self = {
		is_revolutionary = no
	}

	prerequisites = {
		FROM = {
			has_privateers = yes
		}
		or = {
			home_trade_node = {
				trade_share = {
					country = ROOT
					share = 10
				}
				privateer_power = {
					country = FROM
					share = 1
				}
			}
			any_active_trade_node = {
				trade_share = {
					country = ROOT
					share = 10
				}
				privateer_power = {
					country = FROM
					share = 1
				}
			}
		}
	}

	war_goal = blockade_ports
}

# War in support of rebels
cb_support_rebels = {
	support_rebels = yes
	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Art of War"
	}

	prerequisites = {
		has_spawned_supported_rebels = FROM
	}

	war_goal = take_capital_support_rebels
}

# Revolution
cb_crush_the_revolution = {
	ai_peace_desire = -50
	valid_for_subject = no

	prerequisites_self = {
		is_revolutionary = no
		is_free_or_tributary_trigger = yes
		NOT = {
			OR = {
				current_age = industrial_age
				current_age = great_war_age
				current_age = information_age
			}
		}
	}

	prerequisites = {
		OR = {
			is_neighbor_of = FROM
			NOT = {
				border_distance = {
					who = FROM
					distance = 200
				}
			}
		}
		NOT = { truce_with = FROM }
		FROM = {
			is_revolutionary = yes
		}
	}

	war_goal = take_capital_revolution
}

cb_spread_the_revolution = {
	valid_for_subject = no

	prerequisites_self = {
		NOT = {
			OR = {
				current_age = industrial_age
				current_age = great_war_age
				current_age = information_age
			}
		}
		is_revolutionary = yes
		OR = {
			ai = no
			capital_scope = { continent = europe }
			is_revolution_target = yes
		}
	}

	prerequisites = {
		FROM = {
			NOT = { is_subject_of = ROOT }
			is_revolutionary = no
		}
	}

	war_goal = superiority_revolution
}

cb_annex_the_revolution = {
	valid_for_subject = no

	prerequisites_self = {
		is_revolutionary = yes
	}

	prerequisites = {
		FROM = {
			NOT = { is_subject_of = ROOT }
			is_revolutionary = yes
		}
	}

	war_goal = superiority_annex_revolution
}

cb_religious_league = {
	league = yes
	ai_peace_desire = -50

	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Art of War"
		is_in_league_war = no
		is_league_leader = yes
		is_revolutionary = no
	}

	prerequisites = {
		FROM = {
			is_emperor = yes
			is_in_league_war = no
		}
		hre_heretic_religion = ROOT
		is_league_enemy = FROM
	}

	war_goal = superiority_religious_league
}

cb_flower_wars = {

	valid_for_subject = no

	prerequisites_self = {
		OR = {
			has_dlc = "El Dorado"
			has_dlc = "Winds of Change"
		}
		religion = nahuatl
		is_free_or_tributary_trigger = yes
		is_religion_reformed = no
	}

	prerequisites = {
		FROM = {
			NOT = { is_subject_of = ROOT }
		}
		is_neighbor_of = FROM
	}

	war_goal = take_capital_vassalize_flower_wars
}

cb_maya_expansion = {

	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "El Dorado"
		religion = mesoamerican_religion
		is_free_or_tributary_trigger = yes
		is_religion_reformed = no
	}

	prerequisites = {
		FROM = {
			NOT = { is_subject_of = ROOT }
			religion_group = american_pagan
		}
		is_neighbor_of = FROM
	}

	war_goal = take_capital_mayan
}

# Rival Humiliate CB
cb_humiliate_rotw = {
	valid_for_subject = no

	prerequisites_self = {
		ai = no
		is_revolutionary = no
	}

	prerequisites = {
		NOT = {
			truce_with = FROM
		}
		is_rival = FROM
	}

	attacker_disabled_po = {
		po_demand_provinces
		po_release_vassals
		po_release_annexed
		po_return_cores
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
		po_form_personal_union
		po_transfer_vassals
	}

	war_goal = humiliate_rotw
}

# Reunification of China
cb_chinese_unification = {
	valid_for_subject = no

	prerequisites_self = {
		is_free_or_tributary_trigger = yes
		OR = {
			AND = {
				has_dlc = "Mandate of Heaven"
				is_emperor_of_china = yes
			}
			AND = {
				NOT = { has_dlc = "Mandate of Heaven" }
				culture_group = east_asian #Chinese
				OR = {	#Manchus won't get this unless they unify
					tag = MCH
					tag = QNG
					NOT = { primary_culture = manchu }
				}
			}
			has_reform = warlord_state
			has_government_attribute = has_unify_china_cb
		}
	}

	prerequisites = {		
		FROM = { #Applies against other powers in China unless they have the Mandate of Heaven
			NOT = { is_subject_of = ROOT }
			OR = {
				has_dlc = "Mandate of Heaven"
				culture_group = east_asian #Chinese
			}
			any_owned_province = {
				OR = {
					region = north_china_region
					region = xinan_region
					region = south_china_region
				}
			}
			NOT = { has_country_modifier = the_mandate_of_heaven }
			is_emperor_of_china = no
		}
		is_neighbor_of = FROM
	}

	attacker_disabled_po = {
		po_become_tributary_state
		po_subjugate_tributary_state
	}

	war_goal = superiority_chinese_unification
}

# Take the Mandate of Heaven
cb_take_mandate = {
	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Mandate of Heaven"
		is_subject = no
		NOT = { has_reform = shogunate }
		is_revolutionary = no
		OR = {
			has_country_flag = mmetr_can_claim_mandate_of_heaven_cb_flag 	#MMETR added for unlocking CB
			religion_group = pagan
			religion_group = eastern
			religion_group = buddhic
		}
		OR = {
			ai = no
			culture_group = east_asian
			any_owned_province = {
				culture_group = east_asian
				has_owner_accepted_culture = yes
			}
		}
	}

	prerequisites = {
		is_neighbor_of = FROM
		FROM = { is_emperor_of_china = yes }
		NOT = { truce_with = FROM }		
	}

	war_goal = take_capital_take_mandate
}

# Forced our ally to break alliance
cb_forced_break_alliance = {

	valid_for_subject = no
	is_triggered_only = yes
	months = 120
	
	war_goal = superiority_insult
}

cb_force_tributary = {

	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Mandate of Heaven"
		is_emperor_of_china = yes
	}

	prerequisites = {
		FROM = { is_subject = no }
		is_neighbor_of = FROM
		OR = {
			ai = no
			AND = {
				OR = {
					NOT = { ROOT = { capital_scope = { superregion = china_superregion } } }
					AND = {
						ROOT = { capital_scope = { superregion = china_superregion } }
						NOT = { FROM = { any_owned_province = { superregion = china_superregion } } }
					}
				}
				OR = {
					NOT = { ROOT = { capital_scope = { region = japan_region } } }
					AND = {
						ROOT = { capital_scope = { region = japan_region } }
						NOT = { FROM = { any_owned_province = { region = japan_region } } }
					}
				}
			}
		}
	}
	
	war_goal = take_capital_force_tributary
}

cb_force_tributary_mission = {

	valid_for_subject = no

	is_triggered_only = yes
	months = 300
	
	war_goal = take_capital_force_tributary
}

cb_hundred_years_union = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 360
	
	prerequisites_self = {
		OR = {
			tag = ENG
			tag = GBR
		}
	}

	war_goal = take_capital_personal_union
}

cb_force_join_hre = {
	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Emperor"
		is_emperor = yes
		hre_reform_passed = emperor_reichsstabilitaet
	}

	prerequisites = {
		can_use_peace_treaty = {
			who = FROM
			treaty = po_join_empire
		}
		FROM = {
			religion_group = ROOT
			capital_scope = {
				same_continent = ROOT
				is_part_of_hre = no
			}
			any_owned_province = {
				any_neighbor_province = {
					is_part_of_hre = yes
				}
			}
		}
	}

	war_goal = take_capital_force_join_hre
}

cb_reintegrate_into_hre = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 120

	war_goal = take_capital_reintegrate_into_hre
}

# A HRE prince has been annexed
cb_imperial_realm_war = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 12

	call_empire_members = yes

	war_goal = superiority_reichskrieg
}
# Force religion on Heathens
cb_world_crusade = {
	valid_for_subject = no

	prerequisites_self = {
		OR = {
			has_country_flag = enabled_great_holy_war_cb
			has_government_attribute = has_upgraded_holy_wars
		}
		is_revolutionary = no
	}

	prerequisites = {
		NOT = { religion = FROM }
		NOT = {	has_matching_religion = FROM }
		OR = {
			is_neighbor_of = FROM
			claim = FROM
			cb_on_religious_enemies = yes
			has_country_flag = enabled_great_holy_war_cb
			AND = {
				FROM = {
					OR = {
						religion_group = pagan 
						religion_group = hellenic
						religion_group = american_pagan
						religion_group = slavic_pagan
						religion_group = german_pagan
						religion_group = african_pagan
						religion_group = mesopotamian
					}
				}
				OR = {
					cb_on_primitives = yes
					cb_on_overseas = yes
					has_reform = mission_to_civilize_reform
				}
			}
		}
	}

	war_goal = superiority_world_crusade
}
# Force religion on Heathens
cb_war_against_heresy = {
	valid_for_subject = no

	prerequisites_self = {
		has_country_flag = war_against_heresy_flag
		is_revolutionary = no
	}

	prerequisites = {
		religion_group = FROM
		NOT = { religion = FROM }
		NOT = {	has_matching_religion = FROM }
	}

	war_goal = superiority_world_crusade
}

# CB for Majapahit
cb_vassalize_majapahit = {
	valid_for_subject = no

	prerequisites_self = {
		mission_completed = mnd_maj_enforce_loyalty
	}

	prerequisites = {
		FROM = {
			is_free_or_tributary_trigger = yes
			OR = {
				culture_group = malay
				AND = {
					technology_group = chinese
					ROOT = { mission_completed = mnd_maj_gaja_madas_oath }
				}
				ROOT = { mission_completed = mnd_maj_subjugate_the_mainland }
			}
		}
	}

	war_goal = take_capital_vassalize_maj
}

# For Malacca
cb_vassalize_malacca = {
	valid_for_subject = no

	prerequisites_self = {
		mission_completed = mnd_mlc_destroy_majapahit
	}

	prerequisites = {
		FROM = {
			is_free_or_tributary_trigger = yes
			culture_group = malay
		}
	}

	war_goal = take_capital_vassalize_maj
}

cb_sword_of_islam = {
	valid_for_subject = no

	prerequisites_self = {
		mission_completed = atj_porch_of_mecca
		religion = sunni
	}

	prerequisites = {
		FROM = {
			NOT = { religion_group = muslim }
			OR = {
				primary_culture = sumatran
				AND = {
					ROOT = { mission_completed = atj_sumatra_islam }
					OR = {
						primary_culture = javanese
						primary_culture = sundanese
					}
				}
				AND = {
					ROOT = { mission_completed = atj_java_islam }
					OR = {
						primary_culture = sulawesi
						primary_culture = moluccan
					}
				}
				AND = {
					ROOT = { mission_completed = atj_moluccas_islam }
					is_neighbor_of = ROOT
				}
			}
		}
	}

	war_goal = superiority_world_crusade
}

# Force migration
cb_force_migration = {

	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Conquest of Paradise"
		OR = {
			is_native_tribe = yes
			is_migratory_tribe = yes
		}
	}

	prerequisites = {
		FROM = {
			is_migratory_tribe = yes
			OR = {
				AND = {
					is_native_tribe = yes
					capital_scope = {
						tribal_land_of = ROOT
					}
				}
				is_native_tribe = no
			}
		}
	}
	war_goal = force_migration
}

# 
cb_native_american_tribal_feud = {
	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Conquest of Paradise"
		is_native_tribe = yes
	}

	prerequisites = {
		FROM = {
			is_native_tribe = yes
			if = {
				limit = { 
					capital_scope = {
						tribal_land_of = FROM
					}
				}
				is_neighbor_of = ROOT # This is faster method so let's do this for the general case
			}
			else = {
				any_tribal_land = {
					any_neighbor_province = {
						tribal_land_of = ROOT
					}
				}
			}
		}
	}
	war_goal = take_native_american_land

	attacker_disabled_po = {
		po_become_vassal
		po_subjugate_vassal
		po_become_tributary_state
		po_subjugate_tributary_state
	}
}

# Burn European Colonies
cb_push_back_colonizers = {
	valid_for_subject = no

	prerequisites_self = {
		has_dlc = "Conquest of Paradise"
		is_native_tribe = yes
	}

	prerequisites = {
		FROM = {
			is_native_tribe = no
			OR = {
				is_neighbor_of = ROOT
				any_owned_province = {
					tribal_land_of = ROOT
				}
			}
		}
	}

	war_goal = push_back_colonizers
}

# CB for the Norwegian Crown
cb_claim_norwegian_throne = {
	valid_for_subject = no

	prerequisites = {
		FROM = {
			any_subject_country = {
				tag = NOR
			}
		}
	}

	is_triggered_only = yes
	months = 600

	war_goal = take_capital_norwegian_throne
}

# CB for enforcing becoming an elector
cb_enforce_electorate_right = {
	valid_for_subject = no

	prerequisites_self = {
		is_part_of_hre = yes
		is_elector = no
		is_emperor = no
		any_subject_country = {
			is_elector = yes
		}
	}

	prerequisites = {
		FROM = {
			is_emperor = yes
		}
	}

	war_goal = war_goal_usurp_electorate
}

#Cut because the Grand Crusade war doesn't really have any place in the current content, but it could be very useful for the future.
#Also modders should have the chance to just uncomment it all so they can experience the great 30 Years War like Crusade.
# Grand Crusade
#cb_grand_crusade = {
#	valid_for_subject = no
#	holy_war = yes
#
#	prerequisites = {
#		religion = catholic
#		has_country_flag = can_declare_grand_crusade_wars
#		FROM = { 
#			total_development = 300
#			any_owned_province = {
#				OR = {
#					area = palestine_area
#					area = syria_area
#					area = aleppo_area
#					continent = europe
#				}
#			}
#		}
#		NOT = { religion_group = FROM }
#		NOT = {	has_matching_religion = FROM }
#		is_revolutionary = no
#	}
#
#	war_goal = superiority_grand_crusade
#}
#cb_grand_crusade: "Grand Crusade"
#cb_grand_crusade_desc: "They are accursed yet powerful infidels, and a threat to the Christian world!\n§YCatholic and the enemy's brethren of faith can join their respected side mid this war.§!\n§RCannot declare other wars while using this casus belli.§!"

# Unite the Balkans cb - dangerously close to fantasy here
cb_unite_balkans = {
	valid_for_subject = no

	prerequisites_self = {
		has_country_flag = enable_unite_balkans_cb_flag
		is_revolutionary = no
	}

	prerequisites = {
		FROM = {
			any_owned_province = {
				region = balkan_region
			}
		}
	}

	war_goal = take_province_balkans
}

# CB for the Ottomans to create an Eyalet - Mission Reward
cb_ottoman_subjugation_war = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 60

	war_goal = take_capital_eyalet_war
}

# Eyalet that broke free
cb_disloyal_eyalet = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 120

	war_goal = take_capital_disloyal
}

# CB for the Ottomans to create an Eyalet - Mission Reward
cb_ottoman_invasion = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 600

	war_goal = take_capital_ottoman_invasion
}

conquer_china_cb = {

	prerequisites_self = {
		has_country_flag = access_conquest_of_china_cb_flag
	}

	prerequisites = {
		FROM = { 
			NOT = { is_subject_of = ROOT }
			culture_group = east_asian #Chinese
			any_owned_province = {
				OR = {
					region = north_china_region
					region = xinan_region
					region = south_china_region
				}
			}
		}
		is_neighbor_of = FROM
	}

	war_goal = take_capital_imperial
}

cb_spread_islam = {
	valid_for_subject = no
	holy_war = yes
	
	prerequisites_self = {
		mission_completed = ARB_caliphal_ambitions
	}
	prerequisites = {
		FROM = {
			NOT = { religion_group = muslim }
		}
		OR = {
			AND = {
				mission_completed = ARB_sicily
				FROM = {
					capital_scope = {
						region = italy_region
					}
				}
			}
			AND = {
				mission_completed = ARB_tours
				FROM = {
					capital_scope = {
						OR = {
							region = france_region
							region = iberia_region
						}
					}
				}
			}
			AND = {
				has_country_flag = ARB_cb_on_fetishists_in_south_africa_flag
				FROM = {
					capital_scope = {
						superregion = southern_africa_superregion
					}
				}
			}
			AND = {
				mission_completed = ARB_ottomans
				FROM = {
					capital_scope = { region = balkan_region }
				}
			}
		}
	}
	
	war_goal = ARB_spread_islam_wargoal
}

# Force Conversion Only CB - must be fabricated
cb_spread_the_true_faith = {
	valid_for_subject = no
	holy_war = yes
	is_triggered_only = yes
	months = 60

	war_goal = superiority_spread_the_true_faith
}

# Spread Communism
cb_spread_communism = {
	valid_for_subject = no
	
	prerequisites_self = {
		is_subject = no
		has_reform = communist_government
		is_revolutionary = no
	}
	
	prerequisites = {
		FROM = {
			NOT = { has_reform = communist_government }
		}
	}

	war_goal = war_goal_spread_communism
}

# Spread Fascism
cb_spread_fascism = {
	valid_for_subject = no
	
	prerequisites_self = {
		is_subject = no
		has_reform = fascist_government
		is_revolutionary = no
	}
	
	prerequisites = {
		FROM = {
			NOT = { has_reform = fascist_government }
		}
	}

	war_goal = war_goal_spread_fascism
}

# Export Democracy
cb_spread_democracy = {
	valid_for_subject = no
	
	prerequisites_self = {
		is_subject = no
		has_reform = democracy_reform
		is_revolutionary = no
	}
	
	prerequisites = {
		FROM = {
			OR = {
				has_reform = dictatorial_rule
				has_reform = authoritarian_rule
				has_reform = single_party_system
			}
		}
	}

	war_goal = war_goal_change_government
}

# Imperial Rome cb
cb_roman_imperial = {
	valid_for_subject = no
	
	prerequisites_self = {
		has_country_flag = rome_formed
		tag = ROM
		is_subject = no
		is_revolutionary = no
	}
	
	prerequisites = {
		FROM = { #Imperial borders
			NOT = { is_subject_of = ROOT }
			any_owned_province = {
				OR = {
					region = france_region
					region = iberia_region
					region = italy_region
					region = balkan_region
					region = low_countries_region
					region = british_isles_region
					region = anatolia_region
					region = mashriq_region
					region = egypt_region
					region = maghreb_region
					region = north_german_region
					region = south_german_region
				}
			}
		}
		is_neighbor_of = FROM
	}
	
	war_goal = superiority_roman_imperialism
}

# Caliphal Subjugation
cb_caliphal_subjugation = {
	valid_for_subject = no
	
	prerequisites_self = {
		has_reform = caliphate_reform
		is_subject = no
		is_revolutionary = no
	}
	
	prerequisites = {
		FROM = {
			religion_group = muslim
			NOT = { is_subject_of = ROOT }
		}
		is_neighbor_of = FROM
	}
	
	war_goal = superiority_caliphal_subjugation
}

# Sphere country
#cb_sphere_of_influence = {
#	valid_for_subject = no
#	
#	prerequisites = {
#		is_great_power = yes
#		adm_tech = 77
#		FROM = {
#			NOT = { is_subject_of = ROOT }
#			is_great_power = no
#		}
#		
#		is_revolution_target = no
#	}
#	
#	war_goal = superiority_sphere
#	
#	attacker_disabled_po = {
#		po_annex
#		po_demand_provinces
#		po_revoke_cores
#		po_release_vassals
#		po_release_annexed
#		po_return_cores
#	}
#}

cb_salic_reunification = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 600
	
	prerequisites_self = {
		has_reform = salic_reform
		is_subject = no
	}

	prerequisites = {
		FROM = {
			has_reform = salic_reform
			is_subject = no
		}
	}

	war_goal = take_capital_salic
}


#New added MMETR

cb_conclude_civil_war = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 600
	
	prerequisites_self = {
		is_subject = no
	}

	prerequisites = {
		FROM = {
			has_country_flag = civil_war_breakaway_country_flag
		}
	}

	war_goal = civil_war_wargoal
}
cb_claim_eastern_provinces = {
	valid_for_subject = no

	is_triggered_only = yes
	months = 600
	
	prerequisites_self = {
		has_country_flag = plm_corrector_totius_orientis_flag
	}

	prerequisites = {
		FROM = {
			NOT = { is_subject_of = ROOT }
		}
		is_neighbor_of = FROM
	}

	war_goal = take_capital_palmyra
}
