﻿namespace = pet_rock

###############################################
#     ROCK (0001-0999), by Nick Meredith      #
#                                   88        # 
#                                   88        # 
#                                   88        # 
# 8b,dPPYba,  ,adPPYba,   ,adPPYba, 88   ,d8  # 
# 88P'   "Y8 a8"     "8a a8"     "" 88 ,a8"   # 
# 88         8b       d8 8b         8888[     # 
# 88         "8a,   ,a8" "8a,   ,aa 88`"Yba,  #
# 88          `"YbbdP"'   `"Ybbd8"' 88   `Y8a #
###############################################

#You find a rock
#by Nick Meredith
pet_rock.0001 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0001.t
	desc = pet_rock.0001.desc
	theme = pet
	left_portrait = {
		character = root
		animation = ecstasy
	}
	override_background = { reference = bp2_courtyard }
	cooldown = { years = 10 }

	trigger = {
		has_trait = eccentric
		age > 12
		is_available = yes
	}

	option = {
		name = pet_rock.0001.a

		trigger = {
			has_trait = eccentric #To make it show up
		}

		custom_tooltip = pet_rock.0001.a.tt

		start_rock_story_cycle_effect = yes

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = pet_rock.0001.b

		flavor = pet_rock.0001.b.tt

		ai_chance = {
			base = 100
		}
	}
}

#Name your rock
#by Nick Meredith
pet_rock.0002 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0002.t
	desc = pet_rock.0002.desc
	theme = pet
	override_background = { reference = bp2_courtyard }
	left_portrait = {
		character = root
		animation = ecstasy
	}

	immediate = {
		#To give some options to show
		assign_name_options_rock_story_cycle_effect = yes
		assign_name_options_rock_story_cycle_effect = yes
		assign_name_options_rock_story_cycle_effect = yes
		play_music_cue = "mx_cue_low_key_positive"

		if = {
			limit = { is_ai = yes }
			random_list = {
				10 = {
					trigger = { has_character_flag = name_cliff }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_cliff
					}
				}
				10 = {
					trigger = { has_character_flag = name_sandy }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_sandy
					}
				}
				10 = {
					trigger = { has_character_flag = name_rocky }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_rocky
					}
				}
				10 = {
					trigger = { has_character_flag = name_crag }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_crag
					}
				}
				10 = {
					trigger = { has_character_flag = name_flint }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_flint
					}
				}
				10 = {
					trigger = { has_character_flag = name_gritty }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_gritty
					}
				}
				10 = {
					trigger = { has_character_flag = name_rubble }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_rubble
					}
				}
				10 = {
					trigger = { has_character_flag = name_tuff }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_tuff
					}
				}
				10 = {
					trigger = { has_character_flag = name_roxanne }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_roxanne
					}
				}
				10 = {
					trigger = { has_character_flag = name_rosetta }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_rosetta
					}
				}
				10 = {
					trigger = { has_character_flag = name_chip }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_chip
					}
				}
				10 = {
					trigger = { has_character_flag = name_fluffy }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_fluffy
					}
				}
				10 = {
					trigger = { has_character_flag = name_sten }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_sten
					}
				}
				10 = {
					trigger = { has_character_flag = name_barney }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_barney
					}
				}
				#Easter Eggs
				1 = { #The Grand Basilisk's wife, no less
					trigger = { has_character_flag = name_ariadne }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_ariadne
					}
				}
				1 = { #If you smelllll
					trigger = { has_character_flag = name_dwayne }
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_dwayne
					}
				}
				1 = { #Paying tribute to a real one
					trigger = { 
						has_character_flag = name_potapczyk
						has_culture = culture:polish
					}
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_potapczyk
					}
				}
				1 = { #Paying tribute to another real one
					trigger = { 
						has_character_flag = name_gemma
						has_culture = culture:english
					}
					set_variable = {
						name = story_cycle_rock_name
						value = flag:rock_name_gemma
					}
				}
			}
		}
	}

	widget = {
		gui = "event_window_widget_enter_text"
		container = "dynamic_birth_name"
		controller = {
			type = text
			data = {
				key = story_cycle_rock_name
				default = {
					localization_key = rock_name_cliff
					trigger = {
						has_character_flag = name_cliff
					}
				}
				default = {
					localization_key = rock_name_sandy
					trigger = {
						has_character_flag = name_sandy
					}
				}
				default = {
					localization_key = rock_name_rocky
					trigger = {
						has_character_flag = name_rocky
					}
				}
				default = {
					localization_key = rock_name_crag
					trigger = {
						has_character_flag = name_crag
					}
				}
				default = {
					localization_key = rock_name_flint
					trigger = {
						has_character_flag = name_flint
					}
				}
				default = {
					localization_key = rock_name_gritty
					trigger = {
						has_character_flag = name_gritty
					}
				}
				default = {
					localization_key = rock_name_rubble
					trigger = {
						has_character_flag = name_rubble
					}
				}
				default = {
					localization_key = rock_name_tuff
					trigger = {
						has_character_flag = name_tuff
					}
				}
				default = {
					localization_key = rock_name_roxanne
					trigger = {
						has_character_flag = name_roxanne
					}
				}
				default = {
					localization_key = rock_name_rosetta
					trigger = {
						has_character_flag = name_rosetta
					}
				}
				default = {
					localization_key = rock_name_chip
					trigger = {
						has_character_flag = name_chip
					}
				}
				default = {
					localization_key = rock_name_fluffy
					trigger = {
						has_character_flag = name_fluffy
					}
				}
				default = {
					localization_key = rock_name_sten
					trigger = {
						has_character_flag = name_sten
					}
				}
				default = {
					localization_key = rock_name_barney
					trigger = {
						has_character_flag = name_barney
					}
				}
				default = {
					localization_key = rock_name_ariadne
					trigger = {
						has_character_flag = name_ariadne
					}
				}
				default = {
					localization_key = rock_name_dwayne
					trigger = {
						has_character_flag = name_dwayne
					}
				}
				default = {
					localization_key = rock_name_potapczyk
					trigger = {
						has_character_flag = name_potapczyk
					}
				}
				default = {
					localization_key = rock_name_gemma
					trigger = {
						has_character_flag = name_gemma
					}
				}
			}
		}
		setup_scope = {
			root = { save_scope_as = text_target }
		}
	}

	option = { 
		name = pet_rock.0002.a
	}

	after = {
		remove_character_flag = is_naming_rock
		remove_character_flag = name_cliff
		remove_character_flag = name_sandy
		remove_character_flag = name_rocky
		remove_character_flag = name_crag
		remove_character_flag = name_flint
		remove_character_flag = name_gritty
		remove_character_flag = name_rubble
		remove_character_flag = name_tuff
		remove_character_flag = name_roxanne
		remove_character_flag = name_rosetta
		remove_character_flag = name_chip
		remove_character_flag = name_fluffy
		remove_character_flag = name_sten
		remove_character_flag = name_barney
		remove_character_flag = name_ariadne
		remove_character_flag = name_dwayne
		remove_character_flag = name_potapczyk
		remove_character_flag = name_gemma
		
		if = {
			# We entered custom text into the pop up
			limit = { NOT = { has_variable = story_cycle_rock_name } }
			set_variable = {
				name = story_cycle_rock_name
				value = flag:custom
			}
		}
		random_owned_story = {
			limit = { story_type = story_cycle_pet_rock }
			set_variable = {
				name = story_cycle_rock_name
				value = story_owner.var:story_cycle_rock_name
			}
		}
	}
}

#Chill with your rock and lose stress
#by Nick Meredith
pet_rock.0100 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0100.t
	desc = pet_rock.0100.desc
	theme = pet
	left_portrait = {
		character = root
		animation = personality_content
	}
	override_background = { reference = relaxing_room }
	cooldown = { years = 10 }

	trigger = {
		is_available_healthy_adult = yes
		stress > normal_baseline_stress
	}

	option = {
		name = pet_rock.0100.a
		add_stress = medium_stress_loss

		ai_chance = {
			base = 100
		}
	}
}

#Your rock wants a polish
#by Nick Meredith
pet_rock.0101 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0101.t
	desc = pet_rock.0101.desc
	theme = pet
	left_portrait = {
		character = root
		animation = eyeroll
	}
	override_background = { reference = relaxing_room }
	cooldown = { years = 10 }

	trigger = {
		is_available = yes
		stress > normal_baseline_stress
	}

	option = {
		name = pet_rock.0101.a

		remove_short_term_gold = 5
		
		add_stress = medium_stress_loss

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = pet_rock.0101.b

		stress_impact = {
			base = miniscule_stress_impact_gain
			greedy = medium_stress_impact_loss
			generous = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
}

#Your rock wants a bath
#by Nick Meredith
pet_rock.0102 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0102.t
	desc = pet_rock.0102.desc
	theme = pet
	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = relaxing_room }
	cooldown = { years = 10 }

	trigger = {
		is_available_healthy_adult = yes
		stress > normal_baseline_stress
		is_landed = yes
	}

	option = {
		name = pet_rock.0102.a

		add_prestige = miniscule_prestige_loss
		
		add_stress = medium_stress_loss

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = pet_rock.0102.b

		stress_impact = {
			base = miniscule_stress_impact_gain
			diligent = medium_stress_impact_loss
			lazy = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
		}
	}
}

#You sneak your rock some mint
#by Nick Meredith
pet_rock.0103 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0103.t
	desc = pet_rock.0103.desc
	theme = pet
	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = feast }
	cooldown = { years = 10 }

	trigger = {
		is_available = yes
		stress > normal_baseline_stress
	}

	option = {
		name = pet_rock.0103.a

		add_prestige = minor_prestige_loss
		
		add_character_modifier = {
			modifier = sated_stone_modifier
			years = 10
		}

		stress_impact = {
			base = miniscule_stress_impact_loss
			diligent = medium_stress_impact_gain
			ambitious = medium_stress_impact_gain
		}

		ai_chance = {
			base = 100
			modifier = {
				factor = 0
				OR = {
					has_trait = diligent
					has_trait = ambitious
				}
			}
		}
	}

	option = {
		name = pet_rock.0103.b

		stress_impact = {
			base = miniscule_stress_impact_gain
			diligent = medium_stress_impact_loss
			ambitious = medium_stress_impact_loss
		}

		ai_chance = {
			base = 50
		}
	}
}

#You lose your rock
#by Nick Meredith
pet_rock.0104 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0104.t
	desc = pet_rock.0104.desc
	theme = pet
	left_portrait = {
		character = root
		animation = stress
	}
	override_background = { reference = study }
	cooldown = { years = 10 }

	trigger = {
		is_available = yes
	}

	option = {
		name = pet_rock.0104.a

		trigger = {
			OR = {
				has_trait = arbitrary
				has_trait = fickle
			}
		}

		stress_impact = {
			base = minor_stress_impact_loss
		}

		ai_chance = {
			base = 100
		}
	}

	option = {
		name = pet_rock.0104.b

		duel = {
			skill = intrigue
			value = average_skill_rating
			70 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = pet_rock.0104.b.success
				send_interface_toast = {
					title = pet_rock.0104.b.success
					left_icon = root

					add_stress = minor_stress_loss
				}
			}
			30 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = pet_rock.0104.b.failure
				send_interface_toast = {
					title = pet_rock.0104.b.failure
					left_icon = root
					
					custom_tooltip = pet_rock.0104.b.failure.tt

					add_character_modifier = {
						modifier = lost_rock_modifier
						years = 15
					}

					random_owned_story = {
						type = story_cycle_pet_rock
						end_story = yes
					}
				}
			}
		}
		
		ai_chance = {
			base = 100
		}
	}

	option = {
		name = pet_rock.0104.c

		random_owned_story = {
			type = story_cycle_pet_rock
			end_story = yes
		}

		custom_tooltip = pet_rock.0104.c.tt

		stress_impact = {
			base = minor_stress_impact_gain
		}

		ai_chance = {
			base = 50
		}
	}
}

#You meet another rock owner
#by Nick Meredith
pet_rock.0105 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0105.t
	desc = pet_rock.0105.desc
	theme = pet
	left_portrait = {
		character = root
		animation = thinking
	}
	right_portrait = {
		character = scope:other_rock_owner
		animation = ecstasy
	}
	cooldown = { years = 10 }

	trigger = {
		is_available = yes

		any_courtier_or_guest = {
			location = root.location
			has_trait = eccentric
			is_ai = yes
			owns_story_of_type = story_cycle_pet_rock
		}
	}

	immediate = {
		random_courtier_or_guest = {
			limit = {
				location = root.location
				has_trait = eccentric
				is_ai = yes
				owns_story_of_type = story_cycle_pet_rock
			}
			save_scope_as = other_rock_owner
		}
	}

	option = {
		name = pet_rock.0105.a

		trigger = {
			OR = {
				has_trait = callous
				has_trait = sadistic
				has_trait = arrogant
			}
		}

		progress_towards_rival_effect = {
			REASON = rival_insulted_rock
			CHARACTER = scope:other_rock_owner
			OPINION = default_rival_opinion
		}

		stress_impact = {
			base = minor_stress_impact_loss
			callous = minor_stress_impact_loss
			sadistic = minor_stress_impact_loss
			compassionate = medium_stress_impact_gain
			humble = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -1
				ai_vengefulness = 1
			}
		}
	}

	option = {
		name = pet_rock.0105.b

		progress_towards_friend_effect = {
			REASON = friend_rock_playdate
			CHARACTER = scope:other_rock_owner
			OPINION = default_friend_opinion
		}

		stress_impact = {
			callous = medium_stress_impact_gain
			sadistic = medium_stress_impact_gain
			gregarious = minor_stress_impact_loss
			shy = medium_stress_impact_gain
			compassionate = minor_stress_impact_loss
			humble = minor_stress_impact_loss
		}
	
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_vengefulness = -1
			}
		}
	}

	option = {
		name = pet_rock.0105.c

		reverse_add_opinion = {
			modifier = disappointed_opinion
			target = scope:other_rock_owner
			opinion = -10
		}

		stress_impact = {
			gregarious = medium_stress_impact_gain
			shy = medium_stress_impact_loss
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_vengefulness = -1
			}
		}
	}
}

#Your rock falls off a desk
#by Nick Meredith
pet_rock.0106 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0106.t
	desc = pet_rock.0106.desc
	theme = pet
	override_background = { reference = study }
	left_portrait = {
		character = root
		animation = laugh
	}

	trigger = {
		is_available_healthy_adult = yes
		is_landed = yes
	}

	cooldown = { years = 15 }

	option = { # Add dopey cat modifier
		name = pet_rock.0106.a
		add_character_modifier = {
			modifier = rock_dopey_modifier
			years = 10
		}

		ai_chance = {
			base = 100
		}
	}
}

#You make your pet rock a little house
#by Nick Meredith
pet_rock.0107 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0107.t
	desc = pet_rock.0107.desc
	theme = pet
	left_portrait = {
		character = root
		animation = worry
	}
	override_background = { reference = courtyard }

	cooldown = { years = 10 }

	trigger = {
		is_available_healthy_adult = yes
		is_landed = yes
	}

	# Rocky can stay with me in my bed!
	option = {
		name = pet_rock.0107.a

		trigger = {
			has_trait = compassionate
		}

		add_prestige = miniscule_prestige_loss

		add_character_modifier = {
			modifier = bp2_bed_rock_modifier
			years = 20
		}

		stress_impact = {
			base = major_stress_impact_loss
			lustful = medium_stress_impact_gain #You're cramping my style, Rocky!
			lazy = miniscule_stress_impact_loss
			diligent = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = 1
				ai_rationality = -1
			}
		}
	}

	# I'll try making a little house
	option = {
		name = pet_rock.0107.b

		duel = {
			skills = { learning prowess }
			value = decent_skill_rating
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				desc = pet_rock.0107.b.success
				send_interface_toast = {
					title = pet_rock.0107.b.success
					left_icon = root
					
					add_prestige = miniscule_prestige_gain
					add_stress = medium_stress_loss
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				desc = pet_rock.0107.b.failure
				send_interface_toast = {
					title = pet_rock.0107.b.failure
					left_icon = root
					
					add_character_modifier = {
						modifier = bp2_sore_thumb_modifier
						years = 5
					}
				}
			}
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = 0.5
			}
		}
	}

	# Maybe he is an outside kinda rock?
	option = {
		name = pet_rock.0107.c

		stress_impact = {
			content = minor_stress_impact_loss
			lazy = minor_stress_impact_loss
			greedy = miniscule_stress_impact_loss
			ambitious = minor_stress_impact_gain
			diligent = medium_stress_impact_gain
			generous = minor_stress_impact_gain
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_energy = -1
				ai_rationality = 0.5
			}
		}
	}
}

#You have the option to ensconce your rock in your home
#by Nick Meredith
pet_rock.0108 = {
	type = character_event
	content_source = dlc_009
	title = pet_rock.0108.t
	desc = {
		desc = pet_rock.0108.desc
		first_valid = {
			triggered_desc = {
				trigger = { has_government = landless_adventurer_government }
				desc = pet_rock.0108.adventurer
			}
			desc = pet_rock.0108.landed
		}
	}
	theme = pet
	left_portrait = {
		character = root
		animation = thinking
	}
	override_background = { reference = courtyard }

	cooldown = { years = 10 }

	trigger = {
		is_available_healthy_adult = yes
		is_landed = yes
		exists = root.capital_province
		location = root.capital_province
	}

	immediate = {
		root.capital_province = {
			save_scope_as = rock_house
		}
	}

	# I shall enshrine Rocky in my very home!
	option = {
		name = {
			text = pet_rock.0108.a
			trigger = { is_landless_adventurer = no }
		}
		name = {
			text = pet_rock.0108.a.adventurer
			trigger = { has_government = landless_adventurer_government }
		}

		custom_tooltip = pet_rock.0108.a.tt

		scope:rock_house = {
			add_province_modifier = {
				modifier = bp2_solid_foundations_modifier
				years = 30
			}
		}

		random_owned_story = {
			type = story_cycle_pet_rock
			end_story = yes
		}

		stress_impact = {
			base = miniscule_stress_impact_gain #Sad to not have him with you at all times
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_compassion = -0.5
				ai_rationality = 1
			}
		}
	}

	# Rocky can stay with me.
	option = {
		name = pet_rock.0108.b

		flavor = pet_rock.0108.b.tt

		add_character_modifier = {
			modifier = bp2_valued_friendship_modifier
			years = 30
		}

		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_boldness = 1
				ai_honor = 0.5
			}
		}
	}
}
