﻿namespace = tour_general
############################
## Journal Events
## 5000-5999
## by James Beaumont
############################
# tour_general.5000 - Failing to solve the puzzle
# tour_general.5010 - Solving the journal
# tour_general.5020 - The journal is stolen

#####################################################################################

############################
## Journal Events
## 5000-5999
## by James Beaumont
############################

# Failing to get the journal open
tour_general.5000 = {
	type = character_event
	title = tour_general.5000.title
	desc = tour_general.5000.desc

	theme = learning
	left_portrait = {
		character = root
		animation = personality_rational
	}
	artifact = {
		target = scope:mysterious_journal
		position = lower_right_portrait
	}
	option = { # Drat!
		name = tour_general.5000.a
		stress_impact = {
			base = major_stress_impact_gain
			patient = minor_stress_impact_loss
			arrogant = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
		}
	}

	option = { # Try again!
		name = tour_general.5000.b
		duel = {
			skill = learning
			value = high_skill_rating
			50 = { # You solve the puzzle!
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0.5
				}
				custom_tooltip = {
					text = open_the_journal_tt
					trigger_event = tour_general.5010
				}
			}
			50 = { # You fail
				compare_modifier = {
					value = scope:duel_value
					multiplier = -0.5
				}
				show_as_tooltip = {
					add_stress = major_stress_gain
				}
				hidden_effect = {
					trigger_event = tour_general.5001
				}
			}
		}
		stress_impact = {
			base = major_stress_impact_gain
			patient = minor_stress_impact_loss
			arrogant = minor_stress_impact_loss
			stubborn = minor_stress_impact_loss
		}
		ai_chance = {
			base = 0
		}
	}
}

# Failing to get the journal open, again!
tour_general.5001 = {
	type = character_event
	title = tour_general.5001.title
	desc = tour_general.5001.desc

	theme = learning
	left_portrait = {
		character = root
		animation = personality_rational
	}
	artifact = {
		target = scope:mysterious_journal
		position = lower_right_portrait
	}
	option = { # Drat!
		name = tour_general.5001.a
		stress_impact = {
			base = major_stress_impact_gain
			patient = minor_stress_impact_loss
			arrogant = minor_stress_impact_gain
			stubborn = minor_stress_impact_gain
		}
		ai_chance = {
			base = 50
		}
	}

	option = { # Bust open the damn lock!
		name = tour_general.5001.b
		duel = {
			skill = prowess
			value = high_skill_rating
			50 = { # You break it
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
				}
				desc = the_journal_is_destroyed_tt
				send_interface_toast = {
					title = the_journal_is_destroyed_tt
					left_icon = root
					random_owned_story = {
						type = story_cycle_mysterious_journal
						end_story = yes
					}
					destroy_artifact = scope:mysterious_journal
				}
			}
			50 = { # You crack it open
				compare_modifier = {
					value = scope:duel_value
					multiplier = 0
				}
				desc = open_the_journal_tt
				custom_tooltip = {
					text = more_mysteries_inside_tt
					trigger_event = tour_general.5010
				}
			}
			50 = { # You are too weak
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
				}
				desc = fail_to_open_journal_tt
				hidden_effect = {
					send_interface_toast = {
						title = fail_to_open_journal_tt
						left_icon = root
					}
				}
			}
		}
		stress_impact = {
			base = medium_stress_impact_gain
			patient = medium_stress_impact_gain
			arrogant = medium_stress_impact_loss
			stubborn = medium_stress_impact_loss
		}
		ai_chance = {
			base = 0
		}
	}
}

# You got the journal open, now to decipher it...
scripted_trigger journal_answer_is_1 = {
	scope:mysterious_journal = {
		var:answer_variable = 1
	}
}
scripted_trigger journal_answer_is_2 = {
	scope:mysterious_journal = {
		var:answer_variable = 2
	}
}
scripted_trigger journal_answer_is_3 = {
	scope:mysterious_journal = {
		var:answer_variable = 3
	}
}
scripted_trigger journal_answer_is_4 = {
	scope:mysterious_journal = {
		var:answer_variable = 4
	}
}

tour_general.5010 = {
	type = character_event
	title = tour_general.5010.title
	desc = {
		desc = tour_general.5010.desc.intro
		first_valid = {
			triggered_desc = {
				trigger = { journal_answer_is_1 = yes }
				desc = tour_general.5010.desc.puzzle.a
			}
			triggered_desc = {
				trigger = { journal_answer_is_2 = yes }
				desc = tour_general.5010.desc.puzzle.b
			}
			triggered_desc = {
				trigger = { journal_answer_is_3 = yes }
				desc = tour_general.5010.desc.puzzle.c
			}
			triggered_desc = {
				trigger = { journal_answer_is_4 = yes }
				desc = tour_general.5010.desc.puzzle.d
			}
		}
		desc = tour_general.5010.desc.outro
	}

	theme = learning
	left_portrait = {
		character = root
		animation = happiness
	}
	artifact = {
		target = scope:mysterious_journal
		position = lower_right_portrait
	}
	immediate = {
		if = {
			limit = {
				scope:mysterious_journal = {
					NOT = { exists = var:answer_variable }
				}
			}
			hidden_effect = {
				scope:mysterious_journal = {
					random_list = {
						25 = {
							set_variable = {
								name = answer_variable
								value = 1
							}
						}
						25 = {
							set_variable = {
								name = answer_variable
								value = 2
							}
						}
						25 = {
							#You need to have a title/realm for this to be a relevant reward
							trigger = { is_landed = yes }
							set_variable = {
								name = answer_variable
								value = 3
							}
						}
						25 = {
							set_variable = {
								name = answer_variable
								value = 4
							}
						}
					}
				}
			}
		}
	}
	option = { # Answer A
		name = tour_general.5010.a
		custom_tooltip = {
			text = attempt_to_solve_the_cipher_tt
			if = {
				limit = {
					journal_answer_is_1 = yes
				}
				trigger_event = tour_general.5011
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				journal_answer_is_1 = no
			}
		}
	}
	option = { # Answer B
		name = tour_general.5010.b
		custom_tooltip = {
			text = attempt_to_solve_the_cipher_tt
			if = {
				limit = {
					journal_answer_is_2 = yes
				}
				trigger_event = tour_general.5012
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				journal_answer_is_2 = no
			}
		}
	}
	option = { # Answer C
		name = tour_general.5010.c
		trigger = { is_landed = yes }
		custom_tooltip = {
			text = attempt_to_solve_the_cipher_tt
			if = {
				limit = {
					journal_answer_is_3 = yes
				}
				trigger_event = tour_general.5013
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				journal_answer_is_3 = no
			}
		}
	}
	option = { # Answer D
		name = tour_general.5010.d
		custom_tooltip = {
			text = attempt_to_solve_the_cipher_tt
			if = {
				limit = {
					journal_answer_is_4 = yes
				}
				trigger_event = tour_general.5014
			}
		}
		ai_chance = {
			base = 50
			modifier = {
				factor = 0
				journal_answer_is_4 = no
			}
		}
	}
}

# Generic solving the puzzle reward
scripted_effect generic_journal_reward = {
	random_owned_story = {
		type = story_cycle_mysterious_journal
		set_variable = {
			name = journal_complete_solved
			value = yes
		}
	}
	add_prestige = major_prestige_gain
	add_dynasty_prestige = major_dynasty_prestige_gain
}

# You solved it! It's a book about grotesques!
tour_general.5011 = {
	type = character_event
	title = tour_general.5011.title
	desc = tour_general.5011.desc

	theme = learning
	left_portrait = {
		character = root
		animation = ecstasy
	}
	artifact = {
		target = scope:mysterious_journal
		position = lower_right_portrait
	}
	immediate = {
		generic_journal_reward = yes
		scope:mysterious_journal = {
			set_artifact_name = artifact_journal_of_grotesques
			set_artifact_description = artifact_journal_of_grotesques_desc
			set_artifact_rarity = illustrious
			remove_artifact_modifier = artifact_stress_gain_1_penalty_modifier
			add_artifact_modifier = artifact_monthly_prestige_gain_per_dread_add_4_modifier
			add_artifact_modifier = artifact_dread_gain_mult_4_modifier
			add_artifact_modifier = artifact_learning_1_modifier
			add_artifact_modifier = artifact_intrigue_2_modifier
		}
	}
	option = { # Omg that's so cool
		name = tour_general.5011.a
		ai_chance = {
			base = 50
		}
	}
}

# You solved it! It's a book about advanced theology!
tour_general.5012 = {
	type = character_event
	title = tour_general.5012.title
	desc = tour_general.5012.desc

	theme = learning
	left_portrait = {
		character = root
		animation = ecstasy
	}
	artifact = {
		target = scope:mysterious_journal
		position = lower_right_portrait
	}
	immediate = {
		generic_journal_reward = yes
		scope:mysterious_journal = {
			set_artifact_name = artifact_journal_of_theology
			set_artifact_description = artifact_journal_of_theology_desc
			set_artifact_rarity = illustrious
			remove_artifact_modifier = artifact_stress_gain_1_penalty_modifier
			add_artifact_modifier = artifact_monthly_piety_6_modifier
			add_artifact_modifier = artifact_learning_2_modifier
			add_artifact_modifier = artifact_domain_tax_same_faith_mult_4_modifier
			add_artifact_modifier = artifact_monthly_learning_lifestyle_xp_4_modifier
		}
	}
	option = { # Omg that's so cool
		name = tour_general.5012.a
		ai_chance = {
			base = 50
		}
	}
}

# You solved it! It's a secret history of your realm!
tour_general.5013 = {
	type = character_event
	title = tour_general.5013.title
	desc = tour_general.5013.desc

	theme = tour_stop
	left_portrait = {
		character = root
		animation = ecstasy
	}
	artifact = {
		target = scope:mysterious_journal
		position = lower_right_portrait
	}
	immediate = {
		generic_journal_reward = yes
		scope:mysterious_journal = {
			set_artifact_name = artifact_journal_secret_history
			set_artifact_description = artifact_journal_secret_history_desc
			set_artifact_rarity = illustrious
			remove_artifact_modifier = artifact_stress_gain_1_penalty_modifier
			add_artifact_modifier = artifact_owned_hostile_scheme_success_chance_add_12_modifier
			add_artifact_modifier = artifact_monthly_intrigue_lifestyle_xp_4_modifier
			add_artifact_modifier = artifact_intrigue_2_modifier
		}
	}
	option = { # Omg that's so cool
		name = tour_general.5013.a
		ai_chance = {
			base = 50
		}
	}
}

# You solved it! It's a book of martial arts techniques
tour_general.5014 = {
	type = character_event
	title = tour_general.5014.title
	desc = tour_general.5014.desc

	theme = tour_stop
	left_portrait = {
		character = root
		animation = ecstasy
	}
	artifact = {
		target = scope:mysterious_journal
		position = lower_right_portrait
	}
	immediate = {
		generic_journal_reward = yes
		scope:mysterious_journal = {
			set_artifact_name = artifact_journal_of_martial_arts
			set_artifact_description = artifact_journal_of_martial_arts_desc
			set_artifact_rarity = illustrious
			remove_artifact_modifier = artifact_stress_gain_1_penalty_modifier
			add_artifact_modifier = artifact_prowess_8_modifier
			add_artifact_modifier = artifact_monthly_martial_lifestyle_xp_4_modifier
			add_artifact_modifier = artifact_martial_2_modifier
		}
	}
	option = { # Omg that's so cool
		name = tour_general.5014.a
		ai_chance = {
			base = 50
		}
	}
}
