namespace = Plus 	

#reserved: Plus.4600 to Plus 4699

#######################################
# JADE DRAGON EVENTS
# Written by Zeress
#######################################

# Event Plus.4600-4605 are an event chain to send a feast to the Jade Emperor.

character_event = {
	id = Plus.4600

	is_triggered_only = yes

	has_dlc = "Jade Dragon"	
	only_independent = yes
	min_age = 16
	capable_only = yes
	war = no
	prisoner = no
	
	trigger = {
		NOT = {
			has_character_flag = held_jd_feast
		}
		offmap_china = {
			governor = {
				is_within_diplo_range = ROOT
			}
		}
		wealth = 150 # A bit more than the minimum required 
	}
	
	desc = {
		trigger = { trait = lunatic }
		text = EVTDESCA_PLUS_4600
	}
	desc = {
		trigger = { NOT = { trait = lunatic } }
		text = EVTDESCB_PLUS_4600
	}
	picture = GFX_evt_feast

	immediate = { set_character_flag = held_jd_feast }
	
	option = { # Good thinking me!
		name = EVTOPTA_PLUS_4600
		hidden_tooltip = { character_event = { id = Plus.4601 } } # Plan the appetizers
	}
}

character_event = { # Plan the appetizers
	id = Plus.4601
	desc = EVTDESC_PLUS_4601
	picture = GFX_evt_feast
	
	is_triggered_only = yes
	
	option = { # Smoked Salmon
		name = EVTOPTA_PLUS_4601
		custom_tooltip = { text = "PLUS_4601A_hover_ctt" }
		scaled_wealth = { value = -0.2 max = -40 }
		hidden_tooltip = { 
			set_character_flag = jd_feast_salmon
			character_event = { id = Plus.4602 }			
		}
	}
	option = { # Cheese Stuffed Eggs
		name = EVTOPTB_PLUS_4601
		custom_tooltip = { text = "PLUS_4601B_hover_ctt" }
		scaled_wealth = { value = -0.15 max = -30 }
		hidden_tooltip = { 
			set_character_flag = jd_feast_cheese_eggs
			character_event = { id = Plus.4602 }			
		}
	}
	option = { # Roasted Milk
		name = EVTOPTC_PLUS_4601
		custom_tooltip = { text = "PLUS_4601C_hover_ctt" }
		scaled_wealth = { value = -0.25 max = -50 }
		hidden_tooltip = { 
			set_character_flag = jd_feast_roasted_milk
			character_event = { id = Plus.4602 }
		}
	}
	option = { # Meat 'Balls', actually testicles
		trigger = { trait = lunatic }
		name = EVTOPTD_PLUS_4601
		tooltip_info = lunatic
		custom_tooltip = { text = "PLUS_4601D_hover_ctt" }
		scaled_wealth = { value = -0.05 max = -10 }
		hidden_tooltip = { 
			set_character_flag = jd_feast_balls
			character_event = { id = Plus.4602 }			
		}
	}
}

character_event = { # Plan the primary dish
	id = Plus.4602
	desc = EVTDESC_PLUS_4602
	picture = GFX_evt_feast
	
	is_triggered_only = yes
	
	option = { # Poultry
		name = EVTOPTA_PLUS_4602
		custom_tooltip = { text = "PLUS_4602A_hover_ctt" }
		scaled_wealth = { value = -0.3 max = -60 }
		hidden_tooltip = { 
			set_character_flag = jd_feast_poultry
			character_event = { id = Plus.4603 }			
		}
	}
	option = { # Cattle
		name = EVTOPTB_PLUS_4602
		custom_tooltip = { text = "PLUS_4602B_hover_ctt" }
				scaled_wealth = { value = -0.4 max = -80 }
		hidden_tooltip = { 
			set_character_flag = jd_feast_cattle
			character_event = { id = Plus.4603 }			
		}
	}
	option = { # Pig
		name = EVTOPTC_PLUS_4602
		custom_tooltip = { text = "PLUS_4602C_hover_ctt" }
		scaled_wealth = { value = -0.35 max = -70 }
		hidden_tooltip = { 
			set_character_flag = jd_feast_pig
			character_event = { id = Plus.4603 }			
		}
	}
	option = { # Horse-on-the-spit
		trigger = { trait = lunatic }
		name = EVTOPTD_PLUS_4602
		tooltip_info = lunatic
		custom_tooltip = { text = "PLUS_4602D_hover_ctt" }
		scaled_wealth = { value = -0.1 max = -20 }
		hidden_tooltip = { 
			set_character_flag = jd_feast_horse
			character_event = { id = Plus.4603 }			
		}
	}
}

character_event = { # Send off the feast and wait for the reaction
	id = Plus.4603
	desc = EVTDESC_PLUS_4603
	picture = GFX_evt_feast
	
	is_triggered_only = yes
	
	option = { # Send the feast off
		name = EVTOPTA_PLUS_4603
		custom_tooltip = { text = "PLUS_4603A_hover_ctt" }
		hidden_tooltip = {
			save_event_target_as = jd_feast_holder
			offmap_china = {
				governor = {
					character_event = { id = Plus.4604 } # Hidden bounce event
				}
			}
		}
	}
	option = {	# This would allow a player to back out into a regular feast if they'd rather do that. 
		name = EVTOPTB_PLUS_4603
		custom_tooltip = { text = "PLUS_4603B_hover_ctt" }
		hidden_tooltip = {
			clr_character_flag = held_jd_feast	# Not a part of clear_jd_feast_flags_effect as you don't
												# normally want to clear it unless backing out
			clear_jd_feast_flags_effect = yes 
			
			# Clone of 0_feast in minor_decisions.txt, effect portion
			set_character_flag = planning_feast
			hidden_tooltip = {
				character_event = { id = 72109 }
			}
			if = {
				limit = {
					has_dlc = "Reapers"
				}
				custom_tooltip = {
					text = capital_prospers_custom_tooltip
					hidden_tooltip = {
						capital_scope = {
							change_variable = { which = prosperity_value value = 8 }
						}
					}
				}
			}
		}
	}
}

character_event = { # The reaction to the menu as a hidden bounce event
					# ROOT is, in this event, the Jade Emperor
					# jd_feast_holder is the original character
	id = Plus.4604
	
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		event_target:jd_feast_holder = {
			random_list = {
				30 = { # Good Outcome
					modifier = {
						factor = 1.1
						OR = { # These are fairly standard fares
							has_character_flag = jd_feast_pig
							has_character_flag = jd_feast_poultry
						}
					}
					modifier = {
						factor = 1.2
						has_character_flag = jd_feast_salmon
					}
					modifier = {
						factor = 1.3
						has_character_flag = jd_feast_cattle
					}
					set_character_flag = jd_feast_good
				}
				40 = { # Neutral Outcome
					set_character_flag = jd_feast_neutral
				}
				30 = { # Bad Outcome
					modifier = {
						factor = 1.1
						OR = { # Dairy products are probably not ideal for East Asians
							has_character_flag = jd_feast_roasted_milk
							has_character_flag = jd_feast_cheese_eggs
						}
					}
					modifier = {
						factor = 1.3
						has_character_flag = jd_feast_horse
					}
					modifier = {
						factor = 1.2
						has_character_flag = jd_feast_balls
					}
					set_character_flag = jd_feast_bad
				}
			}
			event_target:jd_feast_holder = { narrative_event = { id = Plus.4605 days = 30 } }
		}
	}
}

narrative_event = {
	id = Plus.4605
	title = EVTNAME_PLUS_4605
	desc = {
		trigger = { # Great Response
			has_character_flag = jd_feast_good
		}
		text = EVTDESCA_PLUS_4605
	}
	desc = {
		trigger = { # Lukewarm response
			has_character_flag = jd_feast_neutral
		}
		text = EVTDESCB_PLUS_4605
	}
	desc = {
		trigger = { # Picky emperor to blame
			has_character_flag = jd_feast_bad
			NOR = {
				has_character_flag = jd_feast_balls
				has_character_flag = jd_feast_horse
			}
		}
		text = EVTDESCC_PLUS_4605
	}
	desc = {
		trigger = {
			has_character_flag = jd_feast_bad
			OR = { # Disgusting menu option to blame
				has_character_flag = jd_feast_balls
				has_character_flag = jd_feast_horse
			}
		}
		text = EVTDESCD_PLUS_4605
	}
	picture = GFX_evt_feast
	
	is_triggered_only = yes
	
	option = { # Good
		trigger = { has_character_flag = jd_feast_good }
		name = EVTOPTA_PLUS_4605
		
		sound_effect = china_grace_gain

		add_offmap_currency = {
			offmap = offmap_china
			value = 250
		}		
		hidden_tooltip = { clear_jd_feast_flags_effect = yes }
	}

	option = { # Neutral
		trigger = { has_character_flag = jd_feast_neutral }
		name = EVTOPTB_PLUS_4605
		
		hidden_tooltip = { clear_jd_feast_flags_effect = yes }
	}
	
	option = { # Bad
		trigger = { has_character_flag = jd_feast_bad }
		name = EVTOPTC_PLUS_4605

		add_offmap_currency = {
			offmap = offmap_china
			value = -100
		}		
		hidden_tooltip = { clear_jd_feast_flags_effect = yes }
	}
}