﻿namespace = cagm_fishing

# Hidden arrival dispatcher. An existing Master of the Fishery leads
# automatically; a vacant office opens the Hunt-style candidate choice first.
cagm_fishing.0002 = {
	type = activity_event
	hidden = yes

	immediate = {
		if = {
			limit = { employs_court_position = cagm_master_fisher_court_position }
			court_position:cagm_master_fisher_court_position = { save_scope_as = fishing_companion }
			involved_activity = { set_variable = { name = cagm_fishing_companion value = scope:fishing_companion } }
			trigger_event = cagm_fishing.0001
		}
		else = { trigger_event = cagm_fishing.0003 }
	}
}

# A vacant office mirrors Hunt's arrival-time Master-of-the-Hunt recruitment.
# The two best eligible attendees are ranked by this office's aptitude. Local
# Anglers fill empty candidate slots so the player always receives two choices.
cagm_fishing.0003 = {
	type = activity_event
	title = cagm_fishing.0003.t
	desc = cagm_fishing.0003.desc
	theme = hunting
	override_background = { reference = bp3_riverside }
	left_portrait = { character = root animation = thinking }
	center_portrait = { character = scope:fishing_master_candidate_1 animation = admiration }
	right_portrait = { character = scope:fishing_master_candidate_2 animation = admiration }

	immediate = {
		if = {
			limit = { can_employ_court_position_type = cagm_master_fisher_court_position }
			involved_activity = {
				ordered_attending_character = {
					limit = {
						this != root
						OR = { is_vassal_of = root is_courtier_of = root }
						root = { can_appoint_char_to_court_position = { CHAR = prev COURT_POS = cagm_master_fisher_court_position } }
					}
					order_by = aptitude:cagm_master_fisher_court_position
					save_scope_as = fishing_master_candidate_1
				}
				ordered_attending_character = {
					limit = {
						this != root
						trigger_if = {
							limit = { exists = scope:fishing_master_candidate_1 }
							this != scope:fishing_master_candidate_1
						}
						OR = { is_vassal_of = root is_courtier_of = root }
						root = { can_appoint_char_to_court_position = { CHAR = prev COURT_POS = cagm_master_fisher_court_position } }
					}
					order_by = aptitude:cagm_master_fisher_court_position
					save_scope_as = fishing_master_candidate_2
				}
			}
		}
		else = {
			involved_activity = {
				ordered_attending_character = {
					limit = { this != root is_adult = yes is_imprisoned = no NOT = { is_incapable = yes } }
					order_by = aptitude:cagm_master_fisher_court_position
					save_scope_as = fishing_master_candidate_1
				}
				ordered_attending_character = {
					limit = {
						this != root
						trigger_if = {
							limit = { exists = scope:fishing_master_candidate_1 }
							this != scope:fishing_master_candidate_1
						}
						is_adult = yes
						is_imprisoned = no
						NOT = { is_incapable = yes }
					}
					order_by = aptitude:cagm_master_fisher_court_position
					save_scope_as = fishing_master_candidate_2
				}
			}
		}
		if = {
			limit = { NOT = { exists = scope:fishing_master_candidate_1 } }
			create_character = {
				template = cagm_local_angler_character
				culture = root.location.culture
				faith = root.location.faith
				location = root.location
				save_scope_as = fishing_master_candidate_1
			}
			scope:fishing_master_candidate_1 = { set_employer = root }
		}
		if = {
			limit = { NOT = { exists = scope:fishing_master_candidate_2 } }
			create_character = {
				template = cagm_local_angler_character
				culture = root.location.culture
				faith = root.location.faith
				location = root.location
				save_scope_as = fishing_master_candidate_2
			}
			scope:fishing_master_candidate_2 = { set_employer = root }
		}
	}

	option = {
		name = cagm_fishing.0003.a
		if = {
			limit = {
				can_employ_court_position_type = cagm_master_fisher_court_position
				scope:fishing_master_candidate_1 = { can_be_employed_as = cagm_master_fisher_court_position }
			}
			appoint_court_position = { recipient = scope:fishing_master_candidate_1 court_position = cagm_master_fisher_court_position }
		}
		involved_activity = { set_variable = { name = cagm_fishing_companion value = scope:fishing_master_candidate_1 } }
		custom_tooltip = cagm_fishing_master_selected_tt
		hidden_effect = { trigger_event = cagm_fishing.0001 }
		ai_chance = { base = 80 }
	}
	option = {
		name = cagm_fishing.0003.b
		if = {
			limit = {
				can_employ_court_position_type = cagm_master_fisher_court_position
				scope:fishing_master_candidate_2 = { can_be_employed_as = cagm_master_fisher_court_position }
			}
			appoint_court_position = { recipient = scope:fishing_master_candidate_2 court_position = cagm_master_fisher_court_position }
		}
		involved_activity = { set_variable = { name = cagm_fishing_companion value = scope:fishing_master_candidate_2 } }
		custom_tooltip = cagm_fishing_master_selected_tt
		hidden_effect = { trigger_event = cagm_fishing.0001 }
		ai_chance = { base = 20 }
	}
}

# Arrival: establish the tone with the selected fishing specialist.
cagm_fishing.0001 = {
	type = activity_event
	title = cagm_fishing.0001.t
	desc = cagm_fishing.0001.desc
	theme = hunting
	override_background = { reference = bp3_riverside }
	left_portrait = { character = root animation = thinking }
	right_portrait = { trigger = { exists = scope:fishing_companion } character = scope:fishing_companion animation = admiration }

	immediate = {
		involved_activity = {
			if = {
				limit = { exists = var:cagm_fishing_companion }
				var:cagm_fishing_companion = { save_scope_as = fishing_companion }
			}
		}
		# Compatibility fallback for an activity started by an older build or a
		# direct debug-event call that bypassed the new dispatcher.
		if = {
			limit = {
				NOT = { exists = scope:fishing_companion }
			}
			involved_activity = {
				random_attending_character = {
					limit = { this != root is_adult = yes }
					save_scope_as = fishing_companion
				}
			}
		}
		if = {
			limit = { NOT = { exists = scope:fishing_companion } }
			create_character = {
				template = cagm_local_angler_character
				culture = root.location.culture
				faith = root.location.faith
				location = root.location
				save_scope_as = fishing_companion
			}
		}
		if = {
			limit = { exists = scope:fishing_companion }
			involved_activity = { set_variable = { name = cagm_fishing_companion value = scope:fishing_companion } }
		}
		if = {
			limit = { involved_activity = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_contest } } }
			involved_activity = { set_variable = { name = cagm_fishing_contest_rival value = scope:fishing_companion } }
		}
	}

	option = {
		name = cagm_fishing.0001.a
		add_stress = -10
		custom_tooltip = cagm_fishing_progress_good_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 6 }
				set_variable = { name = cagm_fishing_story_route_patience value = yes }
				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
			trigger_event = { id = cagm_fishing.0100 days = 4 }
		}
		ai_chance = { base = 45 modifier = { add = 30 stress >= 50 } }
	}
	option = {
		name = cagm_fishing.0001.b
		add_prestige = 25
		custom_tooltip = cagm_fishing_progress_small_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 3 }
				set_variable = { name = cagm_fishing_story_route_contest value = yes }
				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
			trigger_event = { id = cagm_fishing.0100 days = 4 }
		}
		ai_chance = { base = 25 modifier = { add = 20 has_trait = gregarious } }
	}
	option = {
		name = cagm_fishing.0001.c
		custom_tooltip = cagm_fishing_progress_strong_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 9 }
				set_variable = { name = cagm_fishing_story_route_study value = yes }
				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
			trigger_event = { id = cagm_fishing.0100 days = 4 }
		}
		ai_chance = { base = 30 modifier = { add = 20 learning >= 12 } }
	}
}

# Bait and method: local knowledge, careful tackle, or an ambitious cast.
cagm_fishing.0010 = {
	type = activity_event
	title = cagm_fishing.0010.t
	desc = cagm_fishing.0010.desc
	theme = hunting
	override_background = { reference = bp3_riverside }
	left_portrait = { character = root animation = personality_rational }

	option = {
		name = cagm_fishing.0010.a
		custom_tooltip = cagm_fishing_progress_strong_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 10 }
				set_variable = { name = cagm_fishing_story_method_local value = yes }
				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
			trigger_event = { id = cagm_fishing.0200 days = 4 }
		}
		ai_chance = { base = 40 modifier = { add = 20 stewardship >= 12 } }
	}
	option = {
		name = cagm_fishing.0010.b
		add_stress = -5
		custom_tooltip = cagm_fishing_progress_good_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 6 }
				set_variable = { name = cagm_fishing_story_method_steady value = yes }
				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
			trigger_event = { id = cagm_fishing.0200 days = 4 }
		}
		ai_chance = { base = 35 modifier = { add = 15 has_trait = patient } }
	}
	option = {
		name = cagm_fishing.0010.c
		add_stress = 10
		custom_tooltip = cagm_fishing_progress_great_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 12 }
				set_variable = { name = cagm_fishing_bold_method value = yes }
				set_variable = { name = cagm_fishing_story_method_bold value = yes }
				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
			trigger_event = { id = cagm_fishing.0200 days = 4 }
		}
		ai_chance = { base = 25 modifier = { add = 25 has_trait = brave } }
	}
}

# Weather and company can reshape the outing without changing its core roll.
cagm_fishing.0020 = {
	type = activity_event
	title = cagm_fishing.0020.t
	desc = cagm_fishing.0020.desc
	theme = hunting
	override_background = { reference = bp3_coast }
	left_portrait = { character = root animation = worry }
	right_portrait = { trigger = { exists = scope:fishing_companion } character = scope:fishing_companion animation = thinking }

	immediate = {
		involved_activity = {
			if = {
				limit = { exists = var:cagm_fishing_companion }
				var:cagm_fishing_companion = { save_scope_as = fishing_companion }
			}
		}
	}

	option = {
		name = cagm_fishing.0020.a
		add_stress = 10
		custom_tooltip = cagm_fishing_progress_great_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 12 }
				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
		}
		ai_chance = { base = 30 modifier = { add = 25 has_trait = stubborn } }
	}
	option = {
		name = cagm_fishing.0020.b
		add_stress = -5
		custom_tooltip = cagm_fishing_progress_good_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 6 }
				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
		}
		ai_chance = { base = 40 modifier = { add = 20 has_trait = calm } }
	}
	option = {
		name = cagm_fishing.0020.c
		trigger = { exists = scope:fishing_companion }
		custom_tooltip = cagm_fishing_progress_strong_opinion_tt
		scope:fishing_companion = { add_opinion = { target = root modifier = cagm_fishing_companion_opinion years = 3 } }
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 8 }
				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
		}
		ai_chance = { base = 30 modifier = { add = 20 has_trait = gregarious } }
	}
}

# The last visible choice trades the future of the water against immediate odds.
cagm_fishing.0030 = {
	type = activity_event
	title = cagm_fishing.0030.t
	desc = cagm_fishing.0030.desc
	theme = hunting
	override_background = { reference = bp3_riverside }
	left_portrait = { character = root animation = thinking }

	option = {
		name = cagm_fishing.0030.a
		add_prestige = 25
		custom_tooltip = cagm_fishing_progress_good_conservation_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 5 }

				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
		}
		ai_chance = { base = 40 modifier = { add = 20 has_trait = compassionate } }
	}
	option = {
		name = cagm_fishing.0030.b
		add_stress = 10
		custom_tooltip = cagm_fishing_progress_great_pressure_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 12 }
				set_variable = { name = cagm_fishing_pressed_waters value = yes }
				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
		}
		ai_chance = { base = 25 modifier = { add = 20 has_trait = greedy } }
	}
	option = {
		name = cagm_fishing.0030.c
		custom_tooltip = cagm_fishing_progress_strong_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_fishing_event_adjustment add = 8 }

				set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value }
			}
		}
		ai_chance = { base = 35 modifier = { add = 20 has_trait = generous } }
	}
}

# Authoritative final roll: the exact stored meter is read once.
# The opening route returns with a route-specific complication. Only the two
# options matching the route chosen in 0001 are visible.
cagm_fishing.0100 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_route_patience } } desc = cagm_fishing.0100.patient.t }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_route_contest } } desc = cagm_fishing.0100.contest.t }
			desc = cagm_fishing.0100.study.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_route_patience } } desc = cagm_fishing.0100.patient.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_route_contest } } desc = cagm_fishing.0100.contest.desc }
			desc = cagm_fishing.0100.study.desc
		}
	}
	theme = hunting
	override_background = { reference = bp3_riverside }
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	immediate = {
		if = {
			limit = { involved_activity = { exists = var:cagm_fishing_companion } }
			involved_activity.var:cagm_fishing_companion = { save_scope_as = fishing_companion }
		}
	}
	left_portrait = { character = root animation = thinking }
	right_portrait = { trigger = { exists = scope:fishing_companion } character = scope:fishing_companion animation = personality_rational }

	option = {
		name = cagm_fishing.0100.a
		trigger = { involved_activity = { has_variable = cagm_fishing_story_route_patience } }
		add_stress = -5
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 4 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_route_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 has_trait = patient } }
	}
	option = {
		name = cagm_fishing.0100.b
		trigger = { involved_activity = { has_variable = cagm_fishing_story_route_patience } }
		add_stress = 5
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 2 } set_variable = { name = cagm_fishing_story_route_ambition value = yes } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_route_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 20 has_trait = ambitious } }
	}
	option = {
		name = cagm_fishing.0100.c
		trigger = { involved_activity = { has_variable = cagm_fishing_story_route_contest } }
		add_prestige = 25
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 4 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_route_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 has_trait = just } }
	}
	option = {
		name = cagm_fishing.0100.d
		trigger = { involved_activity = { has_variable = cagm_fishing_story_route_contest } }
		add_stress = 5
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 2 } set_variable = { name = cagm_fishing_story_route_ambition value = yes } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_route_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 25 has_trait = gregarious } }
	}
	option = {
		name = cagm_fishing.0100.e
		trigger = { involved_activity = { has_variable = cagm_fishing_story_route_study } }
		add_learning_lifestyle_xp = 20
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 4 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_route_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 learning >= 12 } }
	}
	option = {
		name = cagm_fishing.0100.f
		trigger = { involved_activity = { has_variable = cagm_fishing_story_route_study } }
		add_stress = 5
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 2 } set_variable = { name = cagm_fishing_story_route_ambition value = yes } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_route_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 20 has_trait = brave } }
	}
}

# The chosen method creates a second branch before the weather event.
cagm_fishing.0200 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_local } } desc = cagm_fishing.0200.local.t }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_steady } } desc = cagm_fishing.0200.steady.t }
			desc = cagm_fishing.0200.bold.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_local } } desc = cagm_fishing.0200.local.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_steady } } desc = cagm_fishing.0200.steady.desc }
			desc = cagm_fishing.0200.bold.desc
		}
	}
	theme = hunting
	override_background = { reference = bp3_riverside }
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	left_portrait = { character = root animation = personality_rational }

	option = {
		name = cagm_fishing.0200.a
		trigger = { involved_activity = { has_variable = cagm_fishing_story_method_local } }
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 4 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_method_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 has_trait = humble } }
	}
	option = {
		name = cagm_fishing.0200.b
		trigger = { involved_activity = { has_variable = cagm_fishing_story_method_local } }
		add_prestige = 20
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 2 } set_variable = { name = cagm_fishing_story_method_ambition value = yes } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_method_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 20 has_trait = arrogant } }
	}
	option = {
		name = cagm_fishing.0200.c
		trigger = { involved_activity = { has_variable = cagm_fishing_story_method_steady } }
		add_stress = -5
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 4 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_method_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 has_trait = patient } }
	}
	option = {
		name = cagm_fishing.0200.d
		trigger = { involved_activity = { has_variable = cagm_fishing_story_method_steady } }
		add_stress = 5
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 2 } set_variable = { name = cagm_fishing_story_method_ambition value = yes } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_method_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 20 has_trait = impatient } }
	}
	option = {
		name = cagm_fishing.0200.e
		trigger = { involved_activity = { has_variable = cagm_fishing_story_method_bold } }
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 4 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_method_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 has_trait = calm } }
	}
	option = {
		name = cagm_fishing.0200.f
		trigger = { involved_activity = { has_variable = cagm_fishing_story_method_bold } }
		add_stress = 5
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 2 } set_variable = { name = cagm_fishing_story_method_ambition value = yes } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_method_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 25 has_trait = brave } }
	}
}

# Hunt-style contextual pulse. One of three incidents is drawn during the
# fixed active-phase timeline; the branches then rejoin before the final roll.
cagm_fishing.0050 = {
	type = activity_event
	hidden = yes
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	immediate = {
		random_list = {
			34 = { trigger_event = cagm_fishing.0300 }
			33 = { trigger_event = cagm_fishing.0310 }
			33 = { trigger_event = cagm_fishing.0320 }
		}
	}
}

cagm_fishing.0300 = {
	type = activity_event
	title = cagm_fishing.0300.t
	desc = cagm_fishing.0300.desc
	theme = hunting
	override_background = { reference = bp3_riverside }
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	left_portrait = { character = root animation = thinking }
	option = {
		name = cagm_fishing.0300.a
		add_learning_lifestyle_xp = 15
		custom_tooltip = cagm_fishing_progress_good_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 4 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_tangle_patient character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 60 modifier = { add = 20 has_trait = patient } }
	}
	option = {
		name = cagm_fishing.0300.b
		add_stress = 5
		custom_tooltip = cagm_fishing_progress_strong_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 7 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_tangle_cut character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 40 modifier = { add = 20 has_trait = impatient } }
	}
}

cagm_fishing.0310 = {
	type = activity_event
	title = cagm_fishing.0310.t
	desc = cagm_fishing.0310.desc
	theme = hunting
	override_background = { reference = bp3_riverside }
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	left_portrait = { character = root animation = worry }
	option = {
		name = cagm_fishing.0310.a
		add_stewardship_lifestyle_xp = 15
		custom_tooltip = cagm_fishing_progress_good_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 4 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_nets_clear character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 60 modifier = { add = 20 stewardship >= 12 } }
	}
	option = {
		name = cagm_fishing.0310.b
		add_prestige = 25
		add_stress = 5
		custom_tooltip = cagm_fishing_progress_strong_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 7 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_nets_confront character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 40 modifier = { add = 20 has_trait = brave } }
	}
}

cagm_fishing.0320 = {
	type = activity_event
	title = cagm_fishing.0320.t
	desc = cagm_fishing.0320.desc
	theme = hunting
	override_background = { reference = bp3_riverside }
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	left_portrait = { character = root animation = admiration }
	option = {
		name = cagm_fishing.0320.a
		add_stress = -5
		custom_tooltip = cagm_fishing_progress_good_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 4 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_child_teach character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 60 modifier = { add = 20 has_trait = compassionate } }
	}
	option = {
		name = cagm_fishing.0320.b
		add_prestige = 20
		custom_tooltip = cagm_fishing_progress_strong_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_fishing_event_adjustment add = 7 } set_variable = { name = cagm_fishing_success value = cagm_fishing_success_value } add_activity_log_entry = { key = cagm_fishing_log_child_contest character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 40 modifier = { add = 20 has_trait = gregarious } }
	}
}

cagm_fishing.0099 = {
	type = activity_event
	hidden = yes
	immediate = {
		random = {
			chance = { value = involved_activity.var:cagm_fishing_success }
			involved_activity = { set_variable = { name = cagm_fishing_success_roll value = yes } }
		}
		if = {
			limit = { involved_activity = { has_variable = cagm_fishing_success_roll } }
			random_list = {
				75 = { trigger_event = cagm_fishing.1100 }
				25 = {
					modifier = { add = 20 involved_activity = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_trophy } } }
					modifier = { add = 30 involved_activity = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_legendary } } }
					modifier = { add = 10 involved_activity = { has_variable = cagm_fishing_bold_method } }
					modifier = { add = 5 involved_activity = { has_variable = cagm_fishing_story_route_ambition } }
					modifier = { add = 5 involved_activity = { has_variable = cagm_fishing_story_method_ambition } }
					trigger_event = cagm_fishing.1200
				}
			}
		}
		else = { trigger_event = cagm_fishing.1000 }
	}
}

cagm_fishing.1000 = {
	type = activity_event
	title = cagm_fishing.1000.t
	desc = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_local } } desc = cagm_fishing.1000.local.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_steady } } desc = cagm_fishing.1000.steady.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_bold } } desc = cagm_fishing.1000.bold.desc }
			desc = cagm_fishing.1000.desc
		}
	}
	theme = hunting
	override_background = { reference = bp3_riverside }
	left_portrait = { character = root animation = worry }
	right_portrait = { trigger = { exists = scope:fishing_winner } character = scope:fishing_winner animation = admiration }
	immediate = {
		cagm_resolve_fishing_contest_effect = yes
		cagm_award_fishing_rival_xp_effect = { XP = 5 }
		if = {
			limit = { involved_activity = { has_variable = cagm_fishing_contest_winner } }
			involved_activity.var:cagm_fishing_contest_winner = { save_scope_as = fishing_winner }
			scope:fishing_winner = { add_prestige = 25 }
			involved_activity = {
				every_attending_character = {
					limit = { this != scope:fishing_winner }
					add_opinion = { target = scope:fishing_winner modifier = cagm_fishing_winner_opinion years = 2 }
				}
			}
		}
		involved_activity = {
			add_activity_log_entry = {
				key = cagm_fishing_log_failure
				character = root
				score = 25
				show_in_conclusion = yes
			}
		}
	}
	option = {
		name = cagm_fishing.1000.a
		add_prestige = 25
		cagm_award_tracked_trait_xp_effect = { TRAIT = cagm_angler XP = 5 }
		involved_activity = {
			set_variable = { name = cagm_fishing_result_failure value = yes }
			if = {
				limit = { has_variable = cagm_fishing_pressed_waters }
				activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 3 } } }
			}
			else = { activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 1 } } } }
		}
	}
}

cagm_fishing.1100 = {
	type = activity_event
	title = cagm_fishing.1100.t
	desc = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_local } } desc = cagm_fishing.1100.local.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_steady } } desc = cagm_fishing.1100.steady.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_bold } } desc = cagm_fishing.1100.bold.desc }
			desc = cagm_fishing.1100.desc
		}
	}
	theme = hunting
	override_background = { reference = bp3_riverside }
	left_portrait = { character = root animation = war_over_win }
	right_portrait = { trigger = { exists = scope:fishing_winner } character = scope:fishing_winner animation = admiration }
	immediate = {
		add_prestige = 100
		add_stress = -10
		cagm_award_tracked_trait_xp_effect = { TRAIT = cagm_angler XP = 20 }
		cagm_award_fishing_rival_xp_effect = { XP = 15 }
		cagm_resolve_fishing_contest_effect = yes
		if = {
			limit = { involved_activity = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_quiet } } }
			add_stress = -20
			cagm_replace_fishing_reward_effect = { MODIFIER = cagm_fishing_quiet_waters YEARS = 3 }
		}
		if = {
			limit = { involved_activity = { has_variable = cagm_fishing_contest_winner } }
			involved_activity.var:cagm_fishing_contest_winner = { save_scope_as = fishing_winner }
			scope:fishing_winner = { add_prestige = 75 }
			involved_activity = {
				every_attending_character = {
					limit = { this != scope:fishing_winner }
					add_opinion = { target = scope:fishing_winner modifier = cagm_fishing_winner_opinion years = 3 }
				}
			}
		}
		involved_activity = {
			set_variable = { name = cagm_fishing_result_success value = yes }
			add_activity_log_entry = { key = cagm_fishing_log_success character = root score = 75 show_in_conclusion = yes }
		}
	}
	option = {
		name = cagm_fishing.1100.a
		add_piety = 75
		involved_activity = { activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 1 } add_county_modifier = { modifier = cagm_fishing_protected_waters years = 4 } } } }
		ai_chance = { base = 20 modifier = { add = 30 has_trait = compassionate } }
	}
	option = {
		name = cagm_fishing.1100.b
		add_prestige = 50
		involved_activity = { every_attending_character = { limit = { this != scope:host } add_opinion = { target = root modifier = cagm_fishing_shared_catch_opinion years = 3 } } activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 2 } } } }
		ai_chance = { base = 25 modifier = { add = 30 has_trait = generous } }
	}
	option = {
		name = cagm_fishing.1100.c
		add_gold = 75
		involved_activity = { activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 3 } } } }
		ai_chance = { base = 25 modifier = { add = 30 has_trait = greedy } }
	}
	option = {
		name = cagm_fishing.1100.d
		add_stress = -20
		add_prestige = 25
		involved_activity = { activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 2 } } } }
		ai_chance = { base = 20 modifier = { add = 30 stress >= 50 } }
	}
	option = {
		name = cagm_fishing.1100.e
		trigger = { involved_activity = { OR = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_trophy } has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_legendary } } } }
		add_prestige = 75
		if = {
			limit = { involved_activity = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_legendary } } }
			cagm_create_legendary_fish_trophy_effect = yes
			remove_character_flag = cagm_fishing_legendary_rumor
			remove_character_flag = cagm_fishing_quarry_silverback
			remove_character_flag = cagm_fishing_quarry_blackfin
			remove_character_flag = cagm_fishing_quarry_crowned_sturgeon
		}
		else = { cagm_create_random_fish_relic_effect = yes }
		involved_activity = { activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 3 } } } }
		ai_chance = { base = 35 modifier = { add = 40 has_trait = ambitious } }
	}
}

cagm_fishing.1200 = {
	type = activity_event
	title = cagm_fishing.1200.t
	desc = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_local } } desc = cagm_fishing.1200.local.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_steady } } desc = cagm_fishing.1200.steady.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_fishing_story_method_bold } } desc = cagm_fishing.1200.bold.desc }
			desc = cagm_fishing.1200.desc
		}
	}
	theme = hunting
	override_background = { reference = bp3_riverside }
	left_portrait = { character = root animation = war_over_win }
	right_portrait = { trigger = { exists = scope:fishing_winner } character = scope:fishing_winner animation = war_over_win }
	immediate = {
		add_prestige = 250
		add_stress = -25
		cagm_award_tracked_trait_xp_effect = { TRAIT = cagm_angler XP = 35 }
		cagm_award_fishing_rival_xp_effect = { XP = 25 }
		cagm_resolve_fishing_contest_effect = yes
		cagm_replace_fishing_reward_effect = { MODIFIER = cagm_fishing_master_catch YEARS = 5 }
		if = {
			limit = { involved_activity = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_quiet } } }
			add_stress = -20
		}
		if = {
			limit = { involved_activity = { has_variable = cagm_fishing_contest_winner } }
			involved_activity.var:cagm_fishing_contest_winner = { save_scope_as = fishing_winner }
			scope:fishing_winner = { add_prestige = 150 }
			involved_activity = {
				every_attending_character = {
					limit = { this != scope:fishing_winner }
					add_opinion = { target = scope:fishing_winner modifier = cagm_fishing_winner_opinion years = 5 }
				}
			}
		}
		involved_activity = {
			set_variable = { name = cagm_fishing_result_exceptional value = yes }
			add_activity_log_entry = { key = cagm_fishing_log_exceptional character = root score = 100 show_in_conclusion = yes }
		}
	}
	option = {
		name = cagm_fishing.1200.a
		trigger = { involved_activity = { NOT = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_legendary } } } }
		add_piety = 150
		involved_activity = { activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 1 } add_county_modifier = { modifier = cagm_fishing_protected_waters years = 6 } } } }
		ai_chance = { base = 20 modifier = { add = 30 has_trait = compassionate } }
	}
	option = {
		name = cagm_fishing.1200.b
		trigger = { involved_activity = { NOT = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_legendary } } } }
		add_prestige = 100
		involved_activity = { every_attending_character = { limit = { this != scope:host } add_opinion = { target = root modifier = cagm_fishing_shared_catch_opinion years = 5 } } activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 2 } } } }
		ai_chance = { base = 25 modifier = { add = 30 has_trait = generous } }
	}
	option = {
		name = cagm_fishing.1200.c
		trigger = { involved_activity = { NOT = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_legendary } } } }
		add_gold = 150
		involved_activity = { activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 3 } } } }
		ai_chance = { base = 25 modifier = { add = 30 has_trait = greedy } }
	}
	option = {
		name = cagm_fishing.1200.d
		trigger = { involved_activity = { NOT = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_legendary } } } }
		add_stress = -30
		add_prestige = 50
		involved_activity = { activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 2 } } } }
		ai_chance = { base = 20 modifier = { add = 30 stress >= 50 } }
	}
	option = {
		name = cagm_fishing.1200.e
		trigger = { involved_activity = { OR = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_trophy } has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_legendary } } } }
		add_prestige = 150
		if = {
			limit = { involved_activity = { has_activity_option = { category = cagm_fishing_purpose option = cagm_fishing_legendary } } }
			cagm_create_legendary_fish_trophy_effect = yes
			remove_character_flag = cagm_fishing_legendary_rumor
			remove_character_flag = cagm_fishing_quarry_silverback
			remove_character_flag = cagm_fishing_quarry_blackfin
			remove_character_flag = cagm_fishing_quarry_crowned_sturgeon
		}
		else = { cagm_create_random_fish_relic_effect = yes }
		involved_activity = { activity_location = { county = { add_county_modifier = { modifier = cagm_fishing_recently_fished years = 3 } } } }
		ai_chance = { base = 40 modifier = { add = 40 has_trait = ambitious } }
	}
}
