
namespace = regula_forge_inheritance_outcome

##################################
# MAINTENANCE EVENTS 0000 - 0099
##################################

# Go or no go?
regula_forge_inheritance_outcome.0001 = { 
	type = character_event
	title = regula_forge_inheritance_outcome.0001.t
	desc = {
		desc = regula_forge_inheritance_outcome.0001.desc
		first_valid = {
			triggered_desc = {
				trigger = { scope:scheme.scheme_success_chance >= 60 }
				desc = regula_forge_inheritance_outcome.0001.positive.desc
			}
			desc = regula_forge_inheritance_outcome.0001.negative.desc
		}
	}
	theme = regula_theme
	override_background = {
		event_background = courtyard
	}
	# left_portrait = scope:target
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}

	immediate = {
		save_scope_value_as = {
			name = forgery_type
			value = flag:xena
		}
	}

	option = {
		name = regula_forge_inheritance_outcome.0001.a
		custom_tooltip = regula_forge_inheritance_outcome.0001.a.tt
		trigger_event = regula_forge_inheritance_outcome.0005 #Do the rolls!

		stress_impact = {
			craven = minor_stress_impact_gain
		}
	}

	option = {
		name = regula_forge_inheritance_outcome.0001.b
		stress_impact = {
			ambitious = minor_stress_impact_gain
		}
		scope:scheme = {
			end_scheme = yes
		}
	}
}


regula_forge_inheritance_outcome.0002 = { 
	type = character_event
	title = regula_forge_inheritance_outcome.0002.t
	desc = {
		desc = regula_forge_inheritance_outcome.0002.desc
		first_valid = {
			triggered_desc = {
				trigger = { scope:scheme.scheme_success_chance >= 60 }
				desc = regula_forge_inheritance_outcome.0002.positive.desc
			}
			desc = regula_forge_inheritance_outcome.0002.negative.desc
		}
	}
	theme = regula_theme
	override_background = {
		event_background = courtyard
	}
	# left_portrait = scope:target
	widget = {
		gui = "event_window_widget_scheme"
		container = "custom_widgets_container"
	}

	immediate = {
		save_scope_value_as = {
			name = forgery_type
			value = flag:calf
		}
	}

	option = {
		name = regula_forge_inheritance_outcome.0002.a
		custom_tooltip = regula_forge_inheritance_outcome.0002.a.tt
		trigger_event = regula_forge_inheritance_outcome.0005 #Do the rolls!

		stress_impact = {
			craven = minor_stress_impact_gain
		}
	}

	option = {
		name = regula_forge_inheritance_outcome.0002.b
		stress_impact = {
			ambitious = minor_stress_impact_gain
		}
		scope:scheme = {
			end_scheme = yes
		}
	}
}


#Rolls success and discovery, and triggers on_actions (or sends "player's choice" event)
regula_forge_inheritance_outcome.0005 = {
	type = character_event

	hidden = yes

	immediate = {
		#SUCCESS ROLL
		random = {
			chance = scope:scheme.scheme_success_chance

			save_scope_value_as = {
				name = scheme_successful
				value = yes
			}
		}

		#DISCOVERY ROLL
		save_scope_value_as = {
			name = discovery_chance
			value = {
				value = 100
				subtract = scope:scheme.scheme_secrecy
			}
		}

		random = {
			chance = scope:discovery_chance
			save_scope_value_as = {
				name = scheme_discovered
				value = yes
			}
		}

		if = {
			limit = {
				exists = scope:scheme_successful
			}
			trigger_event = {
				on_action = regula_forge_inheritance_law_success
			}
		}
		else = {
			trigger_event = {
				on_action = regula_forge_inheritance_law_fail
			}
		}
	}
}

#################
# SUCCESS EVENTS
# 1000-1999
#################

#Success - Warrior Princesses
regula_forge_inheritance_outcome.1000 = {
	type = character_event
	title = regula_forge_inheritance_outcome.1000.t
	desc = regula_forge_inheritance_outcome.1000.desc

	theme = regula_theme 
	override_background = {
		event_background = council_chamber
	}
	right_portrait = {
		character = scope:target
		animation = disbelief
	}
	
	trigger = {
		scope:forgery_type = flag:xena
	}

	immediate = {
		scope:target = {
			regula_forge_inheritance_law_success_effect = yes
		}
	}

	option = {
		name = regula_forge_inheritance_outcome.1000.a
	}

	
	after = {
		scope:target = {
			trigger_event = seduce_outcome.3301
		}
		show_as_tooltip = {
			scope:scheme = {
				end_scheme = yes
			}
		}
	}
}

#Success - Dark future
regula_forge_inheritance_outcome.1001 = {
	type = character_event
	title = regula_forge_inheritance_outcome.1001.t
	desc = regula_forge_inheritance_outcome.1001.desc

	theme = regula_theme 
	override_background = {
		event_background = council_chamber
	}
	right_portrait = {
		character = scope:target
		animation = disbelief
	}

	trigger = {
		scope:forgery_type = flag:calf
	}
	
	immediate = {
		scope:target = {
			regula_forge_inheritance_law_success_effect = yes
		}
	}

	option = {
		name = regula_forge_inheritance_outcome.1001.a
	}

	
	after = {
		scope:target = {
			trigger_event = seduce_outcome.3301
		}
		show_as_tooltip = {
			scope:scheme = {
				end_scheme = yes
			}
		}
	}
}


#####################################
# FAILURE EVENTS 2001 - 2999
#####################################

#Warrior Princesses
regula_forge_inheritance_outcome.2000 = {
	type = character_event
	title = regula_forge_inheritance_outcome.2000.t
	desc = regula_forge_inheritance_outcome.2000.desc
	theme = regula_theme

	override_background = {
		event_background = council_chamber
	}
	left_portrait = {
		character = scope:target
		animation = anger
	}

	trigger = {
		scope:forgery_type = flag:xena
	}

	immediate = {
		add_prestige = -250
	}

	option = {
		name = regula_forge_inheritance_outcome.2000.a

	}
	
	after = {
		scope:target = {
			trigger_event = seduce_outcome.3301
		}
		show_as_tooltip = {
			scope:scheme = {
				end_scheme = yes
			}
		}
	}
}

#Dark Future
regula_forge_inheritance_outcome.2001 = {
	type = character_event
	title = regula_forge_inheritance_outcome.2001.t
	desc = regula_forge_inheritance_outcome.2001.desc
	theme = regula_theme

	override_background = {
		event_background = council_chamber
	}
	left_portrait = {
		character = scope:target
		animation = anger
	}

	trigger = {
		scope:forgery_type = flag:calf
	}

	immediate = {
		add_prestige = -250
	}

	option = {
		name = regula_forge_inheritance_outcome.2001.a

	}
	
	after = {
		scope:target = {
			trigger_event = seduce_outcome.3301
		}
		show_as_tooltip = {
			scope:scheme = {
				end_scheme = yes
			}
		}
	}
}
