namespace = ZE

character_event = { #Allies fail to contribute
	id = ZE.9000
	desc = EVTDESC_ZE_9000
	picture = GFX_evt_large_army
	border = GFX_event_normal_frame_war

	is_triggered_only = yes
	
	only_playable = yes
	only_capable = yes
	prisoner = no
	has_dlc = "Zeus"
	war = yes
	
	trigger = {
		OR = {
			is_primary_war_attacker = yes
			is_primary_war_defender = yes
		}
		any_allied_character = {
			NOR = {
				AND = {
					is_tributary = yes
					suzerain = {
						OR = {
							character = ROOT
							any_liege = {
								character = ROOT
							}
						}
					}
				}
				ROOT = {
					is_tributary = yes
					suzerain = {
						OR = {
							character = PREV
							any_liege = {
								character = PREV
							}
						}
					}
				}
				AND = {
					is_tribal = yes
					same_realm = ROOT
					ROOT = {
						is_tribal = yes
					}
				}
				AND = {
					is_nomadic = yes
					same_realm = ROOT
					ROOT = {
						is_nomadic = yes
					}
				}
			}
			war = yes
			ROOT = {
				any_war = {
					days_since_last_hostile_action = {
						who = PREVPREV
						days = 1460
					}
				}
			}
		}
	}
	
	immediate = {
		random_allied_character = {
			limit = {
				NOR = {
					AND = {
						is_tributary = yes
						suzerain = {
							OR = {
								character = ROOT
								any_liege = {
									character = ROOT
								}
							}
						}
					}
					ROOT = {
						is_tributary = yes
						suzerain = {
							OR = {
								character = PREV
								any_liege = {
									character = PREV
								}
							}
						}
					}
					AND = {
						is_tribal = yes
						same_realm = ROOT
						ROOT = {
							is_tribal = yes
						}
					}
					AND = {
						is_nomadic = yes
						same_realm = ROOT
						ROOT = {
							is_nomadic = yes
						}
					}
				}
				war = yes
				ROOT = {
					any_war = {
						days_since_last_hostile_action = {
							who = PREVPREV
							days = 1460
						}
					}
				}
			}
			save_event_target_as = ally_not_active_in_war
		}
	}
	
	option = {
		name = EVTOPTA_ZE_9000  # Send angry letter and break alliance
		event_target:ally_not_active_in_war = {
			reverse_opinion = {
				who = ROOT
				modifier = ally_inactive_in_war
				years = 5
			}
			ROOT = {
				if = {
					limit = {
						is_allied_with = PREV
					}
					break_alliance = PREV
				}
			}
			custom_tooltip = { text = ze_9000_letter_sent }
			hidden_tooltip = { letter_event = { id = ZE.9001 } }
		}
	}
	option = {
		name = EVTOPTB_ZE_9000	# Forgive and forget
		event_target:ally_not_active_in_war = {
			reverse_opinion = {
				who = ROOT
				modifier = opinion_disappointed
				years = 3
			}
		}
	}
}

# If FROM chose to break alliance, failing ally receives alliance-breaking letter
letter_event = {
	id = ZE.9001
	desc = EVTDESC_ZE_9001
	border = GFX_event_letter_frame_war

	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_ZE_9001
		tooltip = { break_alliance = FROM }
	}
}