﻿# Scripted Effects for BP2

# Scripted effect to generate a list of relevant characters that might interact with a child
generate_characters_relevant_to_child_list = {
	# Grab any family that's around
	$CHILD$ = {
		every_close_or_extended_family_member = {
			limit = { is_relevant_to_child = yes }
			add_to_list = relevant_characters_to_child_list
		}
	}
	# Grab relevant court folks
	$CHILD$.liege_or_court_owner = {
		every_courtier_or_guest = {
			limit = {
				is_relevant_to_child = yes
			}
			add_to_list = relevant_characters_to_child_list
		}
		every_knight = {
			if = {
				limit = {
					is_relevant_to_child = yes
				}
				add_to_list = relevant_characters_to_child_list
			}
		}
		cp:councillor_court_chaplain ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		cp:councillor_marshal ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		cp:councillor_chancellor ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		cp:councillor_steward ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_tutor_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_physician_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:travel_leader_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:master_of_hunt_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:bodyguard_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_jester_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_musician_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_poet_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
	}
	$CHILD$ = {
		every_courtier_or_guest = {
			limit = {
				is_relevant_to_child = yes
			}
			add_to_list = relevant_characters_to_child_list
		}
		every_knight = {
			if = {
				limit = {
					is_relevant_to_child = yes
				}
				add_to_list = relevant_characters_to_child_list
			}
		}
		cp:councillor_court_chaplain ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		cp:councillor_marshal ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		cp:councillor_chancellor ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		cp:councillor_steward ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_tutor_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_physician_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:travel_leader_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:master_of_hunt_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:bodyguard_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_jester_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_musician_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_poet_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:akolouthos_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
		court_position:court_astrologer_court_position ?= { 
			if = {
				limit = { is_relevant_to_child = yes }
				add_to_list = relevant_characters_to_child_list
			}
		}
	}
}

# Grab random char relevant to a given child 
grab_char_relevant_to_child = {
	generate_characters_relevant_to_child_list = { CHILD = $CHILD$ }
	random_in_list = {
		list = relevant_characters_to_child_list
		save_scope_as = $SCOPE_OUTPUT$
	}
}

# Grab martial character relevant to a given child
grab_martial_char_relevant_to_child = {
	generate_characters_relevant_to_child_list = { CHILD = $CHILD$ }
	ordered_in_list = {
		list = relevant_characters_to_child_list
		order_by = {
			value = 0
			add = martial
			if = {
				limit = { is_knight = yes }
				add = 25
			}
			if = {
				limit = { has_court_position = bodyguard_court_position }
				add = 20
			}
			if = {
				limit = { has_court_position = akolouthos_court_position }
				add = 20
			}
			if = {
				limit = { has_court_position = master_of_hunt_court_position }
				add = 10
			}
			if = {
				limit = { this = $CHILD$.liege_or_court_owner.cp:councillor_marshal }
				add = 30
			}
			if = {
				limit = { is_close_or_extended_family_of = $CHILD$ }
				add = 10
			}
		}
		save_scope_as = $SCOPE_OUTPUT$
	}
}

# Grab learning character relevant to a given child
grab_learning_char_relevant_to_child = {
	generate_characters_relevant_to_child_list = { CHILD = $CHILD$ }
	ordered_in_list = {
		list = relevant_characters_to_child_list
		order_by = {
			value = 0
			add = learning
			if = {
				limit = { has_court_position = court_physician_court_position }
				add = 20
			}
			if = {
				limit = { has_court_position = court_tutor_court_position }
				add = 20
			}
			if = {
				limit = {
					exists = $CHILD$.liege_or_court_owner.cp:councillor_court_chaplain
					this = $CHILD$.liege_or_court_owner.cp:councillor_court_chaplain
				}
				add = 30
			}
			if = {
				limit = {
					$CHILD$ = { is_ruler = yes }
					exists = $CHILD$.cp:councillor_court_chaplain
					this = $CHILD$.cp:councillor_court_chaplain
				}
				add = 50
			}
			if = {
				limit = { is_close_or_extended_family_of = $CHILD$ }
				add = 15
			}
		}
		save_scope_as = $SCOPE_OUTPUT$
	}
}
#EK DISABLED
#TL;DR: This is a very cool effect of a very cool event, but it's essentially unmaintainable.
#If you do wish to maintain accounting for 40 different _clothing_gfx over vanillas 16. All why making sure those 40 'styles' are setup in all the areas they need to be in over a dozen files, then go ahead and re-enable this option. - Theyn
#adopt_cultural_fashion_effect = {
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = byzantine_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = byzantine_clothing_gfx
#			}
#		}
#		add_character_flag = byzantine_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = byzantine_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = indian_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = indian_clothing_gfx
#			}
#		}
#		add_character_flag = indian_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = indian_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = mena_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = mena_clothing_gfx
#			}
#		}
#		add_character_flag = mena_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = mena_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = african_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = african_clothing_gfx
#			}
#		}
#		add_character_flag = african_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = african_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = northern_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = northern_clothing_gfx
#			}
#		}
#		add_character_flag = northern_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = northern_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = iberian_muslim_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = iberian_muslim_clothing_gfx
#			}
#		}
#		add_character_flag = iberian_muslim_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = iberian_muslim_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = iberian_christian_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = iberian_christian_clothing_gfx
#			}
#		}
#		add_character_flag = iberian_christian_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = iberian_christian_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = fp1_norse_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = fp1_norse_clothing_gfx
#			}
#		}
#		add_character_flag = fp1_norse_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = fp1_norse_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = mongol_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = mongol_clothing_gfx
#			}
#		}
#		add_character_flag = mongol_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = mongol_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = western_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = western_clothing_gfx
#			}
#		}
#		add_character_flag = western_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = western_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = dde_hre_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = dde_hre_clothing_gfx
#			}
#		}
#		add_character_flag = dde_hre_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = dde_hre_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = dde_abbasid_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = dde_abbasid_clothing_gfx
#			}
#		}
#		add_character_flag = dde_abbasid_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = dde_abbasid_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = iranian_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = iranian_clothing_gfx
#			}
#		}
#		add_character_flag = iranian_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = iranian_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#	if = {
#		limit = {
#			root.culture = {
#				NOT = { has_clothing_gfx = turkic_clothing_gfx }
#			}
#			scope:advanced_culture = {
#				has_clothing_gfx = turkic_clothing_gfx
#			}
#		}
#		add_character_flag = turkic_style
#		if = {
#			limit = {
#				root.primary_heir ?= {
#					opinion = {
#						target = root
#						value >= 50
#					}
#				}
#			}
#			root.primary_heir = {
#				add_character_flag = turkic_style
#			}
#			custom_tooltip = bp2_yearly.6070.change_clothes_heir
#		}
#		else = {
#			custom_tooltip = bp2_yearly.6070.change_clothes
#		}
#	}
#}

#EK DISABLED
#remove_cultural_fashion_effect = {
	#remove_character_flag ?= byzantine_style
	#remove_character_flag ?= indian_style
	#remove_character_flag ?= mena_style
	#remove_character_flag ?= african_style
	#remove_character_flag ?= northern_style
	#remove_character_flag ?= iberian_muslim_style
	#remove_character_flag ?= iberian_christian_style
	#remove_character_flag ?= fp1_norse_style
	#remove_character_flag ?= mongol_style
	#remove_character_flag ?= western_style
	#remove_character_flag ?= dde_hre_style
	#remove_character_flag ?= dde_abbasid_style
	#remove_character_flag ?= turkic_style
	#remove_character_flag ?= iranian_style
#}

bp2_save_traditions_to_consider_effect = {
 	#Choose a category of tradition root is ready to reform and save a valid tradition from that category
    random_list = {
        10 = {
            trigger = {
            	AND = {
    				has_character_flag = foreign_realm_reforms
    				scope:advanced_culture = {
    					any_tradition = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = realm
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    						}
    					}
    				}
    			}
    		}
            scope:advanced_culture = {
    			random_tradition = {
    				limit = {
    					root = {
	    		 			can_embrace_tradition = {
	    		 				tradition = prev
	    		 			}
	    		 		}
    					has_tradition_category = realm
    					NOR = {
    						root = {
    							is_target_in_variable_list = {
    								name = rejected_traditions
    								target = prev
    							}
    						}
    		 				root.culture = {
    		 					has_cultural_tradition = prev
    		 				}
    					}
    				}
    				save_scope_as = considered_tradition_1
    			}
    		}
    		add_character_flag = considering_reform_realm
    	}
    	10 = {
            trigger = {
            	AND = {
    				has_character_flag = foreign_maa_reforms
    				scope:advanced_culture = {
    					any_tradition = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = combat
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    						}
    					}
    				}
    			}
    		}
            scope:advanced_culture = {
    			random_tradition = {
    				limit = {
    					root = {
	    		 			can_embrace_tradition = {
	    		 				tradition = prev
	    		 			}
	    		 		}
    					has_tradition_category = combat
    					NOR = {
    						root = {
    							is_target_in_variable_list = {
    								name = rejected_traditions
    								target = prev
    							}
    						}
    		 				root.culture = {
    		 					has_cultural_tradition = prev
    		 				}
    					}
    				}
    				save_scope_as = considered_tradition_1
    			}
    		}
    		add_character_flag = considering_reform_maa
    	}
    	10 = {
            trigger = {
            	AND = {
    				has_character_flag = foreign_social_reforms
    				scope:advanced_culture = {
    					any_tradition = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = societal
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    						}
    					}
    				}
    			}
    		}
            scope:advanced_culture = {
    			random_tradition = {
    				limit = {
    					root = {
	    		 			can_embrace_tradition = {
	    		 				tradition = prev
	    		 			}
	    		 		}
    					has_tradition_category = societal
    					NOR = {
    						root = {
    							is_target_in_variable_list = {
    								name = rejected_traditions
    								target = prev
    							}
    						}
    		 				root.culture = {
    		 					has_cultural_tradition = prev
    		 				}
    					}
    				}
    				save_scope_as = considered_tradition_1
    			}
    		}
    		add_character_flag = considering_reform_social
    	}
    	10 = {
            trigger = {
            	AND = {
    				has_character_flag = foreign_ritual_reforms
    				scope:advanced_culture = {
    					any_tradition = {
	    		 			root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = ritual
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    						}
    					}
    				}
    			}
    		}
            scope:advanced_culture = {
    			random_tradition = {
    				limit = {
    					root = {
	    		 			can_embrace_tradition = {
	    		 				tradition = prev
	    		 			}
	    		 		}
    					has_tradition_category = ritual
    					NOR = {
    						root = {
    							is_target_in_variable_list = {
    								name = rejected_traditions
    								target = prev
    							}
    						}
    		 				root.culture = {
    		 					has_cultural_tradition = prev
    		 				}
    					}
    				}
    				save_scope_as = considered_tradition_1
    			}
    		}
    		add_character_flag = considering_reform_ritual
    	}
    	10 = {
            trigger = {
            	AND = {
    				scope:advanced_culture = {
    					any_tradition = {
	    		 			root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = regional
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    						}
    					}
    				}
    			}
    		}
            scope:advanced_culture = {
    			random_tradition = {
    				limit = {
    					root = {
	    		 			can_embrace_tradition = {
	    		 				tradition = prev
	    		 			}
	    		 		}
    					has_tradition_category = regional
    					NOR = {
    						root = {
    							is_target_in_variable_list = {
    								name = rejected_traditions
    								target = prev
    							}
    						}
    		 				root.culture = {
    		 					has_cultural_tradition = prev
    		 				}
    					}
    				}
    				save_scope_as = considered_tradition_1
    			}
    		}
    		add_character_flag = considering_reform_regional
    	}
    }
    #PICK A SECOND
    if = {
    	limit = {
    		scope:advanced_culture = {
    			any_tradition = {
	    		 	root = {
	    		 		can_embrace_tradition = {
	    		 			tradition = prev
	    		 		}
	    		 	}
    				NOR = {
    					root = {
    						is_target_in_variable_list = {
    							name = rejected_traditions
    							target = prev
    						}
    					}
    		 			root.culture = {
    		 				has_cultural_tradition = prev
    		 			}
    				}
    				NOT = {
    					scope:considered_tradition_1 = this
    				}
    			}
    		}
    	}
    	random_list = {
        	10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_realm_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = realm
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = realm
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    						}
    					}
    					save_scope_as = considered_tradition_2
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_maa_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = combat
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = combat
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    						}
    					}
    					save_scope_as = considered_tradition_2
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_social_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = societal
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = societal
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    							root.culture = {
    		 							has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    						}
    					}
    					save_scope_as = considered_tradition_2
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_ritual_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = ritual
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = ritual
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    						}
    					}
    					save_scope_as = considered_tradition_2
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = regional
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = regional
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    						}
    					}
    					save_scope_as = considered_tradition_2
    					#this will be the overall flavor
    				}
    			}
    		}
    	}
    }
    # PICK A THIRD
    if = {
    	limit = {
    		scope:advanced_culture = {
    			any_tradition = {
	    		 	root = {
	    		 		can_embrace_tradition = {
	    		 			tradition = prev
	    		 		}
	    		 	}
    				NOR = {
    					root = {
    						is_target_in_variable_list = {
    							name = rejected_traditions
    							target = prev
    						}
    					}
    		 			root.culture = {
    		 				has_cultural_tradition = prev
    		 			}
    				}
    				NOT = {
    					scope:considered_tradition_1 = this
    					scope:considered_tradition_2 = this
    				}
    			}
    		}
    	}
    	random_list = {
        	10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_realm_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = realm
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    								scope:considered_tradition_2 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = realm
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    							scope:considered_tradition_2 = this
    						}
    					}
    					save_scope_as = considered_tradition_3
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_maa_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = combat
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    								scope:considered_tradition_2 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = combat
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    							scope:considered_tradition_2 = this
    						}
    					}
    					save_scope_as = considered_tradition_3
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_social_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = societal
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    								scope:considered_tradition_2 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = societal
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    							root.culture = {
    		 							has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    							scope:considered_tradition_2 = this
    						}
    					}
    					save_scope_as = considered_tradition_3
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_ritual_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = ritual
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    								scope:considered_tradition_2 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = ritual
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    							scope:considered_tradition_2 = this
    						}
    					}
    					save_scope_as = considered_tradition_3
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = regional
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    								scope:considered_tradition_2 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = regional
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    							scope:considered_tradition_2 = this
    						}
    					}
    					save_scope_as = considered_tradition_3
    					#this will be the overall flavor
    				}
    			}
    		}
    	}
    }
    #PICK FOURTH
    if = {
    	limit = {
    		scope:advanced_culture = {
    			any_tradition = {
	    		 	root = {
	    		 		can_embrace_tradition = {
	    		 			tradition = prev
	    		 		}
	    		 	}
    				NOR = {
    					root = {
    						is_target_in_variable_list = {
    							name = rejected_traditions
    							target = prev
    						}
    					}
    		 			root.culture = {
    		 				has_cultural_tradition = prev
    		 			}
    				}
    				NOT = {
    					scope:considered_tradition_1 = this
    					scope:considered_tradition_2 = this
    					scope:considered_tradition_3 = this
    				}
    			}
    		}
    	}
    	random_list = {
        	10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_realm_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = realm
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    								scope:considered_tradition_2 = this
    								scope:considered_tradition_3 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = realm
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    							scope:considered_tradition_2 = this
    							scope:considered_tradition_3 = this
    						}
    					}
    					save_scope_as = considered_tradition_4
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_maa_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = combat
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    								scope:considered_tradition_2 = this
    								scope:considered_tradition_3 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = combat
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    							scope:considered_tradition_2 = this
    							scope:considered_tradition_3 = this
    						}
    					}
    					save_scope_as = considered_tradition_4
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_social_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = societal
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    								scope:considered_tradition_2 = this
    								scope:considered_tradition_3 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = societal
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    							root.culture = {
    		 							has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    							scope:considered_tradition_2 = this
    							scope:considered_tradition_3 = this
    						}
    					}
    					save_scope_as = considered_tradition_4
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					has_character_flag = foreign_ritual_reforms
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = ritual
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    								scope:considered_tradition_2 = this
    								scope:considered_tradition_3 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = ritual
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    							scope:considered_tradition_2 = this
    							scope:considered_tradition_3 = this
    						}
    					}
    					save_scope_as = considered_tradition_4
    					#this will be the overall flavor
    				}
    			}
    		}
    		10 = {
    	        trigger = {
    	        	AND = {
    					scope:advanced_culture = {
    						any_tradition = {
	    		 				root = {
	    		 					can_embrace_tradition = {
	    		 						tradition = prev
	    		 					}
	    		 				}
    							has_tradition_category = regional
    							NOR = {
    								root = {
    									is_target_in_variable_list = {
    										name = rejected_traditions
    										target = prev
    									}
    								}
    		 						root.culture = {
    		 							has_cultural_tradition = prev
    		 						}
    		 						scope:considered_tradition_1 = this
    								scope:considered_tradition_2 = this
    								scope:considered_tradition_3 = this
    							}
    						}
    					}
    				}
    			}
    	        scope:advanced_culture = {
    				random_tradition = {
    					limit = {
    						root = {
	    		 				can_embrace_tradition = {
	    		 					tradition = prev
	    		 				}
	    		 			}
    						has_tradition_category = regional
    						NOR = {
    							root = {
    								is_target_in_variable_list = {
    									name = rejected_traditions
    									target = prev
    								}
    							}
    		 					root.culture = {
    		 						has_cultural_tradition = prev
    		 					}
    		 					scope:considered_tradition_1 = this
    							scope:considered_tradition_2 = this
    							scope:considered_tradition_3 = this
    						}
    					}
    					save_scope_as = considered_tradition_4
    					#this will be the overall flavor
    				}
    			}
    		}
    	}
    }
}


#Effect to start the story and show the right modifier
start_rock_story_cycle_effect = {
	show_as_tooltip = {
		add_character_modifier = {
			modifier = rock_story_modifier
		}
	}
	hidden_effect = {
		create_story = story_cycle_pet_rock
	}
}

#Pick out name options to show
assign_name_options_rock_story_cycle_effect = {
	random_list = {
		1 = {
			trigger = { NOT = { has_character_flag = name_cliff } }
			add_character_flag = name_cliff
		}
		1 = {
			trigger = {
				NOT = { has_character_flag = name_sandy }
				scope:story.var:rock_color = flag:sandy
			}
			add_character_flag = name_sandy
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_rocky } }
			add_character_flag = name_rocky
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_crag } }
			add_character_flag = name_crag
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_flint } }
			add_character_flag = name_flint
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_gritty } }
			add_character_flag = name_gritty
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_rubble } }
			add_character_flag = name_rubble
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_tuff } }
			add_character_flag = name_tuff
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_roxanne } }
			add_character_flag = name_roxanne
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_rosetta } }
			add_character_flag = name_rosetta
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_chip } }
			add_character_flag = name_chip
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_fluffy } }
			add_character_flag = name_fluffy
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_sten } }
			add_character_flag = name_sten
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_barney } }
			add_character_flag = name_barney
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_ariadne } }
			add_character_flag = name_ariadne
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_dwayne } }
			add_character_flag = name_dwayne
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_potapczyk } }
			add_character_flag = name_potapczyk
		}
		1 = {
			trigger = { NOT = { has_character_flag = name_gemma } }
			add_character_flag = name_gemma
		}
	}
}

#Assign the colour of your rock
assign_rock_color_effect = {
	save_temporary_scope_value_as = {
		name = rock_color
		value = flag:$COLOR$
	}
	if = {
		limit = { scope:rock_color = flag:random }
		hidden_effect = {
			random_list = {
				50 = {
					set_variable = {
						name = rock_color
						value = flag:brown
					}
				}
				50 = {
					set_variable = {
						name = rock_color
						value = flag:gray
					}
				}
				50 = {
					set_variable = {
						name = rock_color
						value = flag:black
					}
				}
				50 = {
					set_variable = {
						name = rock_color
						value = flag:white
					}
				}
				50 = {
					set_variable = {
						name = rock_color
						value = flag:sandy
					}
				}
			}
		}
	}
	else_if = {
		limit = {
			OR = {
				scope:rock_color = flag:brown
				scope:rock_color = flag:gray
				scope:rock_color = flag:black
				scope:rock_color = flag:white
				scope:rock_color = flag:sandy
			}
		}
		set_variable = {
			name = rock_color
			value = flag:$COLOR$
		}
	}
}

#Assign the gender of your rock
assign_rock_gender_effect = {
	save_temporary_scope_value_as = {
		name = gender
		value = flag:$GENDER$
	}
	if = {
		limit = { scope:gender = flag:random }
		hidden_effect = {
			random_list = {
				50 = {
					set_variable = {
						name = rock_gender
						value = flag:female
					}
				}
				50 = {
					set_variable = {
						name = rock_gender
						value = flag:male
					}
				}
			}
		}
	}
	else_if = {
		limit = {
			OR = {
				scope:gender = flag:male
				scope:gender = flag:female
			}
		}
		set_variable = {
			name = rock_gender
			value = flag:$GENDER$
		}
	}
}

#Remove everything related to the rock story
remove_rock_story_modifiers_effect = {
	if = {
		limit = {
			has_character_modifier = rock_story_modifier
		}
		remove_character_modifier = rock_story_modifier
	}
}

remove_rock_name_effect = {
	remove_variable = story_cycle_rock_name
	remove_localized_text = story_cycle_rock_name
}

