﻿# Ongoing Events for the Fascinare (Charm) Scheme
# Designed similar to the Seduce scheme, which has two "milestone" events that can occur to help you with the scheme
namespace = fascinare_ongoing

############################
## First milestone events ##
############################
############
# Send a Regula Painting
# 1001 - 1022
############

# Triggers for painting results
# Landscape
scripted_trigger fascinare_gift_giving_landscape_likes_trigger = {
	OR = {
		# Personality
		has_trait = content
		has_trait = calm
		has_trait = patient

		# Special traits
		has_trait = athletic
		has_trait = lifestyle_gardener
		has_trait = lifestyle_traveler

		# Other triggers
		domain_size <= 3
	}
}

scripted_trigger fascinare_gift_giving_landscape_dislikes_trigger = {
	OR = {
		has_trait = arrogant
		has_trait = greedy

		AND = {
			has_trait = ambitious
			is_landed = yes
			highest_held_title_tier = tier_barony
		}
	}
}

# Portrait
scripted_trigger fascinare_gift_giving_portrait_likes_trigger = {
	OR = {
		# Personality
		has_trait = lustful
		has_trait = gregarious
		has_trait = trusting

		# Special traits
		has_trait = education_diplomacy
		has_trait = diplomat
		has_trait = deviant
		has_trait = fornicator
		has_trait = adulterer
		has_trait = rakish
		has_trait = disloyal

		# Other triggers
		has_council_position = councillor_chancellor
	}
}

scripted_trigger fascinare_gift_giving_portrait_dislikes_trigger = {
	OR = {
		# Personality
		has_trait = arrogant
		has_trait = callous
		has_trait = chaste
		has_trait = shy
		has_trait = paranoid

		# Special traits
		has_trait = loyal

		# Other triggers
		is_attracted_to_gender_of = scope:owner
		is_married = yes
	}
}

# Religious
scripted_trigger fascinare_gift_giving_religious_likes_trigger = {
	OR = {
		# Personality
		has_trait = zealous
		has_trait = temperate
		has_trait = just
		has_trait = humble

		# Special traits
		has_trait = education_learning
		has_trait = pilgrim
		has_trait = theologian
		num_virtuous_traits > 0

		# Other triggers
		has_council_position = councillor_court_chaplain
		ai_zeal > 50
	}
}

scripted_trigger fascinare_gift_giving_religious_dislikes_trigger = {
	OR = {
		# Personality
		has_trait = cynical
		has_trait = arbitrary
		has_trait = arrogant

		# Special traits
		has_trait = witch
		num_sinful_traits > 0

		# Other triggers
		any_secret = { secret_type = secret_non_believer }
		ai_zeal < -50
	}
}

# Give a painting with sublimal Regula messaging
fascinare_ongoing.1001 = {
	type = character_event
	title = fascinare_ongoing.1001.t
	desc = fascinare_ongoing.1001.desc

	theme = fascinare_scheme
	left_portrait = {
		character = scope:owner
		animation = flirtation_left
	}
	right_portrait = {
		character = scope:target
		animation = idle
	}
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}

	trigger = {
		NOT = { has_variable = scheme_event_active_flag }
		# They like one of these gifts
		scope:target = {
			OR = {
				fascinare_gift_giving_landscape_likes_trigger = yes
				fascinare_gift_giving_portrait_likes_trigger = yes
				fascinare_gift_giving_religious_likes_trigger = yes
			}
		}
	}

	immediate = { set_variable = scheme_event_active_flag }

	option = { # Landscape Painting
		name = fascinare_ongoing.painting_selection.landscape
		custom_tooltip = fascinare_ongoing.painting_selection.landscape_tt
		save_scope_value_as = {
			name = painting
			value = flag:landscape
		}
		fascinare_ongoing_possible_outcomes_tooltip_effect = { MILESTONE = 1 }
	}

	option = { # Portrait Painting
		name = fascinare_ongoing.painting_selection.portrait
		custom_tooltip = fascinare_ongoing.painting_selection.portrait_tt
		save_scope_value_as = {
			name = painting
			value = flag:portrait
		}
		fascinare_ongoing_possible_outcomes_tooltip_effect = { MILESTONE = 1 }
	}

	option = { # Religious Painting
		name = fascinare_ongoing.painting_selection.religious
		custom_tooltip = fascinare_ongoing.painting_selection.religious_tt
		save_scope_value_as = {
			name = painting
			value = flag:religious
		}
		fascinare_ongoing_possible_outcomes_tooltip_effect = { MILESTONE = 1 }
	}

	option = { #None of these
		name = fascinare_ongoing.painting_selection.decline
		custom_tooltip = fascinare_ongoing_decline_event.tt
		scope:scheme = {
			set_variable = {
				name = declined_fascinare_milestone_1_event
				value = yes
			}
		}
	}

	after = {
		remove_variable = scheme_event_active_flag
		scope:target = {
			if = {
				limit = {
					exists = scope:painting
				}
				if = {
					limit = {
						scope:painting = flag:landscape
					}
					random_list = {
						75 = {
							modifier = {
								add = 100
								fascinare_gift_giving_landscape_likes_trigger = yes
							}
							trigger_event = fascinare_ongoing.1011
						}
						25 = {
							modifier = {
								add = 100
								fascinare_gift_giving_landscape_dislikes_trigger = yes
							}
							trigger_event = fascinare_ongoing.1012
						}
					}
				}
				else_if = {
					limit = {
						scope:painting = flag:portrait
					}
					random_list = {
						75 = {
							modifier = {
								add = 100
								fascinare_gift_giving_portrait_likes_trigger = yes
							}
							trigger_event = fascinare_ongoing.1011
						}
						25 = {
							modifier = {
								add = 100
								fascinare_gift_giving_portrait_likes_trigger = yes
							}
							trigger_event = fascinare_ongoing.1012
						}
					}
				}
				else_if = {
					limit = {
						scope:painting = flag:religious
					}
					random_list = {
						75 = {
							modifier = {
								add = 100
								fascinare_gift_giving_religious_likes_trigger = yes
							}
							trigger_event = fascinare_ongoing.1011
						}
						25 = {
							modifier = {
								add = 100
								fascinare_gift_giving_religious_dislikes_trigger = yes
							}
							trigger_event = fascinare_ongoing.1012
						}
					}
				}
			}
		}
	}
}

###############
# Painting resolution
###############
# Target: Success
fascinare_ongoing.1011 = {
	type = character_event
	title = fascinare_ongoing.1011.t
	desc = {
		desc = fascinare_ongoing.1011.desc
		desc = fascinare_ongoing.painting_successful.target
	}

	theme = fascinare_scheme
	left_portrait = {
		character = root
		animation = flirtation_left
	}
	right_portrait = {
		character = scope:owner
		animation = love
	}

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.painting_target_successful.option
		add_character_modifier = {
			modifier = fascinare_painting_gift_modifier
			days = 3650
		}
		scope:owner = {
			trigger_event = fascinare_ongoing.1021
		}
	}
}

# Target: Failed
fascinare_ongoing.1012 = {
	type = character_event
	title = fascinare_ongoing.1012.t
	desc = {
		desc = fascinare_ongoing.1012.desc
		desc = fascinare_ongoing.painting_unsuccessful.target
	}

	theme = fascinare_scheme
	left_portrait = {
		character = root
		animation = fear
	}
	right_portrait = {
		character = scope:owner
		animation = eyeroll
	}

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.painting_target_unsuccessful.option
		add_prestige = minor_prestige_value
		scope:owner = {
			trigger_event = fascinare_ongoing.1022
		}
	}
}

# Schemer: Succeeded
fascinare_ongoing.1021 = {
	type = letter_event
	opening = {
		desc = fascinare_ongoing.target.opening
	}
	desc = fascinare_ongoing.painting_successful.owner
	sender = scope:target

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.painting_owner_successful.option
		fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 1 OUTCOME = success }
	}
}

# Schemer: Failed
fascinare_ongoing.1022 = {
	type = letter_event
	opening = {
		desc = fascinare_ongoing.target.opening
	}
	desc = fascinare_ongoing.painting_unsuccessful.owner
	sender = scope:target

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.painting_owner_unsuccessful.option
		fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 1 OUTCOME = failure }
	}
}

#############################
## Second milestone events ##
#############################
############
# Spike drink
# 2001 - 2022
############
fascinare_ongoing.2001 = {
	type = character_event
	title = fascinare_ongoing.2001.t
	desc = fascinare_ongoing.2001.desc

	theme = fascinare_scheme
	left_portrait = {
		character = scope:owner
		animation = drink
	}
	right_portrait = {
		character = scope:target
		camera = camera_event_scheme_center_look_right
		animation = idle
	}
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}

	trigger = {
		NOT = { has_variable = scheme_event_active_flag }
	}

	immediate = { set_variable = scheme_event_active_flag }

	# Use prowess/intrigue to stealthly spike drink
	option = {
		name = fascinare_ongoing.spike_method.stealth
		custom_tooltip = fascinare_ongoing.spike_method.stealth_tt
		save_scope_value_as = {
			name = spike_method
			value = flag:stealth
		}
		duel = {
			skills = { prowess intrigue }
			value = high_skill_rating
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -59
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.success.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = success }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2011
				}
			}
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.failure.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = failure }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2012
				}
			}
		}
	}

	# Use diplomacy/learning to convince target to add "spice" to drink
	option = {
		name = fascinare_ongoing.spike_method.convince
		custom_tooltip = fascinare_ongoing.spike_method.convince_tt
		save_scope_value_as = {
			name = spike_method
			value = flag:convince
		}
		duel = {
			skills = { diplomacy learning }
			value = very_high_skill_rating
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -59
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.success.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = success }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2011
				}
			}
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.failure.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = failure }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2012
				}
			}
		}
	}

	# Use martial/stewardship to command a servant to add it for you
	option = {
		name = fascinare_ongoing.spike_method.command
		custom_tooltip = fascinare_ongoing.spike_method.command_tt
		save_scope_value_as = {
			name = spike_method
			value = flag:command
		}
		duel = {
			skills = { martial stewardship }
			value = very_high_skill_rating
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -59
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.success.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = success }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2011
				}
			}
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.failure.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = failure }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2012
				}
			}
		}
	}

	option = { # Its to risky!
		name = fascinare_ongoing.spike_method.decline
		custom_tooltip = fascinare_ongoing_decline_event.tt
		scope:scheme = {
			set_variable = {
				name = declined_fascinare_milestone_2_event
				value = yes
			}
		}
	}

	after = {
		remove_variable = scheme_event_active_flag
	}
}

###############
# Drink resolution
###############
# Target: Success
fascinare_ongoing.2011 = {
	type = character_event
	title = fascinare_ongoing.2011.t
	desc = fascinare_ongoing.2011.desc

	theme = fascinare_scheme
	left_portrait = {
		character = root
		animation = drink
	}
	right_portrait = {
		character = scope:owner
		animation = flirtation
	}

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.drink_target_successful.option
		scope:owner = {
			trigger_event = fascinare_ongoing.2021
		}
	}
}

# Target: Failed
fascinare_ongoing.2012 = {
	type = character_event
	title = fascinare_ongoing.2012.t
	desc = fascinare_ongoing.2012.desc

	theme = fascinare_scheme
	left_portrait = {
		character = root
		animation = disgust
	}
	right_portrait = {
		character = scope:owner
		animation = sadness
	}

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.drink_target_unsuccessful.option
		add_prestige = minor_prestige_value
		scope:owner = {
			trigger_event = fascinare_ongoing.2022
		}
	}
}

# Schemer: Succeeded
fascinare_ongoing.2021 = {
	type = character_event
	title = fascinare_ongoing.2021.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:stealth
				}
				desc = fascinare_ongoing.2021.spike_stealth
			}
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:convince
				}
				desc = fascinare_ongoing.2021.spike_convince
			}
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:command
				}
				desc = fascinare_ongoing.2021.spike_command
			}
		}
		desc = fascinare_ongoing.2021.desc
	}

	theme = fascinare_scheme
	left_portrait = {
		character = scope:owner
		animation = flirtation
	}
	right_portrait = {
		character = scope:target
		animation = drink_goblet
	}

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.2021.success
		fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = success }
	}
}

# Schemer: Failed
fascinare_ongoing.2022 = {
	type = character_event
	title = fascinare_ongoing.2022.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:stealth
				}
				desc = fascinare_ongoing.2022.spike_stealth
			}
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:convince
				}
				desc = fascinare_ongoing.2022.spike_convince
			}
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:command
				}
				desc = fascinare_ongoing.2022.spike_command
			}
		}
		desc = fascinare_ongoing.2022.desc
	}

	theme = fascinare_scheme
	left_portrait = {
		character = scope:owner
		animation = stress
	}
	right_portrait = {
		character = scope:target
		animation = disgust
	}

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.2022.failure
		fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = failure }
	}
}

############
# Invade Dreams
# 2101 - 2122
############
fascinare_ongoing.2101 = {
	type = character_event
	title = fascinare_ongoing.2101.t
	desc = fascinare_ongoing.2101.desc

	theme = fascinare_scheme
	override_background = {
		reference = bedchamber
	}
	left_portrait = {
		character = scope:owner
		animation = scheme
	}
	right_portrait = {
		character = scope:target
		animation = dead
	}
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}

	trigger = {
		NOT = { has_variable = scheme_event_active_flag }
	}

	immediate = { set_variable = scheme_event_active_flag }

	# Use intrigue to create a "lustful" dream
	option = {
		name = fascinare_ongoing.dream.lustful
		custom_tooltip = fascinare_ongoing.dream.lustful_tt
		save_scope_value_as = {
			name = dream_type
			value = flag:lustful
		}
		duel = {
			skill = intrigue
			value = high_skill_rating
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -59
				}
				modifier = { # Lustful characters are more susceptible to this.
					scope:target = { has_trait = lustful }
					add = 10
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.success.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = success }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2111
				}
			}
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.failure.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = failure }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2112
				}
			}
		}
	}

	# Use learning to create a "submission" dream
	option = {
		name = fascinare_ongoing.dream.submit
		custom_tooltip = fascinare_ongoing.dream.submit_tt
		save_scope_value_as = {
			name = spike_method
			value = flag:convince
		}
		duel = {
			skill = learning
			value = high_skill_rating
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -59
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.success.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = success }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2011
				}
			}
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.failure.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = failure }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2012
				}
			}
		}
	}

	# Use martial/prowess to create a "conquer" dream
	option = {
		name = fascinare_ongoing.dream.conquer
		custom_tooltip = fascinare_ongoing.dream.conquer_tt
		save_scope_value_as = {
			name = spike_method
			value = flag:command
		}
		duel = {
			skills = { martial prowess }
			value = very_high_skill_rating
			60 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -59
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.success.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = success }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2011
				}
			}
			40 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -39
				}
				desc = fascinare_ongoing_possible_outcomes_tooltip_effect.failure.desc
				show_as_tooltip = {
					fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = failure }
				}
				scope:target = {
					trigger_event = fascinare_ongoing.2012
				}
			}
		}
	}

	option = { # Its to risky!
		name = fascinare_ongoing.dream.decline
		custom_tooltip = fascinare_ongoing_decline_event.tt
		scope:scheme = {
			set_variable = {
				name = declined_fascinare_milestone_2_event
				value = yes
			}
		}
	}

	after = {
		remove_variable = scheme_event_active_flag
	}
}

###############
# Dream resolution
###############
# Target: Success
fascinare_ongoing.2111 = {
	type = character_event
	title = fascinare_ongoing.2111.t
	desc = fascinare_ongoing.2111.desc

	theme = fascinare_scheme
	left_portrait = {
		character = root
		animation = drink
	}
	right_portrait = {
		character = scope:owner
		animation = flirtation
	}

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.drink_target_successful.option
		scope:owner = {
			trigger_event = fascinare_ongoing.2121
		}
	}
}

# Target: Failed
fascinare_ongoing.2112 = {
	type = character_event
	title = fascinare_ongoing.2112.t
	desc = fascinare_ongoing.2112.desc

	theme = fascinare_scheme
	left_portrait = {
		character = root
		animation = disgust
	}
	right_portrait = {
		character = scope:owner
		animation = sadness
	}

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.drink_target_unsuccessful.option
		#add_character_modifier = {
		#	TODO
		#}
		scope:owner = {
			trigger_event = fascinare_ongoing.2122
		}
	}
}

# Schemer: Succeeded
fascinare_ongoing.2121 = {
	type = character_event
	title = fascinare_ongoing.2021.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:stealth
				}
				desc = fascinare_ongoing.2021.spike_stealth
			}
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:convince
				}
				desc = fascinare_ongoing.2021.spike_convince
			}
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:command
				}
				desc = fascinare_ongoing.2021.spike_command
			}
		}
		desc = fascinare_ongoing.2021.desc
	}

	theme = fascinare_scheme
	left_portrait = {
		character = scope:owner
		animation = flirtation
	}
	right_portrait = {
		character = scope:target
		animation = drink_goblet
	}

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.2021.success
		fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = success }
	}
}

# Schemer: Failed
fascinare_ongoing.2122 = {
	type = character_event
	title = fascinare_ongoing.2022.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:stealth
				}
				desc = fascinare_ongoing.2022.spike_stealth
			}
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:convince
				}
				desc = fascinare_ongoing.2022.spike_convince
			}
			triggered_desc = {
				trigger = {
					scope:spike_method = flag:command
				}
				desc = fascinare_ongoing.2022.spike_command
			}
		}
		desc = fascinare_ongoing.2022.desc
	}

	theme = fascinare_scheme
	left_portrait = {
		character = scope:owner
		animation = stress
	}
	right_portrait = {
		character = scope:target
		animation = disgust
	}

	trigger = { exists = scope:scheme }

	option = {
		name = fascinare_ongoing.2022.failure
		fascinare_ongoing_add_scheme_modifier_effect = { MILESTONE = 2 OUTCOME = failure }
	}
}