﻿namespace = bap_buy_pet

bap_buy_pet.0001 = {
	type = character_event
	title = bap_buy_pet.0001.t
	desc = bap_buy_pet.0001.desc
	theme = bap_pet_market

	left_portrait = {
		character = root
		animation = happiness
	}

	option = {
		name = bap_buy_pet.0001.cat
		show_as_unavailable = {
			custom_tooltip = {
				text = bap_buy_pet.0001.cat.req
				OR = {
					short_term_gold < bap_cat_pet_cost_value
					NOT = { bap_can_buy_cat_trigger = yes }
				}
			}
		}
		custom_tooltip = bap_buy_pet.0001.cat.tt
		trigger_event = bap_buy_pet.0101
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.0001.dog
		show_as_unavailable = {
			custom_tooltip = {
				text = bap_buy_pet.0001.dog.req
				OR = {
					short_term_gold < bap_dog_pet_cost_value
					NOT = { bap_can_buy_dog_trigger = yes }
				}
			}
		}
		custom_tooltip = bap_buy_pet.0001.dog.tt
		trigger_event = bap_buy_pet.0102
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.0001.eagle
		show_as_unavailable = {
			custom_tooltip = {
				text = bap_buy_pet.0001.eagle.req
				OR = {
					short_term_gold < bap_eagle_pet_cost_value
					NOT = { bap_can_buy_eagle_trigger = yes }
				}
			}
		}
		custom_tooltip = bap_buy_pet.0001.eagle.tt
		trigger_event = bap_buy_pet.0103
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.0001.warhorse
		show_as_unavailable = {
			custom_tooltip = {
				text = bap_buy_pet.0001.warhorse.req
				OR = {
					short_term_gold < bap_warhorse_pet_cost_value
					NOT = { bap_can_buy_warhorse_trigger = yes }
				}
			}
		}
		custom_tooltip = bap_buy_pet.0001.warhorse.tt
		trigger_event = bap_buy_pet.0104
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.0001.wolf
		show_as_unavailable = {
			custom_tooltip = {
				text = bap_buy_pet.0001.wolf.req
				OR = {
					short_term_gold < bap_wolf_pet_cost_value
					NOT = { bap_can_buy_wolf_trigger = yes }
				}
			}
		}
		custom_tooltip = bap_buy_pet.0001.wolf.tt
		trigger_event = bap_buy_pet.0105
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.0001.bear
		show_as_unavailable = {
			custom_tooltip = {
				text = bap_buy_pet.0001.bear.req
				OR = {
					short_term_gold < bap_bear_pet_cost_value
					NOT = { bap_can_buy_bear_trigger = yes }
				}
			}
		}
		custom_tooltip = bap_buy_pet.0001.bear.tt
		trigger_event = bap_buy_pet.0106
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.0001.lion
		show_as_unavailable = {
			custom_tooltip = {
				text = bap_buy_pet.0001.lion.req
				OR = {
					short_term_gold < bap_lion_pet_cost_value
					NOT = { bap_can_buy_lion_trigger = yes }
				}
			}
		}
		custom_tooltip = bap_buy_pet.0001.lion.tt
		trigger_event = bap_buy_pet.0107
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.0001.tiger
		show_as_unavailable = {
			custom_tooltip = {
				text = bap_buy_pet.0001.tiger.req
				OR = {
					short_term_gold < bap_tiger_pet_cost_value
					NOT = { bap_can_buy_tiger_trigger = yes }
				}
			}
		}
		custom_tooltip = bap_buy_pet.0001.tiger.tt
		trigger_event = bap_buy_pet.0108
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.0001.cancel
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.0101 = {
	type = character_event
	title = bap_buy_pet.0101.t
	desc = bap_buy_pet.0101.desc
	theme = bap_pet_market

	left_portrait = {
		character = root
		animation = happiness
	}

	option = {
		name = bap_buy_pet.confirm.cat
		remove_short_term_gold = bap_cat_pet_cost_value
		start_cat_story_cycle_effect = yes
		hidden_effect = {
			bap_schedule_initial_cat_pet_event_effect = yes
		}
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.confirm.back
		trigger_event = bap_buy_pet.0001
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.0102 = {
	type = character_event
	title = bap_buy_pet.0102.t
	desc = bap_buy_pet.0102.desc
	theme = bap_pet_market

	left_portrait = {
		character = root
		animation = happiness
	}

	option = {
		name = bap_buy_pet.confirm.dog
		remove_short_term_gold = bap_dog_pet_cost_value
		start_dog_story_cycle_effect = yes
		hidden_effect = {
			bap_schedule_initial_dog_pet_event_effect = yes
		}
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.confirm.back
		trigger_event = bap_buy_pet.0001
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.0103 = {
	type = character_event
	title = bap_buy_pet.0103.t
	desc = bap_buy_pet.0103.desc
	theme = bap_pet_market

	left_portrait = {
		character = root
		animation = happiness
	}

	option = {
		name = bap_buy_pet.confirm.eagle
		remove_short_term_gold = bap_eagle_pet_cost_value
		save_temporary_scope_value_as = {
			name = eagle_capture_method
			value = flag:market
		}
		start_eagle_story_cycle_effect = yes
		hidden_effect = {
			bap_schedule_initial_eagle_pet_event_effect = yes
		}
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.confirm.back
		trigger_event = bap_buy_pet.0001
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.0104 = {
	type = character_event
	title = bap_buy_pet.0104.t
	desc = bap_buy_pet.0104.desc
	theme = bap_pet_market

	left_portrait = {
		character = root
		animation = happiness
	}

	option = {
		name = bap_buy_pet.confirm.warhorse
		remove_short_term_gold = bap_warhorse_pet_cost_value
		start_warhorse_story_cycle_effect = yes
		hidden_effect = {
			bap_schedule_initial_warhorse_pet_event_effect = yes
		}
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.confirm.back
		trigger_event = bap_buy_pet.0001
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.0105 = {
	type = character_event
	title = bap_buy_pet.0105.t
	desc = bap_buy_pet.0105.desc
	theme = bap_pet_market

	left_portrait = {
		character = root
		animation = happiness
	}

	option = {
		name = bap_buy_pet.confirm.wolf
		remove_short_term_gold = bap_wolf_pet_cost_value
		bap_start_wolf_pet_effect = yes
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.confirm.back
		trigger_event = bap_buy_pet.0001
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.0106 = {
	type = character_event
	title = bap_buy_pet.0106.t
	desc = bap_buy_pet.0106.desc
	theme = bap_pet_market

	left_portrait = {
		character = root
		animation = happiness
	}

	option = {
		name = bap_buy_pet.confirm.bear
		remove_short_term_gold = bap_bear_pet_cost_value
		bap_start_bear_pet_effect = yes
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.confirm.back
		trigger_event = bap_buy_pet.0001
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.0107 = {
	type = character_event
	title = bap_buy_pet.0107.t
	desc = bap_buy_pet.0107.desc
	theme = bap_pet_market

	left_portrait = {
		character = root
		animation = happiness
	}

	option = {
		name = bap_buy_pet.confirm.lion
		remove_short_term_gold = bap_lion_pet_cost_value
		bap_start_lion_pet_effect = yes
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.confirm.back
		trigger_event = bap_buy_pet.0001
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.0108 = {
	type = character_event
	title = bap_buy_pet.0108.t
	desc = bap_buy_pet.0108.desc
	theme = bap_pet_market

	left_portrait = {
		character = root
		animation = happiness
	}

	option = {
		name = bap_buy_pet.confirm.tiger
		remove_short_term_gold = bap_tiger_pet_cost_value
		bap_start_tiger_pet_effect = yes
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.confirm.back
		trigger_event = bap_buy_pet.0001
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.1001 = {
	type = character_event
	title = bap_buy_pet.1001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					has_character_flag = bap_tiger_pet_alive
					any_owned_story = { type = bap_story_cycle_tiger var:bap_tiger_type ?= flag:amur }
				}
				desc = bap_buy_pet.1001.desc.tiger.amur
			}
			triggered_desc = {
				trigger = {
					has_character_flag = bap_tiger_pet_alive
					any_owned_story = { type = bap_story_cycle_tiger var:bap_tiger_type ?= flag:siberian }
				}
				desc = bap_buy_pet.1001.desc.tiger.siberian
			}
			triggered_desc = {
				trigger = {
					has_character_flag = bap_tiger_pet_alive
					any_owned_story = { type = bap_story_cycle_tiger var:bap_tiger_type ?= flag:black }
				}
				desc = bap_buy_pet.1001.desc.tiger.black
			}
			triggered_desc = {
				trigger = {
					has_character_flag = bap_tiger_pet_alive
					any_owned_story = { type = bap_story_cycle_tiger var:bap_tiger_type ?= flag:white }
				}
				desc = bap_buy_pet.1001.desc.tiger.white
			}
			triggered_desc = {
				trigger = { always = yes }
				desc = bap_buy_pet.1001.desc
			}
		}
	}
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		OR = {
			has_character_flag = bap_wolf_pet_alive
			has_character_flag = bap_bear_pet_alive
			has_character_flag = bap_lion_pet_alive
			has_character_flag = bap_tiger_pet_alive
		}
	}

	left_portrait = {
		character = root
		animation = personality_content
	}

	immediate = {
		bap_prepare_exotic_pet_names_effect = yes
	}

	widget = {
		gui = "event_window_widget_enter_text"
		container = "dynamic_birth_name"
		controller = {
			type = text
			data = {
				key = bap_pet_name
				default = {
					localization_key = bap_pet_name_fang
					trigger = { has_character_flag = bap_pet_name_fang }
				}
				default = {
					localization_key = bap_pet_name_shadow
					trigger = { has_character_flag = bap_pet_name_shadow }
				}
				default = {
					localization_key = bap_pet_name_ash
					trigger = { has_character_flag = bap_pet_name_ash }
				}
				default = {
					localization_key = bap_pet_name_urska
					trigger = { has_character_flag = bap_pet_name_urska }
				}
				default = {
					localization_key = bap_pet_name_honey
					trigger = { has_character_flag = bap_pet_name_honey }
				}
				default = {
					localization_key = bap_pet_name_stonesnout
					trigger = { has_character_flag = bap_pet_name_stonesnout }
				}
				default = {
					localization_key = bap_pet_name_aureon
					trigger = { has_character_flag = bap_pet_name_aureon }
				}
				default = {
					localization_key = bap_pet_name_crownclaw
					trigger = { has_character_flag = bap_pet_name_crownclaw }
				}
				default = {
					localization_key = bap_pet_name_saffron
					trigger = { has_character_flag = bap_pet_name_saffron }
				}
				default = {
					localization_key = bap_pet_name_rajan
					trigger = { has_character_flag = bap_pet_name_rajan }
				}
				default = {
					localization_key = bap_pet_name_ember
					trigger = { has_character_flag = bap_pet_name_ember }
				}
				default = {
					localization_key = bap_pet_name_stripe
					trigger = { has_character_flag = bap_pet_name_stripe }
				}
			}
		}
		setup_scope = {
			root = { save_scope_as = text_target }
		}
	}

	option = {
		name = bap_buy_pet.1001.a
		ai_chance = { base = 0 }
	}

	after = {
		remove_character_flag = bap_pet_name_fang
		remove_character_flag = bap_pet_name_shadow
		remove_character_flag = bap_pet_name_ash
		remove_character_flag = bap_pet_name_urska
		remove_character_flag = bap_pet_name_honey
		remove_character_flag = bap_pet_name_stonesnout
		remove_character_flag = bap_pet_name_aureon
		remove_character_flag = bap_pet_name_crownclaw
		remove_character_flag = bap_pet_name_saffron
		remove_character_flag = bap_pet_name_rajan
		remove_character_flag = bap_pet_name_ember
		remove_character_flag = bap_pet_name_stripe

		if = {
			limit = { NOT = { has_variable = bap_pet_name } }
			set_variable = {
				name = bap_pet_name
				value = flag:custom
			}
		}
		every_owned_story = {
			limit = {
				OR = {
					story_type = bap_story_cycle_wolf
					story_type = bap_story_cycle_bear
					story_type = bap_story_cycle_lion
					story_type = bap_story_cycle_tiger
				}
			}
			set_variable = {
				name = bap_pet_name
				value = story_owner.var:bap_pet_name
			}
		}
	}
}

# ============================ EXOTIC FLAVOUR EVENTS ============================

bap_buy_pet.2001 = {
	type = character_event
	title = bap_buy_pet.2001.t
	desc = bap_buy_pet.2001.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_wolf_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_bold
	}

	# Bold: let the wolf roam as a feared night guardian (dread + lasting renown)
	option = {
		name = bap_buy_pet.2001.a
		add_dread = 5
		add_character_modifier = {
			modifier = bap_celebrated_beast_modifier
			years = 4
		}
		ai_chance = { base = 0 }
	}

	# Measured: trust men over beasts (safe prestige + martial experience)
	option = {
		name = bap_buy_pet.2001.b
		add_prestige = 50
		add_martial_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2002 = {
	type = character_event
	title = bap_buy_pet.2002.t
	desc = bap_buy_pet.2002.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_bear_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_bold
	}

	# Let its silent presence rule the hall (dread + lasting renown)
	option = {
		name = bap_buy_pet.2002.a
		add_dread = 5
		add_character_modifier = {
			modifier = bap_celebrated_beast_modifier
			years = 4
		}
		ai_chance = { base = 0 }
	}

	# Use the calm to mediate the quarrel yourself (prestige + diplomacy)
	option = {
		name = bap_buy_pet.2002.b
		add_prestige = 40
		add_diplomacy_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2003 = {
	type = character_event
	title = bap_buy_pet.2003.t
	desc = bap_buy_pet.2003.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_lion_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_arrogant
	}

	# Make it a display of imperial power (dread + lasting renown)
	option = {
		name = bap_buy_pet.2003.a
		add_dread = 5
		add_character_modifier = {
			modifier = bap_celebrated_beast_modifier
			years = 4
		}
		ai_chance = { base = 0 }
	}

	# Win the watching crowd with grace (prestige + diplomacy)
	option = {
		name = bap_buy_pet.2003.b
		add_prestige = 50
		add_diplomacy_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2004 = {
	type = character_event
	title = bap_buy_pet.2004.t
	desc = bap_buy_pet.2004.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_tiger_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_bold
	}

	# Embrace the fearsome mystique it lends your court (dread + lasting renown)
	option = {
		name = bap_buy_pet.2004.a
		add_dread = 5
		add_character_modifier = {
			modifier = bap_celebrated_beast_modifier
			years = 4
		}
		ai_chance = { base = 0 }
	}

	# Find a rare calm in its silence (prestige + stress relief)
	option = {
		name = bap_buy_pet.2004.b
		add_prestige = 20
		add_stress = medium_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2011 = {
	type = character_event
	title = bap_buy_pet.2011.t
	desc = bap_buy_pet.2011.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_wolf_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_rational
	}

	# Take the would-be assassin alive -> branches into the interrogation (2013)
	option = {
		name = bap_buy_pet.2011.a
		trigger_event = bap_buy_pet.2013
		ai_chance = { base = 0 }
	}

	# Make a public example of him (dread + intrigue experience)
	option = {
		name = bap_buy_pet.2011.b
		add_dread = 8
		add_intrigue_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2012 = {
	type = character_event
	title = bap_buy_pet.2012.t
	desc = bap_buy_pet.2012.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_wolf_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_content
	}

	# Permanent: a lifelong bond that steadies you for the rest of your life
	option = {
		name = bap_buy_pet.2012.a
		add_character_modifier = {
			modifier = bap_kindred_spirit_modifier
		}
		ai_chance = { base = 0 }
	}

	# Just enjoy the quiet moment (small prestige + stress relief)
	option = {
		name = bap_buy_pet.2012.b
		add_prestige = 20
		add_stress = minor_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2021 = {
	type = character_event
	title = bap_buy_pet.2021.t
	desc = bap_buy_pet.2021.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_bear_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_content
	}

	# Show the court the gentle giant (prestige + stress relief)
	option = {
		name = bap_buy_pet.2021.a
		add_prestige = 30
		add_stress = medium_stress_loss
		ai_chance = { base = 0 }
	}

	# Permanent: a quiet bond that steadies you for the rest of your life
	option = {
		name = bap_buy_pet.2021.b
		add_character_modifier = {
			modifier = bap_kindred_spirit_modifier
		}
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2022 = {
	type = character_event
	title = bap_buy_pet.2022.t
	desc = bap_buy_pet.2022.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_bear_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_bold
	}

	# Let it cow the loudmouths (dread + intrigue experience)
	option = {
		name = bap_buy_pet.2022.a
		add_dread = 8
		add_intrigue_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}

	# Turn it into theater and laughter (prestige + diplomacy)
	option = {
		name = bap_buy_pet.2022.b
		add_prestige = 50
		add_diplomacy_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2031 = {
	type = character_event
	title = bap_buy_pet.2031.t
	desc = bap_buy_pet.2031.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_lion_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_arrogant
	}

	# Let the envoys feel the lion's displeasure (dread + diplomacy)
	option = {
		name = bap_buy_pet.2031.a
		add_dread = 8
		add_diplomacy_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}

	# Smooth it over with a gracious jest (prestige + stress relief)
	option = {
		name = bap_buy_pet.2031.b
		add_prestige = 40
		add_stress = minor_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2032 = {
	type = character_event
	title = bap_buy_pet.2032.t
	desc = bap_buy_pet.2032.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_lion_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_content
	}

	# Permanent: embrace the lion as the symbol of your majesty
	option = {
		name = bap_buy_pet.2032.a
		add_prestige = 25
		add_character_modifier = {
			modifier = bap_legendary_beastmaster_modifier
		}
		ai_chance = { base = 0 }
	}

	# Simply savor the court's silent awe (prestige + stress relief)
	option = {
		name = bap_buy_pet.2032.b
		add_prestige = 30
		add_stress = minor_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2041 = {
	type = character_event
	title = bap_buy_pet.2041.t
	desc = bap_buy_pet.2041.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_tiger_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_bold
	}

	# Permanent: night after night, its quiet presence steadies you for life
	option = {
		name = bap_buy_pet.2041.a
		add_character_modifier = {
			modifier = bap_kindred_spirit_modifier
		}
		ai_chance = { base = 0 }
	}

	# Study how it moves unseen (intrigue + stress relief)
	option = {
		name = bap_buy_pet.2041.b
		add_intrigue_lifestyle_xp = minor_lifestyle_xp
		add_stress = minor_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2042 = {
	type = character_event
	title = bap_buy_pet.2042.t
	desc = bap_buy_pet.2042.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_tiger_pet_alive
	}

	left_portrait = {
		character = root
		animation = personality_arrogant
	}

	# Let the fear ripple through the hall (dread + intrigue)
	option = {
		name = bap_buy_pet.2042.a
		add_dread = 10
		add_intrigue_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}

	# Turn the spectacle to your glory (prestige + diplomacy)
	option = {
		name = bap_buy_pet.2042.b
		add_prestige = 50
		add_diplomacy_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2101 = {
	type = character_event
	title = bap_buy_pet.2101.t
	desc = bap_buy_pet.2101.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_cat_trigger = yes
	}

	left_portrait = {
		character = root
		animation = personality_content
	}

	# Take the hint and audit the books (gold recovered + stewardship)
	option = {
		name = bap_buy_pet.2101.a
		add_gold = 15
		add_stewardship_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}

	# Just laugh and let it keep the warm perch (a little prestige + calm)
	option = {
		name = bap_buy_pet.2101.b
		add_prestige = 10
		add_stress = minor_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2102 = {
	type = character_event
	title = bap_buy_pet.2102.t
	desc = bap_buy_pet.2102.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_cat_trigger = yes
	}

	left_portrait = {
		character = root
		animation = personality_rational
	}

	# Set it loose to guard the granaries (saved stores + stewardship)
	option = {
		name = bap_buy_pet.2102.a
		add_gold = 15
		add_stewardship_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}

	# A hunter that goes everywhere unseen has its uses (intrigue)
	option = {
		name = bap_buy_pet.2102.b
		add_intrigue_lifestyle_xp = minor_lifestyle_xp
		add_stress = minor_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2103 = {
	type = character_event
	title = bap_buy_pet.2103.t
	desc = bap_buy_pet.2103.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_cat_trigger = yes
	}

	left_portrait = {
		character = root
		animation = happiness
	}

	# Permanent: its quiet companionship steadies you for the rest of your life
	option = {
		name = bap_buy_pet.2103.a
		add_character_modifier = {
			modifier = bap_kindred_spirit_modifier
		}
		ai_chance = { base = 0 }
	}

	# Simply let the long day melt away by the fire (stress relief)
	option = {
		name = bap_buy_pet.2103.b
		add_stress = medium_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2201 = {
	type = character_event
	title = bap_buy_pet.2201.t
	desc = bap_buy_pet.2201.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_dog_trigger = yes
	}

	left_portrait = {
		character = root
		animation = personality_bold
	}

	# Reward the watchful guardian (prestige + martial)
	option = {
		name = bap_buy_pet.2201.a
		add_prestige = 20
		add_martial_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}

	# Have the lurking stranger questioned (intrigue + a little dread)
	option = {
		name = bap_buy_pet.2201.b
		add_intrigue_lifestyle_xp = minor_lifestyle_xp
		add_dread = 3
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2202 = {
	type = character_event
	title = bap_buy_pet.2202.t
	desc = bap_buy_pet.2202.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_dog_trigger = yes
	}

	left_portrait = {
		character = root
		animation = happiness
	}

	# Join the impromptu hunt (martial + a temporary edge)
	option = {
		name = bap_buy_pet.2202.a
		add_martial_lifestyle_xp = minor_lifestyle_xp
		add_character_modifier = {
			modifier = bap_emboldened_modifier
			years = 2
		}
		ai_chance = { base = 0 }
	}

	# Reward it; the whole court is charmed (prestige + stress relief)
	option = {
		name = bap_buy_pet.2202.b
		add_prestige = 15
		add_stress = minor_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2203 = {
	type = character_event
	title = bap_buy_pet.2203.t
	desc = bap_buy_pet.2203.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_dog_trigger = yes
	}

	left_portrait = {
		character = root
		animation = personality_content
	}

	# Permanent: a faithful bond that steadies you for the rest of your life
	option = {
		name = bap_buy_pet.2203.a
		add_character_modifier = {
			modifier = bap_kindred_spirit_modifier
		}
		ai_chance = { base = 0 }
	}

	# Take simple comfort in its constancy (stress relief)
	option = {
		name = bap_buy_pet.2203.b
		add_stress = medium_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2301 = {
	type = character_event
	title = bap_buy_pet.2301.t
	desc = bap_buy_pet.2301.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_eagle_trigger = yes
	}

	left_portrait = {
		character = root
		animation = personality_bold
	}

	# Put it to work scouting the roads (martial + a temporary edge)
	option = {
		name = bap_buy_pet.2301.a
		add_martial_lifestyle_xp = minor_lifestyle_xp
		add_character_modifier = {
			modifier = bap_emboldened_modifier
			years = 2
		}
		ai_chance = { base = 0 }
	}

	# Simply show off the noble bird (prestige)
	option = {
		name = bap_buy_pet.2301.b
		add_prestige = 40
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2302 = {
	type = character_event
	title = bap_buy_pet.2302.t
	desc = bap_buy_pet.2302.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_eagle_trigger = yes
	}

	left_portrait = {
		character = root
		animation = personality_content
	}

	# Feast on the rare prey and share it with the court (prestige + stewardship)
	option = {
		name = bap_buy_pet.2302.a
		add_prestige = 30
		add_stewardship_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}

	# Keep the fine feathers and sell the rest (gold)
	option = {
		name = bap_buy_pet.2302.b
		add_gold = 20
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2303 = {
	type = character_event
	title = bap_buy_pet.2303.t
	desc = bap_buy_pet.2303.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_eagle_trigger = yes
	}

	left_portrait = {
		character = root
		animation = personality_rational
	}

	# Permanent: master falconry yourself, renowned for the rest of your life
	option = {
		name = bap_buy_pet.2303.a
		add_character_modifier = {
			modifier = bap_legendary_beastmaster_modifier
		}
		ai_chance = { base = 0 }
	}

	# Leave the training to the falconer (stewardship + prestige)
	option = {
		name = bap_buy_pet.2303.b
		add_stewardship_lifestyle_xp = minor_lifestyle_xp
		add_prestige = 15
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2401 = {
	type = character_event
	title = bap_buy_pet.2401.t
	desc = bap_buy_pet.2401.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		any_owned_story = { type = story_cycle_martial_lifestyle_warhorse }
	}

	left_portrait = {
		character = root
		animation = personality_bold
	}

	# Put it through hard drills (martial + a temporary edge)
	option = {
		name = bap_buy_pet.2401.a
		add_martial_lifestyle_xp = minor_lifestyle_xp
		add_character_modifier = {
			modifier = bap_emboldened_modifier
			years = 2
		}
		ai_chance = { base = 0 }
	}

	# Take a gentle ride to clear your head (prestige + stress relief)
	option = {
		name = bap_buy_pet.2401.b
		add_prestige = 15
		add_stress = minor_stress_loss
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2402 = {
	type = character_event
	title = bap_buy_pet.2402.t
	desc = bap_buy_pet.2402.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		any_owned_story = { type = story_cycle_martial_lifestyle_warhorse }
	}

	left_portrait = {
		character = root
		animation = happiness
	}

	# Lead a grand parade (renown + prestige)
	option = {
		name = bap_buy_pet.2402.a
		add_prestige = 40
		add_character_modifier = {
			modifier = bap_celebrated_beast_modifier
			years = 3
		}
		ai_chance = { base = 0 }
	}

	# Inspect the troops from the saddle (martial + prestige)
	option = {
		name = bap_buy_pet.2402.b
		add_martial_lifestyle_xp = minor_lifestyle_xp
		add_prestige = 20
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.2403 = {
	type = character_event
	title = bap_buy_pet.2403.t
	desc = bap_buy_pet.2403.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		any_owned_story = { type = story_cycle_martial_lifestyle_warhorse }
	}

	left_portrait = {
		character = root
		animation = personality_bold
	}

	# Permanent: a bond of trust that steadies you for the rest of your life
	option = {
		name = bap_buy_pet.2403.a
		add_character_modifier = {
			modifier = bap_kindred_spirit_modifier
		}
		ai_chance = { base = 0 }
	}

	# Men stand braver beside it (prestige + martial)
	option = {
		name = bap_buy_pet.2403.b
		add_prestige = 30
		add_martial_lifestyle_xp = minor_lifestyle_xp
		ai_chance = { base = 0 }
	}
}

# ============================ RECURRING DISPATCHERS (vanilla-story pets) ============================

bap_buy_pet.3001 = {
	type = character_event
	hidden = yes

	trigger = {
		is_alive = yes
		has_cat_trigger = yes
	}

	immediate = {
		random_list = {
			10 = { trigger_event = bap_buy_pet.2101 }
			10 = { trigger_event = bap_buy_pet.2102 }
			10 = { trigger_event = bap_buy_pet.2103 }
			10 = { trigger_event = bap_buy_pet.2104 }
			10 = { trigger_event = bap_buy_pet.2105 }
			10 = { trigger_event = bap_buy_pet.2106 }
			10 = { trigger_event = bap_buy_pet.2107 }
			10 = { trigger_event = bap_buy_pet.2108 }
			10 = { trigger_event = bap_buy_pet.2109 }
			10 = { trigger_event = bap_buy_pet.2110 }
			10 = { trigger_event = bap_buy_pet.2111 }
			10 = { trigger_event = bap_buy_pet.2112 }
			6 = { trigger_event = bap_buy_pet.9101 }
		}
		bap_schedule_recurring_cat_pet_event_effect = yes
	}
}

bap_buy_pet.3002 = {
	type = character_event
	hidden = yes

	trigger = {
		is_alive = yes
		has_dog_trigger = yes
	}

	immediate = {
		random_list = {
			10 = { trigger_event = bap_buy_pet.2201 }
			10 = { trigger_event = bap_buy_pet.2202 }
			10 = { trigger_event = bap_buy_pet.2203 }
			10 = { trigger_event = bap_buy_pet.2204 }
			10 = { trigger_event = bap_buy_pet.2205 }
			10 = { trigger_event = bap_buy_pet.2206 }
			10 = { trigger_event = bap_buy_pet.2207 }
			10 = { trigger_event = bap_buy_pet.2208 }
			10 = { trigger_event = bap_buy_pet.2209 }
			10 = { trigger_event = bap_buy_pet.2210 }
			10 = { trigger_event = bap_buy_pet.2211 }
			10 = { trigger_event = bap_buy_pet.2212 }
			6 = { trigger_event = bap_buy_pet.9101 }
		}
		bap_schedule_recurring_dog_pet_event_effect = yes
	}
}

bap_buy_pet.3003 = {
	type = character_event
	hidden = yes

	trigger = {
		is_alive = yes
		has_eagle_trigger = yes
	}

	immediate = {
		random_list = {
			10 = { trigger_event = bap_buy_pet.2301 }
			10 = { trigger_event = bap_buy_pet.2302 }
			10 = { trigger_event = bap_buy_pet.2303 }
			10 = { trigger_event = bap_buy_pet.2304 }
			10 = { trigger_event = bap_buy_pet.2305 }
			10 = { trigger_event = bap_buy_pet.2306 }
			10 = { trigger_event = bap_buy_pet.2307 }
			10 = { trigger_event = bap_buy_pet.2308 }
			10 = { trigger_event = bap_buy_pet.2309 }
			10 = { trigger_event = bap_buy_pet.2310 }
			10 = { trigger_event = bap_buy_pet.2311 }
			10 = { trigger_event = bap_buy_pet.2312 }
			6 = { trigger_event = bap_buy_pet.9101 }
		}
		bap_schedule_recurring_eagle_pet_event_effect = yes
	}
}

bap_buy_pet.3004 = {
	type = character_event
	hidden = yes

	trigger = {
		is_alive = yes
		any_owned_story = { type = story_cycle_martial_lifestyle_warhorse }
	}

	immediate = {
		random_list = {
			10 = { trigger_event = bap_buy_pet.2401 }
			10 = { trigger_event = bap_buy_pet.2402 }
			10 = { trigger_event = bap_buy_pet.2403 }
			10 = { trigger_event = bap_buy_pet.2404 }
			10 = { trigger_event = bap_buy_pet.2405 }
			10 = { trigger_event = bap_buy_pet.2406 }
			10 = { trigger_event = bap_buy_pet.2407 }
			10 = { trigger_event = bap_buy_pet.2408 }
			10 = { trigger_event = bap_buy_pet.2409 }
			10 = { trigger_event = bap_buy_pet.2410 }
			10 = { trigger_event = bap_buy_pet.2411 }
			10 = { trigger_event = bap_buy_pet.2412 }
			6 = { trigger_event = bap_buy_pet.9101 }
		}
		bap_schedule_recurring_warhorse_pet_event_effect = yes
	}
}

# ============================ TRAIT REACTIONS ============================

bap_buy_pet.9101 = {
	type = character_event
	title = bap_buy_pet.9101.t
	desc = bap_buy_pet.9101.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		bap_has_any_pet_trigger = yes
	}

	left_portrait = {
		character = root
		animation = personality_content
	}

	option = {
		name = bap_buy_pet.9101.brave
		trigger = { has_trait = brave }
		add_prestige = minor_prestige_gain
		add_martial_lifestyle_xp = minor_lifestyle_xp
		add_character_modifier = {
			modifier = bap_emboldened_modifier
			years = 1
		}
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.9101.sadistic
		trigger = { has_trait = sadistic }
		add_dread = 10
		add_stress = minor_stress_loss
		add_character_modifier = {
			modifier = bap_pet_unsettled_household_modifier
			years = 1
		}
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.9101.compassionate
		trigger = { has_trait = compassionate }
		add_stress = medium_stress_loss
		add_character_modifier = {
			modifier = bap_pet_handler_respect_modifier
			years = 2
		}
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.9101.hunter
		trigger = { has_trait = lifestyle_hunter }
		add_prestige = minor_prestige_gain
		add_martial_lifestyle_xp = medium_lifestyle_xp
		add_character_modifier = {
			modifier = bap_pet_hunting_rhythm_modifier
			years = 2
		}
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.9101.default
		add_prestige = miniscule_prestige_gain
		add_stress = minor_stress_loss
		ai_chance = { base = 0 }
	}
}

# ============================ DEATH ============================

bap_buy_pet.9001 = {
	type = character_event
	title = bap_buy_pet.9001.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_character_flag = bap_wolf_pet_alive }
				desc = bap_buy_pet.9001.desc.wolf
			}
			triggered_desc = {
				trigger = { has_character_flag = bap_bear_pet_alive }
				desc = bap_buy_pet.9001.desc.bear
			}
			triggered_desc = {
				trigger = { has_character_flag = bap_lion_pet_alive }
				desc = bap_buy_pet.9001.desc.lion
			}
			triggered_desc = {
				trigger = { has_character_flag = bap_tiger_pet_alive }
				desc = bap_buy_pet.9001.desc.tiger
			}
		}
	}
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		OR = {
			has_character_flag = bap_wolf_pet_alive
			has_character_flag = bap_bear_pet_alive
			has_character_flag = bap_lion_pet_alive
			has_character_flag = bap_tiger_pet_alive
		}
	}

	left_portrait = {
		character = root
		animation = sadness
	}

	option = {
		name = bap_buy_pet.9001.a
		add_stress = medium_stress_gain
		every_owned_story = {
			limit = {
				OR = {
					story_type = bap_story_cycle_wolf
					story_type = bap_story_cycle_bear
					story_type = bap_story_cycle_lion
					story_type = bap_story_cycle_tiger
				}
			}
			end_story = yes
		}
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.9102 = {
	type = character_event
	title = bap_buy_pet.9102.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = { has_character_flag = bap_recent_pet_memorial_cat }
				desc = bap_buy_pet.9102.desc.cat
			}
			triggered_desc = {
				trigger = { has_character_flag = bap_recent_pet_memorial_dog }
				desc = bap_buy_pet.9102.desc.dog
			}
			triggered_desc = {
				trigger = { has_character_flag = bap_recent_pet_memorial_eagle }
				desc = bap_buy_pet.9102.desc.eagle
			}
			triggered_desc = {
				trigger = { has_character_flag = bap_recent_pet_memorial_horse }
				desc = bap_buy_pet.9102.desc.horse
			}
			triggered_desc = {
				trigger = { has_character_flag = bap_recent_pet_memorial_wolf }
				desc = bap_buy_pet.9102.desc.wolf
			}
			triggered_desc = {
				trigger = { has_character_flag = bap_recent_pet_memorial_bear }
				desc = bap_buy_pet.9102.desc.bear
			}
			triggered_desc = {
				trigger = { has_character_flag = bap_recent_pet_memorial_lion }
				desc = bap_buy_pet.9102.desc.lion
			}
			triggered_desc = {
				trigger = { has_character_flag = bap_recent_pet_memorial_tiger }
				desc = bap_buy_pet.9102.desc.tiger
			}
			desc = bap_buy_pet.9102.desc.generic
		}
	}
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		OR = {
			has_character_flag = bap_recent_pet_memorial_cat
			has_character_flag = bap_recent_pet_memorial_dog
			has_character_flag = bap_recent_pet_memorial_eagle
			has_character_flag = bap_recent_pet_memorial_horse
			has_character_flag = bap_recent_pet_memorial_wolf
			has_character_flag = bap_recent_pet_memorial_bear
			has_character_flag = bap_recent_pet_memorial_lion
			has_character_flag = bap_recent_pet_memorial_tiger
		}
	}

	left_portrait = {
		character = root
		animation = sadness
	}

	option = {
		name = bap_buy_pet.9102.a
		add_prestige = medium_prestige_gain
		add_character_modifier = {
			modifier = bap_pet_memorial_modifier
			years = 5
		}
		hidden_effect = { bap_clear_pet_memorial_flags_effect = yes }
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.9102.b
		add_stress = medium_stress_loss
		hidden_effect = { bap_clear_pet_memorial_flags_effect = yes }
		ai_chance = { base = 0 }
	}

	option = {
		name = bap_buy_pet.9102.sadistic
		trigger = { has_trait = sadistic }
		add_dread = 10
		add_prestige = minor_prestige_gain
		hidden_effect = { bap_clear_pet_memorial_flags_effect = yes }
		ai_chance = { base = 0 }
	}
}

bap_buy_pet.9103 = {
	type = character_event
	title = bap_buy_pet.9103.t
	desc = bap_buy_pet.9103.desc
	theme = bap_pet_market

	trigger = {
		is_alive = yes
		has_character_flag = bap_warhorse_is_dying
		any_owned_story = { type = story_cycle_martial_lifestyle_warhorse }
	}

	left_portrait = {
		character = root
		animation = sadness
	}

	option = {
		name = bap_buy_pet.9103.a
		add_stress = medium_stress_gain
		every_owned_story = {
			limit = { story_type = story_cycle_martial_lifestyle_warhorse }
			end_story = yes
		}
		ai_chance = { base = 0 }
	}
}
