﻿#EK NOTE: Removed real-world places.
# Effects used in the Wanderer Lifestyle

visiting_poi_effect = {
	#EK DISABLED: Disabling all the vanilla buildings. Any multi-province special buildings should be added here.
	#if = { # Offa's Dyke
	#	limit = {
	#		OR = {
	#			scope:province = province:1632
	#			scope:province = province:1633
	#			scope:province = province:1634
	#			scope:province = province:1648
	#			scope:province = province:1646
	#			scope:province = province:1643
	#		}
	#	}
	#	visiting_poi_variable_effect = { PROVINCE = province:1632 }
	#	visiting_poi_variable_effect = { PROVINCE = province:1633 }
	#	visiting_poi_variable_effect = { PROVINCE = province:1634 }
	#	visiting_poi_variable_effect = { PROVINCE = province:1648 }
	#	visiting_poi_variable_effect = { PROVINCE = province:1646 }
	#	visiting_poi_variable_effect = { PROVINCE = province:1643 }
	#}
	#else_if = { # Hadrian's Wall
	#	limit = {
	#		OR = {
	#			scope:province = province:8780
	#			scope:province = province:1635
	#			scope:province = province:1611
	#			scope:province = province:1609
	#		}
	#	}
	#	visiting_poi_variable_effect = { PROVINCE = province:8780 }
	#	visiting_poi_variable_effect = { PROVINCE = province:1635 }
	#	visiting_poi_variable_effect = { PROVINCE = province:1611 }
	#	visiting_poi_variable_effect = { PROVINCE = province:1609 }
	#}
	#else_if = { # Danevirke
	#	limit = {
	#		OR = {
	#			scope:province = province:62
	#			scope:province = province:84
	#		}
	#	}
	#	visiting_poi_variable_effect = { PROVINCE = province:62 }
	#	visiting_poi_variable_effect = { PROVINCE = province:84 }
	#}
	#else_if = { # Great Wall of Gorgan
	#	limit = {
	#		OR = {
	#			scope:province = province:4031
	#			scope:province = province:4030
	#		}
	#	}
	#	visiting_poi_variable_effect = { PROVINCE = province:4031 }
	#	visiting_poi_variable_effect = { PROVINCE = province:4030 }
	#}
	#EK DISABLED END
	visiting_poi_variable_effect = { PROVINCE = scope:province }
}

visiting_poi_variable_effect = {
	add_to_variable_list = {
		name = visited_poi
		target = $PROVINCE$
	}
}

visiting_monument_exploration_effect = {
	#EK DISABLED: Disabling all the vanilla buildings. Any multi-province special buildings should be added here.
	#if = { # Offa's Dyke
	#	limit = {
	#		OR = {
	#			scope:province = province:1632
	#			scope:province = province:1633
	#			scope:province = province:1634
	#			scope:province = province:1648
	#			scope:province = province:1646
	#			scope:province = province:1643
	#		}
	#	}
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:1632 }
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:1633 }
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:1634 }
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:1648 }
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:1646 }
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:1643 }
	#}
	#else_if = { # Hadrian's Wall
	#	limit = {
	#		OR = {
	#			scope:province = province:8780
	#			scope:province = province:1635
	#			scope:province = province:1611
	#			scope:province = province:1609
	#		}
	#	}
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:8780 }
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:1635 }
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:1611 }
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:1609 }
	#}
	#else_if = { # Danevirke
	#	limit = {
	#		OR = {
	#			scope:province = province:62
	#			scope:province = province:84
	#		}
	#	}
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:62 }
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:84 }
	#}
	#else_if = { # Great Wall of Gorgan
	#	limit = {
	#		OR = {
	#			scope:province = province:4031
	#			scope:province = province:4030
	#		}
	#	}
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:4031 }
	#	visiting_monument_exploration_variable_effect = { PROVINCE = province:4030 }
	#}
	#EK DISABLED END
	visiting_monument_exploration_variable_effect = { PROVINCE = scope:province }
}

visiting_monument_exploration_variable_effect = {
	add_to_variable_list = {
		name = visited_monument_exploration
		target = $PROVINCE$
	}
}

wanderer_lifestyle_destination_effect = {
	root = {
		if = {
			limit = {
				OR = { 
					has_focus = wanderer_destination_focus
					has_perk = finally_there_perk 
				}
			}
			add_prestige = wanderer_destination_prestige_value_with_effects
		}
		finally_there_stress_loss_effect = yes
	}
}

point_of_interest_prestige_effect = {
	root = {
		add_prestige = point_of_interest_prestige_value
		finally_there_stress_loss_effect = yes
	}
}

finally_there_stress_loss_effect = {
	root = {
		if = {
			limit = {
				has_perk = finally_there_perk 
			}
			if = {
				limit = {
					has_perk = been_there_done_that_perk
				}
				stress_impact = { base = -7 }
			}
			else = { stress_impact = { base = -5 } }
		}
	}
}

local_arbitration_effect = {
	root = {
		send_interface_message = {
			type = msg_county_corruption_good_increase_control
			title = local_arbitration_key
			left_icon = current_location.county
			right_icon = root

			prev = {
				remove_county_modifier = $COUNTY_MODIFIER$
			}
		}
	}
}

local_arbitration_positive_effect = {
	root = {
		send_interface_message = {
			type = event_generic_good
			title = local_arbitration_key
			left_icon = root.location.county
			right_icon = root

			prev = {
				add_county_modifier = {
					modifier = $COUNTY_MODIFIER$
					years = 10
				}
			}
		}
	}
	hidden_effect = {
		if = {
			limit = {
				NOT = { root.location.county.holder = root }
			}
			root.location.county.holder = {
				send_interface_message = {
					type = event_generic_good
					title = local_arbitration_key
					left_icon = root.location.county
					right_icon = root

					show_as_tooltip = {
						prev = {
							add_county_modifier = {
								modifier = $COUNTY_MODIFIER$
								years = 10
							}
						}	
					}
				}
			}
		}
	}
}

voyager_souvenirs_aplenty_effect = {
	if = {
		limit = {
			has_perk = souvenirs_aplenty_perk
			NOT = { location.barony ?= root.capital_barony }
			location.county.development_level > root.capital_county.development_level
		}
		if = {
			limit = {
				has_variable = souvenirs_aplenty_var
			}
			change_variable = {
				name = souvenirs_aplenty_var
				add = {
					add = voyager_souvenirs_aplenty_script_value
					max = voyager_souvenirs_aplenty_max_value
				}
			}
		}
		else = {
			set_variable = {
				name = souvenirs_aplenty_var
				value = voyager_souvenirs_aplenty_script_value
			}
		}
	}
}

voyager_souvenirs_aplenty_completion_effect = {
	if = {
		limit = {
			has_perk = souvenirs_aplenty_perk
			has_variable = souvenirs_aplenty_var
		}
		send_interface_toast = {
			type = event_generic_good
			title = souvenirs_aplenty_perk_title_message
			
			root.capital_county = {
				change_development_progress_with_overflow = root.var:souvenirs_aplenty_var
			}
		}
		remove_variable = souvenirs_aplenty_var
	}
}

voyager_gracious_host_impeccable_guest_effect = {
	if = {
		limit = {
			has_perk = gracious_host_impeccable_guest_perk
			exists = root.location.barony.holder
			NOT = { this = root.location.barony.holder }
			root.location.barony.holder.capital_barony = root.location.barony
		}
		root.location.barony.holder = {
			add_opinion = {
				modifier = impeccable_guest_opinion
				opinion = 10
				target = root
			}
		}
	}
	if = {
		limit = {
			exists = root.location.barony.holder
			NOT = { this = root.location.barony.holder }
			root.location.barony.holder = {
				has_perk = gracious_host_impeccable_guest_perk
			}
		}
		add_opinion = {
			modifier = gracious_host_opinion
			opinion = 10
			target = root.location.barony.holder
		}
	}
}

wayfarer_storyteller_fame_effect = {
	if = {
		limit = {
			has_perk = roaming_perk
		}
		save_scope_value_as = {
			name = fame_value
			value = $VALUE$
		}
		custom_tooltip = {
			text = roaming_fame_reward_tt
			add_prestige_experience = $VALUE$
		}
	}
}

wayfarer_the_real_threat_effect = {
	ordered_councillor = {
		limit = {
			wayfarer_the_real_threat_trigger = yes
		}
		order_by = wayfarer_the_real_threat_value
		position = $NUMBER$
		save_scope_as = threat_$NUMBER$
	}
}

wayfarer_the_home_away_from_home_modifier_effect = {
	if = {
		limit = {
			has_character_modifier = the_home_away_from_home_modifier
		}
		remove_character_modifier = the_home_away_from_home_modifier
	}
}

destination_remove_excursion_modifier_effect = {
	if = {
		limit = {
			has_character_modifier = destination_excursion_safety_modifier
		}
		remove_character_modifier = destination_excursion_safety_modifier
	}
	else_if = {
		limit = {
			has_character_modifier = destination_excursion_speed_modifier
		}
		remove_character_modifier = destination_excursion_speed_modifier
	}
}

surveyor_perk_mustering_effect = {
	if = {
		limit = {
			government_has_flag = government_is_settled
			has_perk = mustering_the_troops_perk
			location = {
				exists = barony
				barony.holder = root 
				has_stationed_regiment = yes
			}
		}
		location = {
			switch = {
				trigger = has_stationed_regiment_of_base_type
				skirmishers = {
					add_province_modifier = {
						modifier = mustered_skirmishers
						years = 15
					}
				}
				archers = {
					add_province_modifier = {
						modifier = mustered_archers
						years = 15
					}
				}
				light_cavalry = {
					add_province_modifier = {
						modifier = mustered_light_cavalry
						years = 15
					}
				}
				pikemen = {
					add_province_modifier = {
						modifier = mustered_pikemen
						years = 15
					}
				}
				heavy_infantry = {
					add_province_modifier = {
						modifier = mustered_heavy_infantry
						years = 15
					}
				}
				siege_weapon = {
					add_province_modifier = {
						modifier = mustered_siege_weapon
						years = 15
					}
				}
				heavy_cavalry = {
					add_province_modifier = {
						modifier = mustered_heavy_cavalry
						years = 15
					}
				}
				elephant_cavalry = {
					add_province_modifier = {
						modifier = mustered_elephant_cavalry
						years = 15
					}
				}
				camel_cavalry = {
					add_province_modifier = {
						modifier = mustered_camel_cavalry
						years = 15
					}
				}
				archer_cavalry = {
					add_province_modifier = {
						modifier = mustered_archer_cavalry
						years = 15
					}
				}
				#EK TODO: Province modifiers for mages and spellblades?
			}
		}
	}
}

charting_the_realm_perk_effect = {
	if = {
		limit = {
			has_perk = realm_charts_perk
			OR = {
				NOT = { has_variable_list = mapmaking_location_list }
				NOT = {
					is_target_in_variable_list = {
						name = mapmaking_location_list
						target = location
	 				}
				}
			}
			exists = location.county
			location = { has_holding = yes }
			OR = { #We save domain provinces, top lieges capital or direct vassals capitals at count tier or over - always by link comparisons
				AND = {
					location.county.holder = root
					NOT = { location.county = location.county.holder.capital_county }
				}
				AND = {
					is_independent_ruler = no
					location.county.holder != root
					root.top_liege = location.county.holder.top_liege
					location = location.county.holder.top_liege.capital_province
				}
				AND = {
					location.county.holder != root
					location.county.holder.liege = root
					location = location.county.holder.capital_province
				}
			}
		}
		add_to_variable_list = {
			name = mapmaking_location_list
			target = location
		}
	}
}


surveyor_tutor_child_effect = {
	if = {
		limit = {
			location = {
				exists = barony
				barony.holder = root
			}
			current_travel_plan = {
				has_travel_option = tutor_child_option
			}
			player_heir ?= {
				NOT = {
					is_target_in_variable_list = {
						name = visited_domain_to_learn
						target = location
					}
				}
				OR = {
					NOT = { has_variable_list = visited_domain_to_learn }
					variable_list_size = {
						name = visited_domain_to_learn
						value < 8
					}
				}
			}
		}
		player_heir ?= {
			if = {
				limit = {
					age < 15
				}
				add_to_variable_list = {
					name = visited_domain_to_learn
					target = location
				}
				random_list = {
					15 = {
						add_character_modifier = {
							modifier = domain_tutoring_martial
						}
					}
					5 = { #Smaller chance of double boost, done as 2 boosts to maintain the right count for the maximum boost attainable
						add_character_modifier = {
							modifier = domain_tutoring_martial
						}
						add_character_modifier = {
							modifier = domain_tutoring_martial
						}
					}
					15 = {
						add_character_modifier = {
							modifier = domain_tutoring_diplomacy
						}
					}
					5 = { #Smaller chance of double boost, done as 2 boosts to maintain the right count for the maximum boost attainable
						add_character_modifier = {
							modifier = domain_tutoring_diplomacy
						}
						add_character_modifier = {
							modifier = domain_tutoring_diplomacy
						}
					}
					15 = {
						add_character_modifier = {
							modifier = domain_tutoring_intrigue
						}
					}
					5 = { #Smaller chance of double boost, done as 2 boosts to maintain the right count for the maximum boost attainable
						add_character_modifier = {
							modifier = domain_tutoring_intrigue
						}
						add_character_modifier = {
							modifier = domain_tutoring_intrigue
						}
					}
					15 = {
						add_character_modifier = {
							modifier = domain_tutoring_stewardship
						}
					}
					5 = { #Smaller chance of double boost, done as 2 boosts to maintain the right count for the maximum boost attainable
						add_character_modifier = {
							modifier = domain_tutoring_stewardship
						}
						add_character_modifier = {
							modifier = domain_tutoring_stewardship
						}
					}
					15 = {
						add_character_modifier = {
							modifier = domain_tutoring_learning
						}
					}
					5 = { #Smaller chance of double boost, done as 2 boosts to maintain the right count for the maximum boost attainable
						add_character_modifier = {
							modifier = domain_tutoring_learning
						}
						add_character_modifier = {
							modifier = domain_tutoring_learning
						}
					}
				}
			}
		}
	}
}

surveyor_no_stone_unturned_perk_effect = {
	if = {
		limit = {
			OR = {
				AND = {
					has_perk = no_stone_unturned_perk
					government_has_flag = government_is_settled
				}
				AND = {
					has_perk = know_your_land_know_your_people_perk
					government_has_flag = government_is_nomadic
				}
			}
			this = scope:host
			exists = location.county
			location.county.holder = root
		}
		if = {
			limit = {
				location.county = {
					NOR = {
						has_county_modifier = no_stone_unturned_perk_modifier
						has_county_modifier = no_stone_unturned_boosted_perk_modifier
					}
				}
			}
			if = {
				limit = {
					has_perk = personal_touch_perk #Increased effect
				}
				send_interface_toast = {
					type = event_generic_good
					title = no_stone_unturned_perk_modifier
					
					location.county = {
						add_county_modifier = {
							modifier = no_stone_unturned_boosted_perk_modifier
							years = 10
						}
						if = {
							limit = {
								scope:host = { government_has_flag = government_is_nomadic }
							}
							change_county_fertility = 15
						}
						else = {
							change_development_progress_with_overflow = 75
						}
					}
				}
			}
			else = { #Standard Effect
				send_interface_toast = {
					type = event_generic_good
					title = no_stone_unturned_perk_modifier
					
					location.county = {
						add_county_modifier = {
							modifier = no_stone_unturned_perk_modifier
							years = 10
						}
						if = {
							limit = {
								scope:host = { government_has_flag = government_is_nomadic }
							}
							change_county_fertility = 10
						}
						else = {
							change_development_progress_with_overflow = 50
						}
					}
				}
			}
		}
		else = {
			location.county = { save_scope_as = perk_county }
			send_interface_toast = {
				type = event_generic_good
				title = no_stone_unturned_perk_cooldown_title_message
				custom_description_no_bullet = {
					text = 	no_stone_unturned_perk_cooldown_message
				}
			}
		}
	}
}

local_adjudicate_effect = {
	if = {
		limit = {
			has_county_corruption_trigger = yes
		}
		switch = {
			trigger = has_county_modifier
			county_corruption_inefficient_tax_collection_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_inefficient_tax_collection_modifier } }
			county_corruption_deserting_levies_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_deserting_levies_modifier } }
			county_corruption_smuggling_ring_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_smuggling_ring_modifier } }
			county_corruption_bandits_rampant_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_bandits_rampant_modifier } }
			county_corruption_inefficient_census_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_inefficient_census_modifier } }
			county_corruption_lack_of_sheriffs_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_lack_of_sheriffs_modifier } }
			county_corruption_lack_of_courts_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_lack_of_courts_modifier } }
			county_corruption_thieves_guild_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_thieves_guild_modifier } }
			county_corruption_unsafe_highways_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_unsafe_highways_modifier } }
			county_corruption_uncooperative_guilds_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_uncooperative_guilds_modifier } }
			county_corruption_lackluster_administration_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_lackluster_administration_modifier } }
			county_corruption_roaming_bandits_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_roaming_bandits_modifier } }
			county_corruption_wild_beast_attacks_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_wild_beast_attacks_modifier } }
			county_corruption_upset_shepherds_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_upset_shepherds_modifier } }
			county_corruption_rogue_warriors_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_rogue_warriors_modifier } }
			county_corruption_unruly_nomads_modifier = { local_arbitration_effect = { COUNTY_MODIFIER = county_corruption_unruly_nomads_modifier } }
		}
	}
	else = {
		random_list = {
			1 = {
				local_arbitration_positive_effect = { COUNTY_MODIFIER = local_arbitration_modifier_1 }
			}
			1 = {
				local_arbitration_positive_effect = { COUNTY_MODIFIER = local_arbitration_modifier_2 }	
			}
			1 = {
				local_arbitration_positive_effect = { COUNTY_MODIFIER = local_arbitration_modifier_3 }
			}
		}
	}
}

battle_poi_trait_effect = {
	root = {
		if = {
			limit = {
				NOT = { has_trait = $TRAIT$ }
			}
			send_interface_toast = {
				title = poi_battles.learn
				left_icon = root

				add_trait = $TRAIT$
			}
		}
	}
}

battle_poi_maa_regiment_effect = {
	scope:combat_location = {
		set_variable = {
			name = battle_poi_$NAME$
		}
	}
}

battle_poi_randomizer_effect = {
	set_variable = {
		name = battle_poi_randomizer_$NAME$
	}
}

battle_poi_region_cooldown_effect = {
	set_global_variable = {
		name = battle_poi_$REGION$_cooldown
		years = 25
	}
}

mapmaking_mythical_lie_effect = {
	random_list = {
		#EK NOTE: Probably fine, they're real rather than a myth but functionally mythical.
		1 = {
			save_scope_value_as = {
				name = mythical_lie
				value = flag:dragon
			}
		}
		#EK NOTE: Probably fine, they're real rather than a myth but functionally mythical.
		1 = {
			save_scope_value_as = {
				name = mythical_lie
				value = flag:unicorn
			}
		}
		1 = {
			save_scope_value_as = {
				name = mythical_lie
				value = flag:dog_people
			}
		}
		#EK NOTE: Real but extinct. Seems fine for this, kinda like people claiming they saw a plesiosaurus or something.
		1 = {
			save_scope_value_as = {
				name = mythical_lie
				value = flag:basilisk
			}
		}
		1 = {
			save_scope_value_as = {
				name = mythical_lie
				value = flag:giant_serpent
			}
		}
		1 = {
			save_scope_value_as = {
				name = mythical_lie
				value = flag:horned_men
			}
		}
		1 = {
			save_scope_value_as = {
				name = mythical_lie
				value = flag:amazons
			}
		}
		1 = {
			save_scope_value_as = {
				name = mythical_lie
				value = flag:headless_men
			}
		}
		#EK EDIT: Probably mundane enough to take out.
		#1 = {
		#	save_scope_value_as = {
		#		name = mythical_lie
		#		value = flag:giants
		#	}
		#}
		1 = {
			save_scope_value_as = {
				name = mythical_lie
				value = flag:hoved_feeted_men
			}
		}
		#EK EDIT: I saw a mudcrab the other day. Horrible creatures.
		#1 = {
		#	save_scope_value_as = {
		#		name = mythical_lie
		#		value = flag:giant_crabs
		#	}
		#}
		#EK NOTE: Probably fine? They don't seem to exist in the setting except as cut content from ESO.
		1 = {
			save_scope_value_as = {
				name = mythical_lie
				value = flag:cyclops
			}
		}
	}
}

reminiscing_event_effect = {
	if = {
		limit = {
			reminiscing_event_trigger = yes
		}
		trigger_event = wanderer_lifestyle_events.25
	}
}

local_guild_effect = {
	random_list = {
		10 = { # Millers Guild (Watermills)
			trigger = {
				has_building_or_higher =  watermills_01
			}
			save_scope_value_as = {
				name = local_guild_scope
				value = 1
			}
		}
		10 = { # Bakers Guild (Windmills)
			trigger = {
				has_building_or_higher =  windmills_01
			}
			save_scope_value_as = {
				name = local_guild_scope
				value = 2
			}
		}
		10 = { # Fishmongers Guild (Port)
			trigger = {
				has_building_or_higher = common_tradeport_01
			}
			save_scope_value_as = {
				name = local_guild_scope
				value = 3
			}
		}
		10 = { # Shoemakers/Tanners/Tailors/Weavers Guild (Cattle Pastures)
			trigger = {
				has_building_or_higher = pastures_01
			}
			random_list = {
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 4
					}
				}
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 5
					}
				}
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 6
					}
				}
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 7
					}
				}
			}
		}
		10 = { # Butchers/Furriers/Skinners Guild (Hunting Grounds)
			trigger = {
				has_building_or_higher = hunting_grounds_01
			}
			random_list = {
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 8
					}
				}
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 9
					}
				}
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 10
					}
				}
			}
		}
		10 = { # Vintners Guild (Orchards)
			trigger = {
				has_building_or_higher = orchards_01
			}
			save_scope_value_as = {
				name = local_guild_scope
				value = 11
			}
		}
		10 = { # Carpenters Guild (Logging Camps)
			trigger = {
				has_building_or_higher = logging_camps_01
			}
			save_scope_value_as = {
				name = local_guild_scope
				value = 12
			}
		}
		10 = { # Masons/Miners Guild (Quarries)
			trigger = {
				has_building_or_higher = quarries_01
			}
			random_list = {
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 13
					}
				}
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 14
					}
				}
			}
		}
		10 = { # Blacksmiths Guild (Blacksmith)
			trigger = {
				has_building_or_higher = smiths_01
			}
			save_scope_value_as = {
				name = local_guild_scope
				value = 15
			}
		}
		10 = { # Saddlers Guild (Stables)
			trigger = {
				has_building_or_higher = stables_01
			}
			save_scope_value_as = {
				name = local_guild_scope
				value = 16
			}
		}
		10 = { # Merchants Guild (Guild Halls)
			trigger = {
				has_building_or_higher = guild_halls_01
			}
			save_scope_value_as = {
				name = local_guild_scope
				value = 17
			}
		}
		10 = { # Physicians/Pharmacists Guild (Hospices)
			trigger = {
				has_building_or_higher = hospices_01
			}
			random_list = {
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 18
					}
				}
				10 = {
					save_scope_value_as = {
						name = local_guild_scope
						value = 19
					}
				}
			}
		}
		10 = { # Toolmakers Guild (Workshops)
			trigger = {
				has_building_or_higher = workshops_01
			}
			save_scope_value_as = {
				name = local_guild_scope
				value = 20
			}
		}
	}
}

local_guild_reward_effect = {
	switch = {
		trigger = scope:local_guild_scope
		1 = { add_building = watermills_01 }
		2 = { add_building = windmills_01 }
		3 = { add_building = common_tradeport_01 }
		4 = { add_building = pastures_01 }
		5 = { add_building = pastures_01 }
		6 = { add_building = pastures_01 }
		7 = { add_building = pastures_01 }
		8 = { add_building = hunting_grounds_01 }
		9 = { add_building = hunting_grounds_01 }
		10 = { add_building = hunting_grounds_01 }
		11 = { add_building = orchards_01 }
		12 = { add_building = logging_camps_01 }
		13 = { add_building = quarries_01 }
		14 = { add_building = quarries_01 }
		15 = { add_building = smiths_01 }
		16 = { add_building = stables_01 }
		17 = { add_building = guild_halls_01 }
		18 = { add_building = hospices_01 }
		19 = { add_building = hospices_01 }
		20 = { add_building = workshops_01 }
	}
}
