﻿namespace = cagm_apiary

cagm_apiary.0001 = {
	type = activity_event
	title = cagm_apiary.0001.t
	desc = cagm_apiary.0001.desc
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	immediate = {
		involved_activity = {
			random_attending_character = {
				limit = {
					this != root is_adult = yes is_landed = no is_imprisoned = no
					NOT = { is_incapable = yes }
					OR = { has_trait = cagm_apiarist has_trait = lifestyle_gardener has_trait = lifestyle_herbalist }
				}
				save_scope_as = lead_keeper
			}
		}
		if = {
			limit = { NOT = { exists = scope:lead_keeper } }
			involved_activity = {
				random_attending_character = {
					limit = { this != root is_adult = yes is_landed = no is_imprisoned = no NOT = { is_incapable = yes } }
					save_scope_as = lead_keeper
				}
			}
		}
		if = {
			limit = { NOT = { exists = scope:lead_keeper } }
			create_character = {
				template = cagm_local_apiarist_character
				culture = root.location.culture
				faith = root.location.faith
				location = root.location
				save_scope_as = lead_keeper
			}
		}
		involved_activity = { set_variable = { name = cagm_apiary_lead_keeper value = scope:lead_keeper } }
	}
	left_portrait = { character = root animation = thinking }
	right_portrait = { character = scope:lead_keeper animation = personality_rational }
	option = {
		name = cagm_apiary.0001.a
		custom_tooltip = cagm_apiary_progress_good_protection_tt
		scope:lead_keeper = { add_opinion = { target = root modifier = cagm_apiary_protected_swarm_opinion years = 4 } }
		hidden_effect = {
			involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 8 } set_variable = { name = cagm_apiary_story_route_forage value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } }
			trigger_event = { id = cagm_apiary.0100 days = 3 }
		}
		ai_chance = { base = 45 modifier = { add = 25 has_trait = compassionate } }
	}
	option = {
		name = cagm_apiary.0001.b
		trigger = { gold >= 10 }
		remove_short_term_gold = 10
		custom_tooltip = cagm_apiary_progress_strong_cost_tt
		hidden_effect = {
			involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 10 } set_variable = { name = cagm_apiary_story_route_site value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } }
			trigger_event = { id = cagm_apiary.0100 days = 3 }
		}
		ai_chance = { base = 35 modifier = { add = 20 stewardship >= 12 } }
	}
	option = {
		name = cagm_apiary.0001.c
		custom_tooltip = cagm_apiary_progress_small_tt
		hidden_effect = {
			involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 5 } set_variable = { name = cagm_apiary_story_route_easy value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } }
			trigger_event = { id = cagm_apiary.0100 days = 3 }
		}
		ai_chance = { base = 20 modifier = { add = 20 has_trait = impatient } }
	}
}

cagm_apiary.0010 = {
	type = activity_event
	title = cagm_apiary.0010.t
	desc = cagm_apiary.0010.desc
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	immediate = { involved_activity.var:cagm_apiary_lead_keeper = { save_scope_as = lead_keeper } }
	left_portrait = { character = root animation = personality_rational }
	right_portrait = { character = scope:lead_keeper animation = admiration }
	option = {
		name = cagm_apiary.0010.a
		custom_tooltip = cagm_apiary_progress_good_protection_tt
		hidden_effect = {
			involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 8 } set_variable = { name = cagm_apiary_story_method_gentle value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } }
			trigger_event = { id = cagm_apiary.0200 days = 3 }
		}
		ai_chance = { base = 45 modifier = { add = 25 has_trait = patient } }
	}
	option = {
		name = cagm_apiary.0010.b
		custom_tooltip = cagm_apiary_progress_strong_tt
		hidden_effect = {
			involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 10 } set_variable = { name = cagm_apiary_story_method_keeper value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } }
			trigger_event = { id = cagm_apiary.0200 days = 3 }
		}
		ai_chance = { base = 40 modifier = { add = 20 learning >= 12 } }
	}
	option = {
		name = cagm_apiary.0010.c
		add_stress = 10
		custom_tooltip = cagm_apiary_progress_great_fright_tt
		hidden_effect = {
			involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = -5 } set_variable = { name = cagm_apiary_frightened_colony value = yes } set_variable = { name = cagm_apiary_story_method_force value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } }
			trigger_event = { id = cagm_apiary.0200 days = 3 }
		}
		ai_chance = { base = 15 modifier = { add = 25 has_trait = impatient } }
	}
}

cagm_apiary.0020 = {
	type = activity_event
	title = cagm_apiary.0020.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					OR = {
						faith.religion = religion:jainism_religion
						involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_shelter } }
					}
				}
				desc = cagm_apiary.0020.shelter_desc
			}
			desc = cagm_apiary.0020.desc
		}
	}
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	immediate = { involved_activity.var:cagm_apiary_lead_keeper = { save_scope_as = lead_keeper } }
	left_portrait = { character = root animation = thinking }
	right_portrait = { character = scope:lead_keeper animation = personality_rational }
	option = {
		name = cagm_apiary.0020.a
		trigger = {
			NOT = { faith.religion = religion:jainism_religion }
			involved_activity = { NOT = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_shelter } } }
		}
		custom_tooltip = cagm_apiary_progress_good_protection_tt
		scope:lead_keeper = { add_opinion = { target = root modifier = cagm_apiary_protected_swarm_opinion years = 4 } }
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 8 } set_variable = { name = cagm_apiary_left_stores value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } } }
		ai_chance = { base = 45 modifier = { add = 25 has_trait = compassionate } }
	}
	option = {
		name = cagm_apiary.0020.b
		trigger = {
			NOT = { faith.religion = religion:jainism_religion }
			involved_activity = { NOT = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_shelter } } }
		}
		custom_tooltip = cagm_apiary_progress_strong_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 10 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } } }
		ai_chance = { base = 40 modifier = { add = 20 stewardship >= 12 } }
	}
	option = {
		name = cagm_apiary.0020.c
		trigger = {
			NOT = { faith.religion = religion:jainism_religion }
			involved_activity = { NOT = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_shelter } } }
		}
		add_gold = 35
		custom_tooltip = cagm_apiary_progress_great_overharvest_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = -10 } set_variable = { name = cagm_apiary_overharvest value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } } }
		ai_chance = { base = 15 modifier = { add = 30 has_trait = greedy } }
	}
	option = {
		name = cagm_apiary.0020.d
		trigger = {
			OR = {
				faith.religion = religion:jainism_religion
				involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_shelter } }
			}
		}
		custom_tooltip = cagm_apiary_progress_strong_shelter_tt
		hidden_effect = {
			involved_activity = {
				change_variable = { name = cagm_apiary_event_adjustment add = 10 }
				set_variable = { name = cagm_apiary_left_stores value = yes }
				set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value }
			}
		}
		ai_chance = { base = 50 modifier = { add = 30 has_trait = compassionate } modifier = { add = 20 has_trait = zealous } }
	}
}

cagm_apiary.0030 = {
	type = activity_event
	title = cagm_apiary.0030.t
	desc = cagm_apiary.0030.desc
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	immediate = { involved_activity.var:cagm_apiary_lead_keeper = { save_scope_as = lead_keeper } }
	left_portrait = { character = root animation = worry }
	right_portrait = { character = scope:lead_keeper animation = personality_rational }
	option = {
		name = cagm_apiary.0030.a
		add_stress = 5
		custom_tooltip = cagm_apiary_progress_good_safe_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 8 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } } }
		ai_chance = { base = 40 modifier = { add = 25 has_trait = patient } }
	}
	option = {
		name = cagm_apiary.0030.b
		custom_tooltip = cagm_apiary_progress_strong_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 10 } set_variable = { name = cagm_apiary_trained_hands value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } } }
		ai_chance = { base = 45 modifier = { add = 20 learning >= 12 } }
	}
	option = {
		name = cagm_apiary.0030.c
		add_stress = 10
		custom_tooltip = cagm_apiary_progress_great_smoke_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = -8 } set_variable = { name = cagm_apiary_harsh_smoke value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } } }
		ai_chance = { base = 15 modifier = { add = 25 has_trait = brave } }
	}
}

cagm_apiary.0100 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_route_forage } } desc = cagm_apiary.0100.forage.t }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_route_site } } desc = cagm_apiary.0100.site.t }
			desc = cagm_apiary.0100.easy.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_route_forage } } desc = cagm_apiary.0100.forage.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_route_site } } desc = cagm_apiary.0100.site.desc }
			desc = cagm_apiary.0100.easy.desc
		}
	}
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	immediate = { involved_activity.var:cagm_apiary_lead_keeper = { save_scope_as = lead_keeper } }
	left_portrait = { character = root animation = thinking }
	right_portrait = { trigger = { exists = scope:lead_keeper } character = scope:lead_keeper animation = personality_rational }

	option = {
		name = cagm_apiary.0100.a
		trigger = { involved_activity = { has_variable = cagm_apiary_story_route_forage } }
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 4 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_route_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 has_trait = compassionate } }
	}
	option = {
		name = cagm_apiary.0100.b
		trigger = { involved_activity = { has_variable = cagm_apiary_story_route_forage } }
		add_stewardship_lifestyle_xp = 15
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 2 } set_variable = { name = cagm_apiary_story_route_ambition value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_route_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 20 stewardship >= 12 } }
	}
	option = {
		name = cagm_apiary.0100.c
		trigger = { involved_activity = { has_variable = cagm_apiary_story_route_site } }
		add_stewardship_lifestyle_xp = 20
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 4 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_route_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 has_trait = diligent } }
	}
	option = {
		name = cagm_apiary.0100.d
		trigger = { involved_activity = { has_variable = cagm_apiary_story_route_site } }
		add_prestige = 20
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 2 } set_variable = { name = cagm_apiary_story_route_ambition value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_route_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 20 has_trait = ambitious } }
	}
	option = {
		name = cagm_apiary.0100.e
		trigger = { involved_activity = { has_variable = cagm_apiary_story_route_easy } }
		add_stress = 5
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 4 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_route_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 has_trait = patient } }
	}
	option = {
		name = cagm_apiary.0100.f
		trigger = { involved_activity = { has_variable = cagm_apiary_story_route_easy } }
		add_prestige = 20
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 2 } set_variable = { name = cagm_apiary_story_route_ambition value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_route_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 25 has_trait = impatient } }
	}
}

cagm_apiary.0200 = {
	type = activity_event
	title = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_gentle } } desc = cagm_apiary.0200.gentle.t }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_keeper } } desc = cagm_apiary.0200.keeper.t }
			desc = cagm_apiary.0200.force.t
		}
	}
	desc = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_gentle } } desc = cagm_apiary.0200.gentle.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_keeper } } desc = cagm_apiary.0200.keeper.desc }
			desc = cagm_apiary.0200.force.desc
		}
	}
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	immediate = { involved_activity.var:cagm_apiary_lead_keeper = { save_scope_as = lead_keeper } }
	left_portrait = { character = root animation = worry }
	right_portrait = { trigger = { exists = scope:lead_keeper } character = scope:lead_keeper animation = personality_rational }

	option = {
		name = cagm_apiary.0200.a
		trigger = { involved_activity = { has_variable = cagm_apiary_story_method_gentle } }
		add_stress = -5
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 4 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_method_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 has_trait = compassionate } }
	}
	option = {
		name = cagm_apiary.0200.b
		trigger = { involved_activity = { has_variable = cagm_apiary_story_method_gentle } }
		add_stewardship_lifestyle_xp = 15
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 2 } set_variable = { name = cagm_apiary_story_method_ambition value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_method_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 20 has_trait = diligent } }
	}
	option = {
		name = cagm_apiary.0200.c
		trigger = { involved_activity = { has_variable = cagm_apiary_story_method_keeper } }
		custom_tooltip = cagm_branch_steady_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 4 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_method_steady character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 65 modifier = { add = 20 has_trait = humble } }
	}
	option = {
		name = cagm_apiary.0200.d
		trigger = { involved_activity = { has_variable = cagm_apiary_story_method_keeper } }
		add_learning_lifestyle_xp = 15
		custom_tooltip = cagm_branch_ambitious_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 2 } set_variable = { name = cagm_apiary_story_method_ambition value = yes } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_method_ambitious character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 35 modifier = { add = 20 learning >= 12 } }
	}
	option = {
		name = cagm_apiary.0200.e
		trigger = { involved_activity = { has_variable = cagm_apiary_story_method_force } }
		add_stress = -5
		custom_tooltip = cagm_branch_recovery_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 4 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_method_recovery character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 60 modifier = { add = 20 has_trait = patient } }
	}
	option = {
		name = cagm_apiary.0200.f
		trigger = { involved_activity = { has_variable = cagm_apiary_story_method_force } }
		custom_tooltip = cagm_branch_recovery_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 3 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_method_recovery character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 40 modifier = { add = 20 has_trait = compassionate } }
	}
}

# Hunt-style contextual pulse: one apiary incident is sampled and then rejoins
# the fixed harvest or shelter timeline.
cagm_apiary.0050 = {
	type = activity_event
	hidden = yes
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	immediate = {
		random_list = {
			34 = { trigger_event = cagm_apiary.0300 }
			33 = { trigger_event = cagm_apiary.0310 }
			33 = { trigger_event = cagm_apiary.0320 }
		}
	}
}

cagm_apiary.0300 = {
	type = activity_event
	title = cagm_apiary.0300.t
	desc = cagm_apiary.0300.desc
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	left_portrait = { character = root animation = worry }
	option = {
		name = cagm_apiary.0300.a
		add_stress = -5
		custom_tooltip = cagm_apiary_progress_small_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 4 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_sting_withdraw character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 60 modifier = { add = 20 has_trait = compassionate } }
	}
	option = {
		name = cagm_apiary.0300.b
		add_stress = 5
		custom_tooltip = cagm_apiary_progress_strong_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 7 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_sting_veil character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 40 modifier = { add = 20 has_trait = brave } }
	}
}

cagm_apiary.0310 = {
	type = activity_event
	title = cagm_apiary.0310.t
	desc = cagm_apiary.0310.desc
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	left_portrait = { character = root animation = thinking }
	option = {
		name = cagm_apiary.0310.a
		add_stewardship_lifestyle_xp = 15
		custom_tooltip = cagm_apiary_progress_small_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 4 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_animal_lure character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 60 modifier = { add = 20 has_trait = patient } }
	}
	option = {
		name = cagm_apiary.0310.b
		add_prestige = 20
		add_stress = 5
		custom_tooltip = cagm_apiary_progress_strong_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 7 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_animal_drive character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 40 modifier = { add = 20 has_trait = brave } }
	}
}

cagm_apiary.0320 = {
	type = activity_event
	title = cagm_apiary.0320.t
	desc = cagm_apiary.0320.desc
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	trigger = { exists = scope:activity involved_activity.activity_host ?= this }
	left_portrait = { character = root animation = personality_rational }
	option = {
		name = cagm_apiary.0320.a
		add_piety = 20
		custom_tooltip = cagm_apiary_progress_small_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 4 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_forage_boundary character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 60 modifier = { add = 20 has_trait = just } }
	}
	option = {
		name = cagm_apiary.0320.b
		add_stewardship_lifestyle_xp = 20
		custom_tooltip = cagm_apiary_progress_strong_tt
		hidden_effect = { involved_activity = { change_variable = { name = cagm_apiary_event_adjustment add = 7 } set_variable = { name = cagm_apiary_success value = cagm_apiary_success_value } add_activity_log_entry = { key = cagm_apiary_log_forage_strip character = root score = 10 show_in_conclusion = no } } }
		ai_chance = { base = 40 modifier = { add = 20 stewardship >= 12 } }
	}
}

cagm_apiary.0099 = {
	type = activity_event
	hidden = yes
	immediate = {
		random = {
			chance = { value = involved_activity.var:cagm_apiary_success }
			involved_activity = { set_variable = { name = cagm_apiary_success_roll value = yes } }
		}
		if = {
			limit = { involved_activity = { has_variable = cagm_apiary_success_roll } }
			random_list = {
				75 = { trigger_event = cagm_apiary.1100 }
				25 = {
					modifier = {
						factor = 0
						involved_activity = {
							OR = {
								has_variable = cagm_apiary_frightened_colony
								has_variable = cagm_apiary_overharvest
								has_variable = cagm_apiary_harsh_smoke
							}
						}
					}
					modifier = { add = 10 involved_activity = { has_activity_option = { category = cagm_apiary_preparations option = cagm_apiary_preparations_grand } } }
					modifier = { add = 10 involved_activity = { has_variable = cagm_apiary_left_stores } }
					modifier = { add = 10 involved_activity = { has_variable = cagm_apiary_trained_hands } }
					modifier = { add = 5 involved_activity = { has_variable = cagm_apiary_story_route_ambition } }
					modifier = { add = 5 involved_activity = { has_variable = cagm_apiary_story_method_ambition } }
					trigger_event = cagm_apiary.1200
				}
			}
		}
		else = { trigger_event = cagm_apiary.1000 }
	}
}

cagm_apiary.1000 = {
	type = activity_event
	title = cagm_apiary.1000.t
	desc = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_gentle } } desc = cagm_apiary.1000.gentle.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_keeper } } desc = cagm_apiary.1000.keeper.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_force } } desc = cagm_apiary.1000.force.desc }
			desc = cagm_apiary.1000.desc
		}
	}
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	left_portrait = { character = root animation = worry }
	immediate = {
		involved_activity = {
			add_activity_log_entry = {
				key = cagm_apiary_log_failure
				character = root
				score = 25
				show_in_conclusion = yes
			}
		}
	}
	option = {
		name = cagm_apiary.1000.a
		add_stress = 15
		add_prestige = -25
		if = { limit = { OR = { involved_activity = { has_variable = cagm_apiary_overharvest } involved_activity = { has_variable = cagm_apiary_harsh_smoke } } } add_prestige = -50 }
		cagm_award_apiary_participant_xp_effect = { XP = 5 }
		involved_activity = { set_variable = { name = cagm_apiary_result_failure value = yes } }
	}
}

cagm_apiary.1100 = {
	type = activity_event
	title = cagm_apiary.1100.t
	desc = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_gentle } } desc = cagm_apiary.1100.gentle.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_keeper } } desc = cagm_apiary.1100.keeper.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_force } } desc = cagm_apiary.1100.force.desc }
			desc = cagm_apiary.1100.desc
		}
	}
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	left_portrait = { character = root animation = war_over_win }
	immediate = {
		involved_activity = {
			add_activity_log_entry = {
				key = cagm_apiary_log_success
				character = root
				score = 75
				show_in_conclusion = yes
			}
		}
	}
	option = {
		name = cagm_apiary.1100.a
		trigger = { involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_establish } } }
		add_prestige = 175
		cagm_award_apiary_participant_xp_effect = { XP = 20 }
		involved_activity = { activity_location = { county = { cagm_upgrade_apiary_county_effect = yes } } set_variable = { name = cagm_apiary_result_success value = yes } }
		if = { limit = { involved_activity = { has_activity_option = { category = cagm_apiary_role option = cagm_apiary_role_patron } } } trigger_event = { id = cagm_apiary.1300 days = 1 } }
	}
	option = {
		name = cagm_apiary.1100.b
		trigger = { involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_harvest } } }
		add_gold = 75
		add_stress = -20
		cagm_replace_apiary_product_effect = { MODIFIER = cagm_apiary_honey_reserve YEARS = 5 }
		cagm_award_apiary_participant_xp_effect = { XP = 20 }
		involved_activity = { activity_location = { county = { cagm_upgrade_apiary_county_effect = yes } } set_variable = { name = cagm_apiary_result_success value = yes } }
		if = { limit = { involved_activity = { has_activity_option = { category = cagm_apiary_role option = cagm_apiary_role_patron } } } trigger_event = { id = cagm_apiary.1300 days = 1 } }
	}
	option = {
		name = cagm_apiary.1100.c
		trigger = { involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_wax } } }
		add_prestige = 125
		add_piety = 100
		cagm_replace_apiary_product_effect = { MODIFIER = cagm_apiary_wax_commission YEARS = 5 }
		cagm_award_apiary_participant_xp_effect = { XP = 20 }
		involved_activity = { activity_location = { county = { cagm_upgrade_apiary_county_effect = yes } } set_variable = { name = cagm_apiary_result_success value = yes } }
		if = { limit = { involved_activity = { has_activity_option = { category = cagm_apiary_role option = cagm_apiary_role_patron } } } trigger_event = { id = cagm_apiary.1300 days = 1 } }
	}
	option = {
		name = cagm_apiary.1100.d
		trigger = { involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_seek_great_swarm } } }
		add_prestige = 250
		cagm_award_apiary_participant_xp_effect = { XP = 20 }
		remove_character_flag = cagm_apiary_great_swarm_rumor
		involved_activity = { activity_location = { county = { cagm_upgrade_apiary_county_effect = yes remove_county_modifier = cagm_apiary_great_swarm add_county_modifier = { modifier = cagm_apiary_great_swarm years = 10 } } } set_variable = { name = cagm_apiary_result_success value = yes } }
		if = { limit = { involved_activity = { has_activity_option = { category = cagm_apiary_role option = cagm_apiary_role_patron } } } trigger_event = { id = cagm_apiary.1300 days = 1 } }
	}
	option = {
		name = cagm_apiary.1100.e
		trigger = { involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_shelter } } }
		add_piety = 175
		add_stress = -30
		cagm_award_apiary_participant_xp_effect = { XP = 20 }
		involved_activity = { every_attending_character = { limit = { this != scope:host } add_opinion = { target = root modifier = cagm_apiary_protected_swarm_opinion years = 5 } } activity_location = { county = { cagm_upgrade_apiary_county_effect = yes } } set_variable = { name = cagm_apiary_result_success value = yes } }
		if = { limit = { involved_activity = { has_activity_option = { category = cagm_apiary_role option = cagm_apiary_role_patron } } } trigger_event = { id = cagm_apiary.1300 days = 1 } }
	}
}

cagm_apiary.1200 = {
	type = activity_event
	title = cagm_apiary.1200.t
	desc = {
		first_valid = {
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_gentle } } desc = cagm_apiary.1200.gentle.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_keeper } } desc = cagm_apiary.1200.keeper.desc }
			triggered_desc = { trigger = { involved_activity = { has_variable = cagm_apiary_story_method_force } } desc = cagm_apiary.1200.force.desc }
			desc = cagm_apiary.1200.desc
		}
	}
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	left_portrait = { character = root animation = war_over_win }
	immediate = {
		involved_activity = {
			add_activity_log_entry = {
				key = cagm_apiary_log_exceptional
				character = root
				score = 100
				show_in_conclusion = yes
			}
		}
	}
	option = {
		name = cagm_apiary.1200.a
		trigger = { involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_establish } } }
		add_prestige = 350
		cagm_create_beekeeper_record_artifact_effect = yes
		cagm_award_apiary_participant_xp_effect = { XP = 35 }
		involved_activity = { activity_location = { county = { cagm_upgrade_apiary_county_effect = yes } } set_variable = { name = cagm_apiary_result_exceptional value = yes } }
		if = { limit = { involved_activity = { has_activity_option = { category = cagm_apiary_role option = cagm_apiary_role_patron } } } trigger_event = { id = cagm_apiary.1300 days = 1 } }
	}
	option = {
		name = cagm_apiary.1200.b
		trigger = { involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_harvest } } }
		add_gold = 150
		add_prestige = 250
		add_stress = -35
		cagm_replace_apiary_product_effect = { MODIFIER = cagm_apiary_honey_reserve YEARS = 7 }
		cagm_create_honey_artifact_effect = yes
		cagm_award_apiary_participant_xp_effect = { XP = 35 }
		involved_activity = { activity_location = { county = { cagm_upgrade_apiary_county_effect = yes } } set_variable = { name = cagm_apiary_result_exceptional value = yes } }
		if = { limit = { involved_activity = { has_activity_option = { category = cagm_apiary_role option = cagm_apiary_role_patron } } } trigger_event = { id = cagm_apiary.1300 days = 1 } }
	}
	option = {
		name = cagm_apiary.1200.c
		trigger = { involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_wax } } }
		add_prestige = 300
		add_piety = 200
		cagm_replace_apiary_product_effect = { MODIFIER = cagm_apiary_wax_commission YEARS = 7 }
		cagm_create_random_wax_artifact_effect = yes
		cagm_award_apiary_participant_xp_effect = { XP = 35 }
		involved_activity = { activity_location = { county = { cagm_upgrade_apiary_county_effect = yes } } set_variable = { name = cagm_apiary_result_exceptional value = yes } }
		if = { limit = { involved_activity = { has_activity_option = { category = cagm_apiary_role option = cagm_apiary_role_patron } } } trigger_event = { id = cagm_apiary.1300 days = 1 } }
	}
	option = {
		name = cagm_apiary.1200.d
		trigger = { involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_seek_great_swarm } } }
		add_prestige = 500
		cagm_create_beekeeper_record_artifact_effect = yes
		cagm_award_apiary_participant_xp_effect = { XP = 35 }
		remove_character_flag = cagm_apiary_great_swarm_rumor
		involved_activity = { activity_location = { county = { cagm_upgrade_apiary_county_effect = yes remove_county_modifier = cagm_apiary_great_swarm add_county_modifier = { modifier = cagm_apiary_great_swarm years = 16 } } } set_variable = { name = cagm_apiary_result_exceptional value = yes } }
		if = { limit = { involved_activity = { has_activity_option = { category = cagm_apiary_role option = cagm_apiary_role_patron } } } trigger_event = { id = cagm_apiary.1300 days = 1 } }
	}
	option = {
		name = cagm_apiary.1200.e
		trigger = { involved_activity = { has_activity_option = { category = cagm_apiary_purpose option = cagm_apiary_shelter } } }
		add_piety = 350
		add_prestige = 200
		add_stress = -45
		cagm_create_beekeeper_record_artifact_effect = yes
		cagm_award_apiary_participant_xp_effect = { XP = 35 }
		involved_activity = { every_attending_character = { limit = { this != scope:host } add_opinion = { target = root modifier = cagm_apiary_protected_swarm_opinion years = 7 } } activity_location = { county = { cagm_upgrade_apiary_county_effect = yes } } set_variable = { name = cagm_apiary_result_exceptional value = yes } }
		if = { limit = { involved_activity = { has_activity_option = { category = cagm_apiary_role option = cagm_apiary_role_patron } } } trigger_event = { id = cagm_apiary.1300 days = 1 } }
	}
}

cagm_apiary.1300 = {
	type = activity_event
	title = cagm_apiary.1300.t
	desc = cagm_apiary.1300.desc
	theme = stewardship
	override_background = { reference = ep2_hunt_foggy_forest }
	immediate = { involved_activity.var:cagm_apiary_lead_keeper = { save_scope_as = lead_keeper } }
	left_portrait = { character = root animation = personality_rational }
	right_portrait = { character = scope:lead_keeper animation = admiration }
	option = {
		name = cagm_apiary.1300.a
		trigger = { scope:lead_keeper = { employer != root is_landed = no } }
		scope:lead_keeper = { set_employer = root }
		ai_chance = { base = 55 }
	}
	option = {
		name = cagm_apiary.1300.b
		add_prestige = 50
		scope:lead_keeper = { add_opinion = { target = root modifier = cagm_apiary_protected_swarm_opinion years = 5 } }
		ai_chance = { base = 45 }
	}
}
