﻿namespace = unop_tests

# To showcase the bug where the fallback do not fire... could be a huge source of bugs
unop_tests.0001 = {
	orphan = yes
	type = character_event
	title = insult_poetry.0001.t
	theme = skull
	desc = insult_poetry.0001.t
	left_portrait = {
		character = scope:ugly_male
		outfit_tags = { no_clothes }
	}
	right_portrait = {
		character = scope:beauty_female
		outfit_tags = { no_clothes }
	}
	override_background = { reference = temple }

	immediate = {
		#if = {
		#	limit = { has_variable = holy_order_name }
		#	add_trait = blind
		#}
		create_character = {
			age = { 20 32 }
			location = root.capital_province
			gender = male
			culture = root.culture
			faith = root.faith
			diplomacy = 1
			stewardship = 1
			martial = 1
			learning = 1
			intrigue = 1
			trait = beauty_bad_3
			trait = lovers_pox
			trait = disfigured
			trait = leper
			trait = cynical
			trait = deceitful
			trait = callous

			dynasty = none
			after_creation = {
				add_gold = { minor_gold_value medium_gold_value }
				add_prestige = { minor_prestige_gain medium_prestige_gain }
				add_piety = { minor_piety_gain medium_piety_gain }
			}

			save_scope_as = ugly_male
		}
		create_character = {
			age = { 20 32 }
			location = root.capital_province
			gender = female
			culture = root.culture
			faith = root.faith
			diplomacy = 100
			stewardship = 100
			martial = 100
			learning = 100
			intrigue = 100
			trait = beauty_good_3
			trait = zealous
			trait = compassionate
			trait = honest

			dynasty = none
			after_creation = {
				add_gold = { minor_gold_value medium_gold_value }
				add_prestige = { minor_prestige_gain medium_prestige_gain }
				add_piety = { minor_piety_gain medium_piety_gain }
			}

			save_scope_as = beauty_female
		}
	}

	option = {
		name = test_court_events.1.a

		random_list = {
			# they hit it off
			1 = {
				desc = bp1_yearly.5102.a.success
				send_interface_toast = {
					title = bp1_yearly.5102.a.success
					left_icon = root
					right_icon = scope:ugly_male
				}
				compatibility_modifier = {
					who = scope:ugly_male
					compatibility_target = scope:beauty_female
					multiplier = 2
					min = -30
					max = 30
				}
			}
			1 = {
				desc = bp1_yearly.5102.a.failure
				scope:ugly_male = {
					add_trait = blind
				}
				send_interface_toast = {
					title = bp1_yearly.5102.a.failure
					left_icon = root
					right_icon = scope:ugly_male
				}
				root = {
					add_trait = blind
				}
			}
		}

		add_character_flag = khlon_glan_flag
		add_character_flag = guru_flag
		add_character_flag = court_brahmin_flag

		court_position_grant_effect = {
			EMPLOYER = root
			POS = court_guru
			CANDIDATE = scope:ugly_male
		}
		court_position_grant_effect = {
			EMPLOYER = root
			POS = court_brahmin
			CANDIDATE = scope:ugly_male
		}
	}
}

# If we have another set of traits then we'll be able to view the % of chance of each and each event can actually fire
# May need to fire multiple time to have the correct %chance visible
unop_tests.0002 = {
	orphan = yes
	type = character_event
	title = insult_poetry.0001.t
	theme = skull
	desc = insult_poetry.0001.t
	left_portrait = scope:ugly_male
	right_portrait = scope:beauty_female
	override_background = { reference = temple }

	immediate = {
		create_character = {
			age = { 20 32 }
			location = root.capital_province
			gender = male
			culture = root.culture
			faith = root.faith
			random_traits = yes
			diplomacy = 1
			stewardship = 1
			martial = 1
			learning = 1
			intrigue = 1

			dynasty = none
			after_creation = {
				add_gold = { minor_gold_value medium_gold_value }
				add_prestige = { minor_prestige_gain medium_prestige_gain }
				add_piety = { minor_piety_gain medium_piety_gain }
			}

			save_scope_as = ugly_male
		}
		create_character = {
			age = { 20 32 }
			location = root.capital_province
			gender = female
			culture = root.culture
			faith = root.faith
			random_traits = yes
			diplomacy = 100
			stewardship = 100
			martial = 100
			learning = 100
			intrigue = 100

			dynasty = none
			after_creation = {
				add_gold = { minor_gold_value medium_gold_value }
				add_prestige = { minor_prestige_gain medium_prestige_gain }
				add_piety = { minor_piety_gain medium_piety_gain }
			}

			save_scope_as = beauty_female
		}
	}

	option = {
		name = test_court_events.1.a

		random_list = {
			# they hit it off
			1 = {
				desc = bp1_yearly.5102.a.success
				send_interface_toast = {
					title = bp1_yearly.5102.a.success
					left_icon = root
					right_icon = scope:ugly_male
				}
				compatibility_modifier = {
					who = scope:ugly_male
					compatibility_target = scope:beauty_female
					multiplier = 2
					min = -30
					max = 30
				}
			}
			1 = {
				desc = bp1_yearly.5102.a.failure
				scope:ugly_male = {
					add_trait = blind
				}
				send_interface_toast = {
					title = bp1_yearly.5102.a.failure
					left_icon = root
					right_icon = scope:ugly_male
				}
				root = {
					add_trait = blind
				}
			}
		}
	}
}

#unop_tests.0003 = {
#	orphan = yes
#	#hidden = yes
#
#	title = insult_poetry.0001.t
#	theme = skull
#	desc = insult_poetry.0001.t
#
#	immediate = {
#
#	}
#
#	option = {
#		name = india_welcome
#		play_sound_effect = "event:/DLC/EP2/SFX/Stingers/Grand_Activities/ep2_mx_sting_tour_india_welcome"
#	}
#	option = {
#		name = india_neutral
#		play_sound_effect = "event:/DLC/EP2/SFX/Stingers/Grand_Activities/ep2_mx_sting_tour_india_neutral"
#	}
#	option = {
#		name = india_suspicious
#		play_sound_effect = "event:/DLC/EP2/SFX/Stingers/Grand_Activities/ep2_mx_sting_tour_india_suspicious"
#	}
#}

unop_tests.0004 = {
	orphan = yes
	type = character_event
	title = insult_poetry.0001.t
	theme = skull
	desc = {
		triggered_desc = {
			trigger = {
				is_landed = yes
			}
			desc = number_one
			desc = number_two
		}
		desc = number_three

		first_valid = {
			desc = number_four
			triggered_desc = {
				trigger = { is_landed = yes }
				desc = number_five
			}
			desc = number_six
		}

		desc = number_seven

		first_valid = {
			triggered_desc = {
				trigger = { is_landed = yes }
				desc = number_eight
			}
			desc = number_nine
			desc = number_ten
		}
	}

	immediate = {
		create_character = {
			age = { 20 32 }
			location = root.capital_province
			gender = male
			culture = root.culture
			faith = root.faith
			random_traits = yes
			diplomacy = 1
			stewardship = 1
			martial = 1
			learning = 1
			intrigue = 1

			dynasty = none
			after_creation = {
				add_gold = { minor_gold_value medium_gold_value }
				add_prestige = { minor_prestige_gain medium_prestige_gain }
				add_piety = { minor_piety_gain medium_piety_gain }
			}

			save_scope_as = ugly_male
		}

		create_character = {
			age = { 20 32 }
			location = root.capital_province
			gender = female
			culture = root.culture
			faith = root.faith
			random_traits = yes
			diplomacy = 100
			stewardship = 100
			martial = 100
			learning = 100
			intrigue = 100

			dynasty = none
			after_creation = {
				add_gold = { minor_gold_value medium_gold_value }
				add_prestige = { minor_prestige_gain medium_prestige_gain }
				add_piety = { minor_piety_gain medium_piety_gain }
			}

			save_scope_as = beauty_female
		}
	}

	option = {
		name = test_court_events.1.a
		set_relation_friend = {
			target = root.mother
			reason = befriended_at_feast
			province = location
		}
	}

	option = {
		name = test_court_events.1.a
		send_interface_toast = {
			title = test_court_events.1.a
			left_icon = scope:beauty_female
			right_icon = scope:ugly_male
			random_list = {
				1 = {
					desc = passage_rites_effect.trait
					flip_sinful_trait_effect = yes
				}
				1 = {
					desc = passage_rites_effect.xp
					add_learning_lifestyle_xp = major_lifestyle_xp
				}
				1 = {
					desc = passage_rites_effect.skill
					add_learning_skill = 1
				}
			}
		}
	}
}

#unop_tests.0005 = {
#	orphan = yes
#	#hidden = yes
#
#	title = insult_poetry.0001.t
#	theme = skull
#	desc = insult_poetry.0001.t
#
#	immediate = {
#
#	}
#
#	option = {
#		name = mena_welcome
#		play_sound_effect = "event:/DLC/EP2/SFX/Stingers/Grand_Activities/ep2_mx_sting_tour_mena_welcome"
#	}
#	option = {
#		name = mena_neutral
#		play_sound_effect = "event:/DLC/EP2/SFX/Stingers/Grand_Activities/ep2_mx_sting_tour_mena_neutral"
#	}
#	option = {
#		name = mena_suspicious
#		play_sound_effect = "event:/DLC/EP2/SFX/Stingers/Grand_Activities/ep2_mx_sting_tour_mena_suspicious"
#	}
#}
#unop_tests.0006 = {
#	orphan = yes
#	#hidden = yes
#
#	title = insult_poetry.0001.t
#	theme = skull
#	desc = insult_poetry.0001.t
#	
#	immediate = {
#
#	}
#
#	option = {
#		name = west_welcome
#		play_sound_effect = "event:/DLC/EP2/SFX/Stingers/Grand_Activities/ep2_mx_sting_tour_west_welcome"
#	}
#	option = {
#		name = west_neutral
#		play_sound_effect = "event:/DLC/EP2/SFX/Stingers/Grand_Activities/ep2_mx_sting_tour_west_neutral"
#	}
#	option = {
#		name = west_suspicious
#		play_sound_effect = "event:/DLC/EP2/SFX/Stingers/Grand_Activities/ep2_mx_sting_tour_west_suspicious"
#	}
#}

#unop_tests.0007 = {
#	orphan = yes
#	type = character_event
#	hidden = yes
#
#	immediate = {
#		set_variable =  gw_from_event_bypass
#	}
#
#	after = {
#		remove_variable =  gw_from_event_bypass
#		add_trait = blind
#	}
#}

unop_tests.0008 = {
	orphan = yes
	type = character_event
	title = insult_poetry.0001.t
	theme = skull
	desc = {
		triggered_desc = {
			trigger = {
				is_landed = yes
			}
			desc = number_one
			desc = number_two
		}
		desc = number_three

		first_valid = {
			desc = number_four
			triggered_desc = {
				trigger = { is_landed = yes }
				desc = number_five
			}
			desc = number_six
		}

		desc = number_seven

		first_valid = {
			triggered_desc = {
				trigger = { is_landed = yes }
				desc = number_eight
			}
			desc = number_nine
			desc = number_ten
		}
	}

	left_portrait = root
	center_portrait = root
	right_portrait = root

	immediate = {

	}

	option = {
		name = test_court_events.1.a

		set_artifact_rarity_common = yes
		#get_artifact_quality_effect = yes
		#get_artifact_wealth_effect = yes

		#hidden_effect_new_object = {
			create_artifact = {
				name = fake_papal_tiara_name
				description = fake_papal_tiara_description
				type = helmet
				visuals = pope_tiara
				wealth = scope:wealth
				quality = scope:quality
				modifier = artifact_fake_papal_tiara_modifier
				save_scope_as = newly_created_artifact
			}

			scope:newly_created_artifact = {
				equip_artifact_to_owner = yes
			}
		#}
	}

	option = {
		name = ep2_tournament_events.3504.a

		random_list = {
			1 = {
				desc = ep2_tournament_events.3504.wound_tt
				show_chance = no
				increase_wounds_effect = { REASON = accident }
			}
			1 = {
				desc = ep2_tournament_events.3504.incapable_tt
				show_chance = no
				add_trait = incapable
			}
			1 = {
				desc = ep2_tournament_events.3504.death_tt
				show_chance = no
				death = {
					death_reason = death_tournament_quintain_hit
				}
			}
		}
	}
}

unop_tests.0010 = {
	orphan = yes
	type = character_event
	title = insult_poetry.0001.t
	theme = skull
	desc = insult_poetry.0001.t

	immediate = {

	}

	option = {
		name = test_court_events.1.b
		if = {
			limit = { can_contract_disease_trigger = { DISEASE = bubonic_plague } }
		}
		random = {
			chance = 100
			send_interface_toast = {
				title = epidemic_events.5901.a.tt.plague
				left_icon = root
				
				show_as_tooltip = {
					add_trait = bubonic_plague
				}
				hidden_effect = {
					contract_disease_notify_effect = { DISEASE = bubonic_plague }
				}
			}
		}
	}

	option = {
		name = test_court_events.1.a
		if = {
			limit = { NOT = { has_trait = scarred } }
			add_trait = scarred
		}
		add_trait_xp = {
			trait = scarred
			value = {
				integer_range = {
					min = 5
					max = 25
				}
			}
		}
	}
}

unop_tests.0011 = { #Diag of tournament_events.1230 adding a new char but game said they are already traveling ???
	orphan = yes
	type = character_event
	title = insult_poetry.0001.t
	theme = skull
	desc = insult_poetry.0001.t
	
	immediate = {
		involved_activity = {
			save_scope_as = activity
		}
		create_character = {
			template = tournament_foot_character
			location = root.location
			culture = root.culture
			faith = root.faith
			dynasty = none
			save_scope_as = battle_peasant
		}
	}

	option = {
		name = test_court_events.1.a
		scope:battle_peasant = {
			set_employer = root
			add_to_activity_without_travel = scope:activity
			##scope:activity = {
			##	add_to_guest_subset = {
			##		name = contestant
			##		target = scope:battle_peasant						
			##	}
			##}		
		}
		current_travel_plan = { add_companion = scope:battle_peasant }
	}
}