
namespace = pet_animal

###########################################
#
# CAT (0001-0999), by Linnéa Thimrén
# DOG (1001-1999), by Linnéa Thimrén
# CAT AND DOG (2001-2999), by Linnéa Thimrén
# DOG DECISION EVENTS
#	pet_animal.6004 - Your dog lashes out D:
#
###########################################


#Your spouse is allergic!
#by Linnéa Thimrén
pet_animal.0106 = {
	type = character_event
	title = pet_animal.0106.t
	desc = pet_animal.0106.desc
	theme = pet
	left_portrait = {
		character = scope:spouse
		animation = sick
	}
	lower_left_portrait = scope:receiver_1
	lower_center_portrait = scope:receiver_2
	lower_right_portrait = scope:receiver_3
	
	trigger = {
		NOT = { has_character_flag = had_pet_animal_0106_event }
		any_spouse = {
			is_available_ai = yes
			NOT = { has_character_modifier = cat_story_allergy_modifier }
		}
	}

	immediate = {
		save_scope_as = giver
		add_character_flag = {
			flag = had_pet_animal_0106_event
			years = 10
		}
		random_spouse = {
			limit = {
				is_available_ai = yes
				NOT = { has_character_modifier = cat_story_allergy_modifier }
			}
			save_scope_as = spouse
		}

		#Who can you give it away to?
		if = {
			limit = {
				any_relation = {
					type = friend
					NOT = {
						any_owned_story = {
								story_type = story_cycle_pet_cat
							}
					}
					NOT = { this = scope:spouse }
				}
			}
			every_relation = {
				type = friend
				limit = {
					NOT = {
						any_owned_story = {
								story_type = story_cycle_pet_cat
							}
					}
					NOT = { this = scope:spouse }
				}
				add_to_list = can_get_cat
			}
		}
		if = {
			limit = {
				any_relation = {
					type = lover
					NOT = {
						any_owned_story = {
								story_type = story_cycle_pet_cat
							}
					}
					NOT = { is_in_list = can_get_cat }
					NOT = { this = scope:spouse }
				}
			}
			every_relation = {
				type = lover
				limit = {
					NOT = {
						any_owned_story = {
								story_type = story_cycle_pet_cat
							}
					}
					NOT = { is_in_list = can_get_cat }
					NOT = { this = scope:spouse }
				}
				add_to_list = can_get_cat
			}
		}
		if = {
			limit = {
				any_vassal = {
					NOT = { has_relation_rival = root }
					NOT = {
						any_owned_story = {
								story_type = story_cycle_pet_cat
							}
					}
					NOT = { is_in_list = can_get_cat }
					NOT = { this = scope:spouse }
				}
			}
			every_vassal = {
				limit = {
					NOT = { has_relation_rival = root }
					NOT = {
						any_owned_story = {
								story_type = story_cycle_pet_cat
							}
					}
					NOT = { is_in_list = can_get_cat }
					NOT = { this = scope:spouse }
				}
				add_to_list = can_get_cat
			}
		}
		if = { #Ehehehe, give it to another consort!
			limit = {
				any_consort = {
					NOT = {
						any_owned_story = {
								story_type = story_cycle_pet_cat
							}
					}
					NOT = { is_in_list = can_get_cat }
					NOT = { this = scope:spouse }
				}
			}
			every_consort = {
				limit = {
					NOT = {
						any_owned_story = {
								story_type = story_cycle_pet_cat
							}
					}
					NOT = { is_in_list = can_get_cat }
					NOT = { this = scope:spouse }
				}
				add_to_list = can_get_cat
			}
		}
		random_in_list = {
			list = can_get_cat
			save_scope_as = receiver_1
		}
		random_in_list = {
			list = can_get_cat
			limit = { NOT = { this = scope:receiver_1 } }
			save_scope_as = receiver_2
		}
		random_in_list = {
			list = can_get_cat
			limit = {
				NOR = {	
					this = scope:receiver_1
					this = scope:receiver_2
				}

			}
			save_scope_as = receiver_3
		}
	}

	option = { #Ok, I'll give it away to receiver_1
		name = pet_animal.0106.a
		trigger = {
			exists = scope:receiver_1
		}
		transfer_cat_story_cycle_to_effect = { CHARACTER = scope:receiver_1 STORY = scope:story }
		scope:receiver_1 = {
			trigger_event = pet_animal.0107
		}
		remove_character_flag = pet_cat_for_stress
	}

	option = { #Ok, I'll give it away to receiver_2
		name = pet_animal.0106.b
		trigger = {
			exists = scope:receiver_2
		}
		transfer_cat_story_cycle_to_effect = { CHARACTER = scope:receiver_2 STORY = scope:story }
		scope:receiver_2 = {
			trigger_event = pet_animal.0107
		}
		remove_character_flag = pet_cat_for_stress
	}

	option = { #Ok, I'll give it away to receiver_3
		name = pet_animal.0106.c
		trigger = {
			exists = scope:receiver_3
		}
		transfer_cat_story_cycle_to_effect = { CHARACTER = scope:receiver_3 STORY = scope:story }
		scope:receiver_3 = {
			trigger_event = pet_animal.0107
		}
		remove_character_flag = pet_cat_for_stress
	}

	option = { #No!
		name = pet_animal.0106.d
		scope:spouse = {
			add_opinion = {
				target = root
				modifier = refusal_opinion
				opinion = -15
			}
			add_character_modifier = {
				modifier = cat_story_allergy_modifier
				years = 5
			}
		}
	}

	option = { #I'll... I'll get rid of it...
		name = pet_animal.0106.e
		trigger = {
			NOT = { exists = scope:receiver_1 }
		}
		show_as_tooltip = {
			remove_cat_story_modifiers_effect = yes
		}
		scope:story = {
			hidden_effect = { end_story = yes }
		}
		remove_character_flag = pet_cat_for_stress
	}
}


#Cat dies
#by Linnéa Thimrén
pet_animal.0199 = {
	type = character_event
	title = pet_animal.0199.t
	desc = pet_animal.0199.desc
	theme = pet
	left_portrait = {
		character = root
		animation = sadness
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = {
		name = pet_animal.0199.a
		show_as_tooltip = {
			remove_cat_story_modifiers_effect = yes
		}
		scope:story = {
			hidden_effect = { end_story = yes }
		}
	}
	after = {
		remove_character_flag = cat_is_dying
		remove_character_flag = pet_cat_for_stress
	}
}




##############
##############
## DOG
##############
##############

###########################################
# Other events for your dog
#	1100-1199
###########################################

#Dog is gone :(
#by Linnéa Thimrén
pet_animal.1104 = {
	type = character_event
	title = pet_animal.1102.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:followed
				}
				desc = pet_animal.1104.desc_followed
			}
			desc = pet_animal.1104.desc
		}
		desc = pet_animal.1104.desc_ending
	}
	theme = pet
	override_background = {
		event_background = terrain
	}
	left_portrait = {
		character = root
		animation = sadness
	}

	trigger = {
		exists = scope:story
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = { #
		name = pet_animal.1104.a
		scope:story = {
			hidden_effect = { end_story = yes }
		}
	}
	
	after = {
		remove_character_flag = pet_dog_for_stress
	}	
}

#Rival killed dog :(
#by Linnéa Thimrén
pet_animal.1105 = {
	type = character_event
	title = pet_animal.1102.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:followed
				}
				desc = pet_animal.1104.desc_followed
			}
			desc = pet_animal.1104.desc
		}
		desc = pet_animal.1105.desc_ending
	}
	theme = pet
	override_background = {
		event_background = terrain
	}
	left_portrait = {
		character = scope:rival
		animation = schadenfreude
	}

	trigger = {
		any_relation = {
			type = rival
			is_alive = yes
			is_imprisoned = no
		}
		exists = scope:story
	}

	immediate = {
		random_relation = {
			type = rival
			limit = {
				has_relation_nemesis = root
				is_imprisoned = no
			}
			alternative_limit = {
				is_alive = yes
				is_imprisoned = no
			}
			save_scope_as = rival
		}
		random_dummy_gender_soldier_effect = { SCOPE_NAME = dummy_gender }
	}

	option = { #what did you do to them?!
		name = pet_animal.1105.a
		scope:story = {
			hidden_effect = { end_story = yes }
		}
		hidden_effect = {
			scope:rival = {
				add_character_modifier = {
					modifier = dog_story_fur_carpet_modifier
					years = 10
				}
			}
		}
	}
	
	after = {
		remove_character_flag = pet_dog_for_stress
	}	
}


#Dog dies
#by Linnéa Thimrén
pet_animal.1199 = {
	type = character_event
	title = pet_animal.1199.t
	desc = pet_animal.1199.desc
	theme = pet
	left_portrait = {
		character = root
		animation = sadness
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = {
		name = pet_animal.1199.a
		show_as_tooltip = {
			remove_dog_story_modifiers_effect = yes
		}
		scope:story = {
			hidden_effect = { end_story = yes }
		}
	}
	after = {
		remove_character_flag = dog_is_dying
		remove_character_flag = pet_dog_for_stress
	}
}




##############
##############
## CAT AND DOG
##############
##############

#Dog dies
#by Linnéa Thimrén
pet_animal.2003 = {
	type = character_event
	title = pet_animal.2002.t
	desc = pet_animal.2003.desc
	theme = pet
	override_background = {
		event_background = courtyard
	}
	left_portrait = {
		character = root
		animation = grief
	}

	immediate = {
		play_music_cue = "mx_cue_stress"
	}

	option = {
		name = pet_animal.2003.a
		show_as_tooltip = {
			remove_dog_story_modifiers_effect = yes
		}
		scope:dog_story = {
			hidden_effect = { end_story = yes }
		}
	}

	after = {
		remove_character_flag = dog_is_dying
		remove_character_flag = pet_dog_for_stress
	}
}

#Cat dies
#by Linnéa Thimrén
pet_animal.2004 = {
	type = character_event
	title = pet_animal.2002.t
	desc = {
		desc = pet_animal.2004.desc_opening
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:dog_story = { var:dog_gender = flag:female }
				}
				desc = pet_animal.2004.desc_female
			}
			desc = pet_animal.2004.desc_male
		}
		desc = pet_animal.2004.desc
	}
	theme = pet
	left_portrait = {
		character = root
		animation = grief
	}

	immediate = {
		play_music_cue = "mx_cue_murder"
	}

	option = {
		name = pet_animal.2004.a
		show_as_tooltip = {
			remove_cat_story_modifiers_effect = yes
		}
		scope:cat_story = {
			hidden_effect = { end_story = yes }
		}
	}

	after = {
		remove_character_flag = cat_is_dying
		remove_character_flag = pet_cat_for_stress
	}
}

#Both die
#by Linnéa Thimrén
pet_animal.2005 = {
	type = character_event
	title = pet_animal.2002.t
	desc = {
		desc = pet_animal.2005.desc_opening
		desc = pet_animal.2005.desc
	}
	theme = pet
	left_portrait = {
		character = root
		animation = grief
	}

	immediate = {
		play_music_cue = "mx_cue_prison"
	}

	option = {
		name = pet_animal.2005.a
		show_as_tooltip = {
			remove_cat_story_modifiers_effect = yes
			remove_dog_story_modifiers_effect = yes
		}
		scope:cat_story = {
			hidden_effect = { end_story = yes }
		}
		scope:dog_story = {
			hidden_effect = { end_story = yes }
		}
	}

	after = {
		remove_character_flag = cat_is_dying
		remove_character_flag = dog_is_dying
		remove_character_flag = pet_cat_for_stress
		remove_character_flag = pet_dog_for_stress
	}
}


#########################
#########################
## DOG DECISION EVENTS
#########################
#########################
#Events triggered from decisions about your animals

#Your dog lashes out D:
#by Linnéa Thimrén
pet_animal.6004 = {
	type = character_event
	title = pet_animal.6001.t
	desc = pet_animal.6004.desc
	theme = pet
	left_portrait = {
		character = root
		animation = shock
	}
	
	trigger = {
		NOT = { has_character_flag = had_pet_animal_6004_event } #Complete blockage since the event is severe
	}

	immediate = {
		add_character_flag = {
			flag = had_pet_animal_6004_event
			years = 10
		}
		random_owned_story = {
			limit = {
				story_type = story_cycle_pet_dog
			}
			save_scope_as = story
		}
		increase_wounds_effect = { REASON = dog_attack }
	}

	option = {
		name = pet_animal.6004.a
	}

	option = {
		name = pet_animal.6004.b
		show_as_tooltip = {
			remove_dog_story_modifiers_effect = yes
		}
		scope:story = {
			hidden_effect = { end_story = yes }
		}
		remove_character_flag = pet_dog_for_stress
	}
}
