##############################################
#
# Ancient Religions Reborn
# - Mysteries of Dionysus
#
# Event Ids: dionysus.0 - 3299 reserved
##############################################

namespace = dionysus

####################
## Society events ##
####################
# dionysus.0 - 3249

# ask to join society
character_event = {
	id = dionysus.0
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		FROM = { leader = { society_member_of = mysteries_dionysus } }
	}

	immediate = {
		FROM = { leader = { character_event = { id = dionysus.1 } } }
	}
}

# bounce invite off leader
character_event = {
	id = dionysus.1
	hide_window = yes

	is_triggered_only = yes

	immediate = { # bounce it back
		FROM = { character_event = { id = dionysus.2 } }
	}
}

# ask if they are ready for the initiation
# FROM is society leader
character_event = {
	id = dionysus.2
	desc = dionysus.2.desc
	picture = GFX_evt_Whispering_in_ear

	is_triggered_only = yes

	option = { # i'm ready
		name = dionysus.2.a
		custom_tooltip = {
			text = dionysus.2.tooltip
			hidden_tooltip = {
				character_event = { id = dionysus.3 }
			}
		}
	}

	option = { # on second thought...
		name = dionysus.2.b
	}
}

#####################
## Dionysia events ##
#####################
# dionysus.50 - 3299

character_event = {
	id = dionysus.50
	desc = dionysus.50.desc
	picture = GFX_evt_roman_temple

	is_triggered_only = yes

	option = { # invitations have been sent!
		name = dionysus.50
		hidden_tooltip = {
			character_event = { id = dionysus.52 days = 5 } # Dionysia start
			clr_character_flag = dionysia_has_ended
			any_realm_character = {
				limit = {
					age = 16
					NOT = { trait = incapable }
					prisoner = no
				}
				clr_character_flag = dionysia_has_ended
				character_event = { id = 88250 }
			}
			any_dynasty_member = {
				limit = { 
					ai = no
					NOT = { character = ROOT }
				}
				character_event = { id = 88300 }
			}
		}
	}
}

# Invitation
character_event = {
	id = dionysus.51
	title = dionysus.51.title
	desc = dionysus.51
	picture = GFX_evt_market

	is_triggered_only = yes

	trigger = { NOT = { is_inaccessible_trigger = yes } }

	option = {
		name = dionysus.51
		ai_chance = {
			factor = 100
		}
		prestige = 50
		set_character_flag = attending_dionysia
		hidden_tooltip = { character_event = { id = 3299 days = 90 } } # safety catch flag-clearing
		
	}
	option = {
		name = dionysus.51
		ai_chance = {
			factor = 0.1
			modifier = {
				factor = 100
				NOT = { religion_openly_in_hellenic_subgroup_trigger = yes }
			}
			modifier = {
				factor = 100
				NOT = { true_religion_in_hellenic_subgroup_trigger = yes }
			}
		}
		prestige = -100
	}
}

# Dionysia start
character_event = {
	id = dionysus.52
	desc = dionysus.52.desc
	picture = GFX_evt_market

	is_triggered_only = yes

	option = {

	}
}

###########################################
# Flag management                         #
###########################################

# Safety catch - clears character flags and modifiers
character_event = {
	id = 3299

	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		clr_character_flag = do_not_disturb
		clr_character_flag = holding_dionysia
	}
}