bellorum_casus_belli = {
	name = CB_NAME_BELLO
	war_name = WAR_NAME_BELLO
	sprite = 7
	truce_days = 3650
	full_hostility = yes
	is_permanent = yes

	can_use = {
		ROOT = {
			mercenary = no
			OR = {
				is_feudal = yes
				is_tribal = yes
			}
			FROM = {
				any_realm_province = {
					any_neighbor_province = {
						OR = {
							AND = {
								has_owner = yes
								owner = {
									OR = {
										character = ROOT
										is_liege_or_above = ROOT
									}
								}
							}
							AND = {
								is_land = no
								any_neighbor_province = {
									AND = {
										has_owner = yes
										owner = {
											OR = {
												character = ROOT
												is_liege_or_above = ROOT
											}
										}
									}
								}
							}
						}
					}
				}
			}
			OR = {
				AND = {
					FROM = { culture = ROOT }
					FROM = { religion = ROOT }
				}
				FROM = { any_rival = { character = ROOT } }
				FROM = {
					NOT = {
						religion_group = ROOT
					}
				}
				FROM = {
					NOT = {
						religion = ROOT
					}
					religion_group = muslim
				}
			}
		}
	}

	can_use_gui = {
		check_if_crusader_trigger = yes
		ROOT = {
			scaled_wealth = 4
		}
	}
	
	is_valid = {
		ROOT = {
			mercenary = no
			OR = {
				is_feudal = yes
				is_tribal = yes
			}
		}
	}

	on_add = {
		hidden_tooltip = { fire_haruspicy_event_effect = yes }
		if = {
			limit = { defender = { is_offmap_governor = offmap_china } }
			attacker = {  
				sound_effect = china_angered_emperor
				detract_grace_super_huge_effect = yes 
			}
		}
		ROOT = {
			scaled_wealth = -4
		}
	}

	on_success = {
		ROOT = {
			show_scope_change = no
			prestige = 200
		}
		ROOT = {
			show_scope_change = no
			participation_scaled_prestige = 200
		}
		any_attacker = {
			limit = { NOT = { character = ROOT } }
			hidden_tooltip = { participation_scaled_prestige = 200 }
		}
		ROOT = {
			occupy_minors_of_occupied_settlements = FROM
			gain_all_occupied_titles = FROM
		}
		FROM = {
			occupy_minors_of_occupied_settlements = ROOT
			gain_all_occupied_titles = ROOT
		}
		FROM = {
			show_scope_change = no
			prestige = -200
		}
	}

	on_fail = {
		ROOT = {
			occupy_minors_of_occupied_settlements = FROM
			gain_all_occupied_titles = FROM
		}
		FROM = {
			occupy_minors_of_occupied_settlements = ROOT
			gain_all_occupied_titles = ROOT
		}
		ROOT = {
			show_scope_change = no
			prestige = -200
		}
		FROM = {
			show_scope_change = no
			prestige = 100
		}
		FROM = {
			show_scope_change = no
			participation_scaled_prestige = 100
		}
		any_defender = {
			limit = { NOT = { character = FROM } }
			hidden_tooltip = { participation_scaled_prestige = 100 }
		}
	}

	on_reverse_demand = {
		ROOT = {
			show_scope_change = no
			prestige = -200
			transfer_scaled_wealth = {
				to = FROM
				value = 20.0
			}
		}
		ROOT = {
			occupy_minors_of_occupied_settlements = FROM
			gain_all_occupied_titles = FROM
		}
		FROM = {
			occupy_minors_of_occupied_settlements = ROOT
			gain_all_occupied_titles = ROOT
		}
		FROM = {
			show_scope_change = no
			prestige = 200
			participation_scaled_prestige = 200
		}
		any_defender = {
			limit = { NOT = { character = FROM } }
			hidden_tooltip = { participation_scaled_prestige = 200 }
		}
	}

	attacker_ai_victory_worth = {
		factor = 150
	}
	
	attacker_ai_defeat_worth = {
		factor = 100
	}

	defender_ai_victory_worth = {
		factor = -1 # always accept
	}
	
	defender_ai_defeat_worth = {
		factor = 100
	}
	
	ai_will_do = {
		factor = 1
		modifier = { #Focus on Coronation first.
			factor = 0.1
			has_dlc = "Holy Fury"
			ROOT = {
				is_feudal = yes
				OR = {
					religion = catholic
					religion = fraticelli
				}
				NOR = {
					trait = crowned_by_priest
					trait = crowned_by_bishop
					trait = crowned_by_pope
					trait = crowned_by_myself
				}
			}
		}
		modifier = {
			factor = 0.01
			ROOT = { ai = yes }
		}
		modifier = {
			factor = 2
			ROOT = { is_tribal = yes }
		}
		modifier = {
			factor = 0.01
			FROM = { religion_group = ROOT }
		}
		modifier = {
			factor = 2
			NOT = { FROM = { religion_group = ROOT }}
		}
	}
}