
WarDeclaredOpening = {
	type = war

	text = {
		trigger = { #War to stop the Gurkhan from becoming Greatest of Khans
			root = {
				using_cb = mpo_great_war_of_defiance_cb
			}
		}
		localization_key =  war_declared_opening_mpo_gok
	}

	text = {
		trigger = {
			root.primary_attacker = {
				opinion = {
					target = root.primary_defender
					value <= -10
				}
			}
		}
		localization_key =  war_declared_opening.negative
	}

	text = {
		trigger = {
			always = no
		}
		fallback = yes
		localization_key =  war_declared_opening.neutral
	}
}

WarDeclaredFlavor = {
	type = war

	text = {
		trigger = { #War to stop the Gurkhan from becoming Greatest of Khans
			root = {
				using_cb = mpo_great_war_of_defiance_cb
			}
		}
		localization_key =  war_declared_flavor_mpo_gok
	}

	text = { # Used when one or more Deviant Lovers manage to get into a war with each other.
		trigger = {
			root.primary_attacker = {
				has_relation_lover = root.primary_defender
			}
			OR = {
				root.primary_attacker = {
					is_deviant_trigger = yes

				}
				root.primary_defender = {
					is_deviant_trigger = yes
				}
			}
		}
		localization_key = war_declared_flavor.naughty
	}

	text = { # Used when Zealous characters are attacking a religious enemy. Also used for excommunication wars.
		trigger = {
			OR = {
				root.primary_attacker = {
					# Attacker must be Zealous
					OR = {
						has_trait = zealous
						ai_zeal >= medium_positive_zeal
					}
					# Defender must belong to a Hostile/Evil Faith, OR must be Sinful in the eyes of the Attacker's Faith.
					OR = {
						faith = {
								faith_hostility_level = {
								target = root.primary_defender.faith
								value >= faith_hostile_level
							}
						}
						root.primary_defender = {
							num_sinful_traits = {
								target = root.primary_attacker.faith
								value >= 1
							}
						}
					}
					# Attacker must also personally dislike the defender, because this text is quite insult-y.
					opinion = {
						target = root.primary_defender
						value <= 20
					}

				}

				# If an excommunication war, use this regardless of attacker/defender's traits.
				root = {
					using_cb = excommunication_war
				}
			}
		}
		localization_key = war_declared_flavor.zealous
	}

	text = { # Used by Greedy characters when declaring a war of conquest.
		trigger = {
			root.primary_attacker = {
				OR = {
					has_trait = greedy
					has_trait = ambitious
				}
			}
			root = {
				OR = {
					using_conquest_cb_trigger = yes
					using_de_jure_cb_trigger = yes
				}
			}
		}
		localization_key = war_declared_flavor.greedy
	}

	text = { # Generic DoW text for all holy wars.
		trigger = {
			root = {
				using_holy_war_cb_trigger = yes
			}
		}
		localization_key = war_declared_flavor.holy_war
	}

	text = { # Generic DoW text for all De Jure (and Claimant) wars.
		trigger = {
			root = {
				using_de_jure_cb_trigger = yes
			}
		}
		localization_key = war_declared_flavor.dejure
	}

	text = { # Used by Arrogant characters when attempting to vassalize/subjugate another character.
		trigger = {
			root = {
				using_hierarchical_cb_trigger = yes
			}
			root.primary_attacker = {
				has_trait = arrogant

				# Attacker must also personally dislike the defender, because this text is quite insult-y.
				opinion = {
					target = root.primary_defender
					value <= 20
				}
			}
		}
		localization_key = war_declared_flavor.subjugation.arrogant
	}

	text = { # Tribal characters have special text for declaring conquest or subjugation wars.
		trigger = {
			root.primary_attacker = {
				government_has_flag = government_is_tribal
			}
			root = {
				OR = {
					using_conquest_cb_trigger = yes
					using_hierarchical_cb_trigger = yes
				}
			}
		}
		localization_key = war_declared_flavor.subjugation.tribal
	}

	text = { # Other characters have a standard subjugation CB DoW.
		trigger = {
			root = {
				using_hierarchical_cb_trigger = yes
			}
		}
		localization_key = war_declared_flavor.subjugation
	}

	text = { # Other characters have a standard subjugation CB DoW.
		trigger = {
			root = {
				using_conquest_cb_trigger = yes
			}
		}
		localization_key = war_declared_flavor.conquest
	}

	text = {
		trigger = {
			root = {
				using_cb = populist_war
			}
		}
		localization_key = war_declared_flavor.populist
	}

	text = {
		trigger = {
			root = {
				using_cb = peasant_war
			}
		}
		localization_key = war_declared_flavor.peasant
	}

	text = {
		trigger = {
			root = {
				using_cb = independence_faction_war
			}
		}
		localization_key = war_declared_flavor.independence
	}

	text = {
		trigger = {
			root = {
				using_cb = liberty_faction_war
			}
		}
		localization_key = war_declared_flavor.liberty
	}

	text = {
		trigger = {
			root = {
				using_cb = claimant_faction_war
			}
		}
		localization_key = war_declared_flavor.claimant
	}

	#TIT-17244: will not appear without this.
	text = {
		trigger = {
			AND = {
				exists = scope:recipient
				scope:recipient = { exists = scope:war_for_retraction_flavour }
			}
		}
		localization_key = war_declared_flavor.retraction_refused
	}

	#TIT-17244: will not appear without this.
	text = {
		trigger = {
			AND = {
				exists = scope:recipient
				scope:recipient = { exists = scope:war_for_revocation_flavour }
			}
		}
		localization_key = war_declared_flavor.revocation_refused
	}

	#TIT-17244: will not appear without this.
	text = {
		trigger = {
			AND = {
				exists = scope:recipient
				scope:recipient = { exists = scope:war_for_imprisonment_flavour }
			}
		}
		localization_key = war_declared_flavor.revocation_refused
	}

	text = { # Fallback DoW text. Ideallty we should never reach this point, but it's here if we need it.
		trigger = {
			always = no
		}
		fallback = yes
		localization_key = war_declared_flavor.fallback
	}
}

#Custom loc for various prison uses
ZealousDoW = {
	type = character

	text = {
		trigger = {
			root.faith = {
				OR = {
					OR = { religion_tag = eastern_orthodox_religion religion_tag = catholic_religion religion_tag = protestant_religion }
					religion_tag = islam_religion
					religion_tag = west_african_roog_religion
				}
			}
		}
		localization_key =war_declared_flavor.zealous.mercifulgod
	}

	text = {
		trigger = {
			root.faith = {
				has_doctrine_parameter = reincarnation_resistance_to_conversion
			}
		}
		localization_key = war_declared_flavor.zealous.reincarnation
	}

	text = {
		trigger = {
			always = no
		}
		fallback = yes
		localization_key = war_declared_flavor.zealous.fallback
	}
}

GetMilitaryStrengthColoredCurrentSituation = {
	type = character

	text = {
		localization_key = military_strength_green_current_situation
		trigger = {
			scope:second.current_military_strength < root.fifty_percent_of_current_military_strength
		}
	}

	text = {
		localization_key = military_strength_red_current_situation
		trigger = {
			scope:second.current_military_strength >= root.current_military_strength
		}
	}

	text = {
		localization_key = military_strength_gray_current_situation
	}
}

WarCasusBelliShort = {
	type = war

	text = {
		trigger = {
			OR = {
				using_cb = claim_cb
				using_cb = claimant_faction_war
				using_cb = norman_conquest_cb
				using_cb = norwegian_invasion_cb
			}
		}
		localization_key = war_memory_cb_claim
	}

	text = {
		trigger = {
			OR = {
				using_cb = county_conquest_cb
				using_cb = duchy_conquest_cb
				using_cb = county_struggle_cb
				using_cb = fp2_mediterranean_conquest_cb
#				using_cb = hungarian_migration_cb
				using_cb = sons_of_lothbrok_invasion_cb
			}
		}
		localization_key = war_memory_cb_conquest
	}

	text = {
		trigger = {
			OR = {
				using_cb = minor_religious_war
				using_cb = religious_war
				using_cb = major_religious_war
			}
		}
		localization_key = war_memory_cb_holy_war
	}

	text = {
		trigger = {
			OR = {
				using_cb = de_jure_cb
				using_cb = individual_county_de_jure_cb
				using_cb = individual_duchy_de_jure_cb
			}
		}
		localization_key = war_memory_cb_de_jure
	}

	text = {
		trigger = {
			OR = {
				using_cb = invasion_war
				using_cb = clan_invasion_war
				using_cb = mongol_invasion_war
				using_cb = mongol_realm_invasion_war
				using_cb = ep3_laamp_adventurer_county_invasion
				using_cb = ep3_laamp_adventurer_duchy_invasion
				using_cb = ep3_laamp_adventurer_kingdom_invasion
				using_cb = ep3_laamp_adventurer_empire_invasion
				using_cb = mpo_gok_onslaught_cb
			}
		}
		localization_key = war_memory_cb_invasion
	}

	text = {
		trigger = {
			OR = {
				using_cb = undirected_great_holy_war
				using_cb = directed_great_holy_war
			}
		}
		localization_key = war_memory_cb_invasion
	}

	text = {
		trigger = {
			OR = {
				using_cb = independence_war
				using_cb = independence_faction_war
			}
		}
		localization_key = war_memory_cb_ghw
	}

	text = {
		trigger = {
			OR = {
				using_cb = independence_war
				using_cb = independence_faction_war
			}
		}
		localization_key = war_memory_cb_independence
	}

	text = {
		trigger = {
			OR = {
				using_cb = artifact_war
				using_cb = reclaim_relic_artifact_war
			}
		}
		localization_key = war_memory_cb_artifact
	}

	text = {
		trigger = { using_cb = liberty_faction_war }
		localization_key = war_memory_cb_liberty
	}

	text = {
		trigger = { using_cb = depose_war }
		localization_key = war_memory_cb_depose
	}

	text = {
		trigger = { using_cb = refused_liege_demand_war }
		localization_key = war_memory_cb_tyranny
	}

	text = {
		trigger = { using_cb = nation_fracturing_faction_war }
		localization_key = war_memory_cb_fracture
	}

	text = {
		trigger = { using_cb = ducal_conquest_cb }
		localization_key = war_memory_cb_ducal_conquest
	}

	text = {
		trigger = { using_cb = imperial_reconquest_cb }
		localization_key = war_memory_cb_imperial_reconquest
	}

	text = {
		trigger = { using_cb = dismantle_holy_pretender_cb }
		localization_key = war_memory_cb_holy_pretender
	}

	text = {
		trigger = { using_cb = dismantle_byz_pretender_cb }
		localization_key = war_memory_cb_byz_pretender
	}

	text = {
		trigger = { using_cb = excommunication_war }
		localization_key = war_memory_cb_excommunicate
	}

	text = {
		trigger = { using_cb = flowery_war_cb }
		localization_key = war_memory_cb_flower
	}

	text = {
		trigger = { using_cb = tribal_subjugation_cb }
		localization_key = war_memory_cb_subjugation
	}

	text = {
		trigger = {
			using_cb = vassalization_cb
			using_cb = diarch_vassalisation_cb
		}
		localization_key = war_memory_cb_vassalization
	}

	text = {
		trigger = {
			OR = {
				using_cb = fp1_varangian_adventurer_conquest
				using_cb = fp1_scandi_adventurer_conquest
			}
		}
		localization_key = war_memory_cb_varangian
	}

	text = {
		trigger = { using_cb = fp2_border_raid }
		localization_key = war_memory_cb_border
	}

	text = {
		trigger = { using_cb = fp2_expel_interloper }
		localization_key = war_memory_cb_expel
	}

	text = {
		trigger = { using_cb = diarch_vassalisation_cb }
		localization_key = war_memory_cb_vassalization
	}

	text = {
		trigger = { using_cb = remove_regent_cb }
		localization_key = war_memory_cb_regent
	}

	text = {
		trigger = {
			OR = {
				using_cb = japan_bloc_war_cb
				using_cb = japan_install_bloc_member_cb
			}
		}
		localization_key = war_memory_cb_bloc
	}

	text = {
		trigger = { always = no }
		fallback = yes
		localization_key = war_memory_cb_fallback
	}
}
