﻿custom_on_action_imprison =
{
	random_events =
	{
		90 = 0
		10 = ip_generic.14
	}
}

passover_supported_characters_pulse = 
{
	trigger = {
		has_civil_war = yes
		any_character = {
			is_ruler = no
			has_variable = successor_support_ci
		}
	}
	effect = {
		random_country = {
			limit = {
				civil_war_with = root
			}
			save_scope_as = this_one
		}
		every_character = {
			limit = {
				is_ruler = no
				has_variable = successor_support_ci
			}
			remove_all_positions = yes
			move_country = scope:this_one
		}
	}
}

on_republic_reign_ending = {
	trigger = {
		is_republic = yes
	}
	effect = {
		clear_party_agenda_cooldown_var_effect = yes
		every_party = {
			pick_random_agenda = yes
		}
	}
}

on_republic_ruler_change = {
	trigger = {
		is_republic = yes
		exists = current_ruler.character_party
	}
	effect = {
		switch = {
			trigger = has_co_ruler_government
			no = {
				every_party = {
					limit = {
						NOT = { this = root.current_ruler.character_party }
					}
					ROOT = {
						add_party_approval = {
							party = PREV
							value = party_disapproval_medium_svalue
						}
					}
				}
			}
			yes = {
				every_party = {
					limit = {
						NOT = { this = root.current_ruler.character_party }
					}
					ROOT = {
						add_party_approval = { #For the losing party + co rulers party.
							party = PREV
							value = party_disapproval_small_svalue
						}
					}
				}
			}
		}
	}
	random_events = {
		20 = ip_republic.64
		20 = ip_republic.65
		20 = 0
	}
}

disloyal_powerful_characters_pulse = {
	trigger = {
		is_ai = no
		NOR = {
			has_variable = disloyal_powerful_characters_pulse_cd
			has_variable = death_to_tyrants_flag
		}
	}
	effect = {
		set_variable = {
			name = disloyal_powerful_characters_pulse_cd
			days = 2120
		}
	}
	random_events = {
		50 = 0
		10 = pbc_event.1
		10 = pbc_event.4
		10 = pbc_event.5
		10 = pbc_event.6
		10 = pbc_event.7
		10 = pbc_event.8
		10 = pbc_event.10
		10 = pbc_event.11
		10 = pbc_event.12
	}
}

custom_on_great_battle_commander = {
	random_events = {
		600 = 0
		5 = after_battle.10 #Disaster!
		10 = after_battle.9 #Aggressive
		10 = after_battle.8 #Steadfast
		10	= after_battle.7 #Disciplined		
		10	= after_battle.6 #Tactician		
		10	= after_battle.5 #Confident	
		10	= after_battle.3 #Conqueror		
		10  = after_battle.1 #Victorious Trait
		10 = after_battle.21 # Pompey Ships
		10 = after_battle.22 # Pompey Admiral
		10 = after_battle.23 # Pompey Daring
		10 = after_battle.24 # Pompey Tough
		10 = after_battle.25 # Pompey Brave/Coward
		10 = after_battle.26 # Pompey Victorious
		10 = after_battle.28 # Pompey Reckless
	}
	events = {
		
	}
	on_actions = {
		nickname_from_battle
	}
}

nickname_from_battle = {
	random_events = {
		40 = 0
		8 = nicknames.1
		8 = nicknames.2
		8 = nicknames.3
		8 = nicknames.4
		8 = nicknames.5
		8 = nicknames.6
		8 = nicknames.7
		8 = nicknames.8
		8 = nicknames.9
		8 = nicknames.10
		8 = nicknames.11
		8 = nicknames.12
		8 = nicknames.13
		8 = nicknames.14
		8 = nicknames.15
		8 = nicknames.16
		8 = nicknames.17
		8 = nicknames.18
		8 = nicknames.19
		8 = nicknames.20
		8 = nicknames.21
		8 = nicknames.22
		8 = nicknames.23
		8 = nicknames.24
		8 = nicknames.25
		8 = nicknames.26
		8 = nicknames.27
		8 = nicknames.28
	}
}

custom_on_action_execute =
{
	random_events =
	{
		95 = 0
	}
}

yuezhi_pulse = {
	trigger = {
		NOR = {
			tag = KHN
			tag = YZI
		}
	}
	events = {
		yuezhi.3
	}
	random_events = {
		100 = yuezhi.1
		20 = yuezhi.2
		20 = yuezhi.4
		100 = 0
	}
}

custom_on_action_sacrifice =
{
	random_events =
	{
		
		
	}
}

claims_pulse = {
	events = {
		dhe_rome.16
		dhe_rome.17
		dhe_rome.18
	}
}

yearly_debt_recovery_pulse = {
	trigger = {
		has_character_modifier = debt_payoff_toggle
	}
	effect = {
		if = {
			limit = {
				wealth < 0
			}
			add_gold = 60
		}
		else = {
			remove_character_modifier = debt_payoff_toggle
			employer = {
				release_prisoner = {
					target = root
				}
			}
			add_loyalty = debt_paid_off
			add_character_modifier = {
				name = debt_paid_off
				duration = 730
			}
		}
	}
}




dictatorship_power_held_pulse = {
	trigger = {
		has_country_modifier = electoral_extension_mod
	}
	random_events = {
		80 = 0
		10 = ip_republic.35
		10 = ip_republic.37
	}
}

plot_outcome_rep_37 = {
	trigger = {
		current_ruler = {
			OR = {
				has_variable = dictator_holding_power
				employer = { has_law = republican_election_4 }
				employer = { has_law = princeps_civitatis }
			}
		}
	}
	random_events = {
		5 = ip_republic.38
		15 = ip_republic.39
	}
}

plot_outcome_mon_15 = {
	random_events = {
		5 = ip_monarchy.16
		15 = ip_monarchy.17
	}
}

plot_outcome_mon_18 = {
	random_events = {
		5 = ip_monarchy.19
		15 = ip_monarchy.20
	}
}

plot_outcome_mon_27 = {
	random_events = {
		5 = ip_monarchy.28
		15 = ip_monarchy.29
	}
}

plot_events_early = {
	random_events = {
		10 = ip_monarchy.3
		10 = ip_monarchy.6
	}
	fallback = plot_events_intermediary
}

plot_events_intermediary = {
	random_events = {
		10 = ip_monarchy.7
		10 = ip_monarchy.8
		10 = ip_monarchy.9
		10 = ip_monarchy.10
	}
	fallback = plot_events_final
}

plot_events_final = {
	random_events = {
		10 = ip_monarchy.12
	}
	fallback = plot_events_fallback
}

pretenders_battling = {
	random_events = {
		10 = ip_monarchy.11
	}
	fallback = plot_events_fallback
}

plot_events_fallback = {
	events = {
		ip_monarchy.5
	}
}

olympic_country_pulse = {
	trigger = {
		owns = 439
	}
	effect = {
		if = {
			limit = {
				p:439 = {
					NOT = {
						has_province_modifier = olympic_games_modifier
					}
				}
			}
			p:439 = {
				add_permanent_province_modifier = {
					name = olympic_games_modifier
					duration = -1
				}
			}
		}
	}
}

main_event_pulse_country = {
	trigger = {
		num_of_cities >= 1
		NOR = {
			tag = REB
			tag = BAR
			has_variable = ongoing_mission_pulse_flag
		}
	}
	events = {
		dhe_roman_warm_period.1
		dhe_bactria.3
		dhe_buddhism.2
		flavor_arm.5
		dhe_carthage.15
		diadochi_flavor.100
		dhe_mithridates.8 # Mithridates heritage choice
		me_macedon_2_mastery.63 # Vibrant periodic event
		me_macedon_2_mastery.83 # Oracular periodic event
		dhe_mithridates.5 # Mithridates demands Pontus
	}
	random_events = {
		500 = 0
		#Necromancy Events
		100 = rel_flavor_undead_pantheon.1
		100 = rel_flavor_undead_pantheon.2
		100 = rel_flavor_undead_pantheon.3
		100 = rel_flavor_undead_pantheon.4
		100 = rel_flavor_undead_pantheon.5
		#Vanilla
		100 = comet.5
		250 = character_events.27 # Ruler religion switch
		250 = character_events.25 # Heir religion switch
		250 = character_events.26 # Heir culture switch
		100 = ip_monarchy.1 #Monarchy Event Plot Etc.
		100 = ip_monarchy.2
		75 = ip_monarchy.13
		100 = ip_monarchy.15 
		100 = ip_monarchy.18
		100 = stability.1 #Stability Events
		100 = stability.2
		100 = stability.3
		100 = stability.4
		100 = stability.5
		100 = stability.6
		100 = stability.7
		100 = stability.8
		100 = stability.9
		100 = stability.10
		100 = architect.1 #Architect Events
		100 = architect.2
		100 = architect.3
		100 = architect.4
		100 = office.2
		100 = office.3
		100 = character_events.3 #Character Events
		100 = ip_generic.6 #Internal Politics Events
		200 = ip_generic.7
		100 = ip_republic.8
		100 = ip_generic.19 #Add traderoute oneshot
		100 = ip_generic.21 #Bad farmlands event
		200 = ip_generic.15 #War Exhaustion Events
		200 = ip_generic.17
		200 = ip_generic.18
		100 = city.1 #City/Province Events
		100 = city.2
		100 = city.3
		100 = city.4
		100 = city.5
		100 = city.6
		100 = city.7
		100 = city.8
		100 = city.9
		30 = city.10
		100 = city.11
		100 = city.12
		100 = city.13
		100 = city.15
		100 = city.16
		100 = city.17 #City Rivalry Events
		100 = city.19
		100 = city.20
		100 = ip_republic.20
		100 = ip_republic.21 #Commander Loyalty/Disloyalty Events
		100 = ip_republic.22
		100 = commander_loyalty.1
		100 = commander_loyalty.2
		100 = commander_loyalty.3
		100 = tribal_pol.1 # Tribal Politics Events
		100 = tribal_pol.2
		100 = tribal_pol.3
		100 = tribal_pol.4
		100 = tribal_pol.5
		100 = tribal_pol.6
		100 = tribal_pol.7
		100 = tribal_pol.8
		100 = tribal_pol.9
		100 = tribal_pol.10
		100 = tribal_pol.11
		100 = tribal_pol.12
		100 = tribal_pol.13
		100 = tribal_pol.14
		100 = tribal_pol.15
		100 = tribal_pol.16
		100 = tribal_pol.17
		100 = tribal_pol.22
		100 = tribal_pol.23
		100 = tribal_pol.25
		100 = tribal_pol.26
		100 = tribal_pol.27
		100 = tribal_pol.28
		100 = tribal_pol.29
		100 = tribal_pol.30
		100 = tribal_pol.31
		100 = tribal_pol.32
		100 = tribal_pol.33
		100 = tribal_pol.34
		100 = tribal_pol.36
		100 = tribal_pol.37
		100 = tribal_pol.38
		100 = tribal_flavour_events.1
		40 = ip_republic.25 #Law support events
		40 = ip_republic.26
		40 = ip_republic.27
		40 = ip_republic.28
		40 = ip_republic.29
		40 = ip_republic.30
		100 = monarchy_events.1
		100 = monarchy_events.2
		100 = monarchy_events.6
		100 = monarchy_events.7
		100 = monarchy_events.8
		100 = monarchy_events.9
		100 = monarchy_events.10
		100 = monarchy_events.11
		100 = monarchy_events.12
		100 = monarchy_events.13
		100 = monarchy_events.14
		100 = monarchy_events.15
		100 = monarchy_events.16
		100 = monarchy_events.17
		100 = monarchy_events.20
		100 = monarchy_events.24
		100 = monarchy_events.25
		100 = monarchy_events.27
		100 = monarchy_events.38
		30 = monarchy_events.39
		100 = monarchy_events.40
		100 = monarchy_events.41
		100 = monarchy_events.44
		100 = monarchy_events.45
		100 = ip_republic.40
		100 = ip_republic.41
		20 = rel_flavor_hellenic.1 # Rel Flavor Hellenic
		25 = rel_flavor_hellenic.3
		50 = rel_flavor_hellenic.6
		50 = rel_flavor_hellenic.7
		40 = rel_flavor_hellenic.8
		20 = rel_flavor_hellenic.9
		50 = rel_flavor_hellenic.10
		10 = rel_flavor_hellenic.11
		50 = rel_flavor_hellenic.14
		100 = rel_flavor_hellenic.15
		20 = rel_flavor_hellenic.16
		100 = rel_flavor_canaanite.1 # Rel Flavor Canaanite
		100 = rel_flavor_canaanite.2
		100 = rel_flavor_canaanite.3
		100 = rel_flavor_canaanite.4
		100 = rel_flavor_canaanite.5
		100 = rel_flavor_canaanite.6
		15 = rel_flavor_canaanite.7
		100 = rel_flavor_canaanite.8
		100 = rel_flavor_canaanite.9
		100 = rel_flavor_canaanite.10
		100 = rel_flavor_druidic.1 # Rel Flavor Druidic
		100 = rel_flavor_druidic.2
		100 = rel_flavor_druidic.3
		100 = rel_flavor_druidic.4
		100 = rel_flavor_druidic.5
		100 = rel_flavor_druidic.6
		100 = rel_flavor_druidic.7
		100 = rel_flavor_druidic.8
		100 = rel_flavor_druidic.9
		100 = rel_flavor_druidic.12
		100 = rel_flavor_kemetic.1 # Rel Flavor Kemetic
		100 = rel_flavor_kemetic.2
		100 = rel_flavor_kemetic.3
		100 = rel_flavor_kemetic.4
		100 = rel_flavor_kemetic.5
		100 = rel_flavor_cybelene.1 # Rel Flavor Cybelene
		100 = rel_flavor_cybelene.2
		100 = rel_flavor_cybelene.3
		50 = rel_flavor_cybelene.4
		100 = rel_flavor_cybelene.5
		100 = rel_flavor_zoro.1 # Rel Flavor Zoroastrian
		100 = rel_flavor_zoro.2
		100 = rel_flavor_zoro.3
		100 = rel_flavor_zoro.4
		100 = rel_flavor_zoro.5
		100 = rel_flavor_eastern.1 # Rel Flavor Eastern
		100 = rel_flavor_eastern.2
		100 = rel_flavor_eastern.3
		100 = rel_flavor_eastern.4
		20 = rel_flavor_eastern.5
		100 = rel_flavor_northern.1 # Rel Flavor Northern
		100 = rel_flavor_northern.2
		100 = rel_flavor_northern.3
		100 = rel_flavor_northern.4
		100 = rel_flavor_northern.5
		100 = rel_flavor_hindu.1 # Rel Flavor Hindu
		100 = rel_flavor_hindu.2
		100 = rel_flavor_hindu.3
		100 = rel_flavor_hindu.4
		100 = rel_flavor_hindu.5
		100 = rel_flavor_buddhist.1 # Rel Flavor Buddhist 
		100 = rel_flavor_buddhist.2
		100 = rel_flavor_buddhist.3
		3 = rel_flavor_buddhist.4
		100 = rel_flavor_arabian.1 # Rel Flavor Arabian
		100 = rel_flavor_arabian.2
		100 = rel_flavor_arabian.3
		100 = rel_flavor_arabian.4
		100 = rel_flavor_arabian.5
		100 = rel_flavor_judaism.1 # Rel Flavor Judaism
		100 = rel_flavor_judaism.2
		100 = rel_flavor_judaism.3 
		100 = rel_flavor_judaism.4
		100 = rel_flavor_judaism.5
		100 = rel_flavor_thracian.1 # Rel Flavor Thracian
		100 = rel_flavor_thracian.2
		100 = rel_flavor_thracian.3
		100 = rel_flavor_thracian.4
		100 = rel_flavor_thracian.5
		50 = dhe_museion.20 # Recurring Events Museion
		50 = dhe_museion.21
		100 = dhe_museion.22
		50 = dhe_fortune_cult.1 # Cult of Fortune
		50 = dhe_fortune_cult.2
		50 = dhe_fortune_cult.3
		10 = dhe_fortune_cult.4
		50 = dhe_isis_cult.1 # Isis Cult
		50 = dhe_isis_cult.2
		50 = dhe_isis_cult.3
		30 = dhe_isis_cult.4
		50 = dhe_isis_cult.5
		50 = dhe_isis_cult.6
		100 = dhe_buddhism.1 # Buddhism event
		100 = dhe_jainism.1 # Jainism event
		200 = character_events.6
		200 = character_events.7
		100 = country_diplomacy.1 # Country Diplomacy Events
		100 = country_diplomacy.2
		100 = country_diplomacy.3
		100 = country_diplomacy.4
		100 = country_diplomacy.9
		100 = country_diplomacy.10
		100 = country_diplomacy.12
		100 = country_diplomacy.13
		100 = country_diplomacy.16
		100 = country_diplomacy.19
		100 = country_diplomacy.20
		100 = country_diplomacy.28
		100 = country_diplomacy.30
		500 = dhe_judea.1
		500 = dhe_judea.6
		500 = dhe_judea.8
		100 = ip_republic.43
		50 = dhe_body.7
		50 = dhe_body.8
		50 = dhe_body.9
		500 = dhe_dde_pyrrhus.11
		100 = dhe_dde_pyrrhus.15
		100 = p_actor.1
		100 = dhe_bactria.1
		150 = dhe_bactria.2
		25 = ip_republic.44
		50 = ip_republic.45 # marius
        ### Diplomacy
        50 = dip_friends_rivals.1
        50 = dip_friends_rivals.3
        50 = dip_friends_rivals.5
        50 = dip_friends_rivals.7
        50 = dip_friends_rivals.9
        50 = dip_friends_rivals.10
        50 = dip_friends_rivals.11
        50 = dip_friends_rivals.12
        50 = dip_friends_rivals.13
        50 = dip_friends_rivals.14
        50 = dip_friends_rivals.15
        50 = dip_friends_rivals.17
        50 = dip_friends_rivals.19
		### Digital Deluxe Edition ###
		100 = dde_hellenistic.1
		100 = dde_hellenistic.2
		100 = dde_hellenistic.3
		100 = dde_hellenistic.4
		100 = dde_hellenistic.5
		100 = dde_hellenistic.6
		###Misc and CL
		100 = commander_loyalty.10
		100 = city.22
		#ROME DHE
		400 = dhe_rome.1
		400 = dhe_rome.2
		400 = dhe_rome.3
		400 = dhe_rome.4
		400 = dhe_rome.5
		400 = dhe_rome.6
		400 = dhe_rome.7
		400 = dhe_rome.8
		#CARTHAGE DHE
		400 = dhe_carthage.1
		400 = dhe_carthage.2
		400 = dhe_carthage.3
		400 = dhe_carthage.5
		400 = dhe_carthage.9
		400 = dhe_carthage.13
		400 = dhe_carthage.14
		#SLAVE DHE
		100 = dhe_slave.1
		100 = dhe_slave.2
		100 = dhe_slave.3
		100 = dhe_slave.4
		100 = dhe_slave.5
		100 = dhe_slave.6
		100 = dhe_slave.7
		100 = dhe_slave.8
		# 1.1.0
		50 = roman_flavor.8
		# CO-CONSUL
		250 = ip_republic.49
		250 = ip_republic.52
		250 = ip_republic.55
		250 = ip_republic.58
		250 = ip_republic.61
		# IP_MONARCHY
		250 = ip_monarchy.27
		250 = ip_monarchy.30
		250 = ip_monarchy.34
		250 = ip_monarchy.35
		150 = ip_monarchy.36
		# CONSORT
		300 = ip_monarchy.42
		300 = ip_monarchy.48
		300 = ip_monarchy.54
		300 = ip_monarchy.59
		300 = ip_monarchy.64
		# DHE Iberia
		500 = dhe_iberia.14
		# DHE MASSALIA
		300 = dhe_massalia.1
		800 = dhe_massalia.5
		300 = dhe_massalia.10
		600 = dhe_massalia.13
		# FOOD EVENTS
		150 = food_events.1
		150 = food_events.2
		150 = food_events.3
		150 = food_events.4
		200 = food_events.5
		150 = food_events.6
		150 = food_events.7
		150 = food_events.8
		200 = food_events.9
		150 = food_events.10
		200 = food_events.11
		150 = food_events.12
		25 = food_events.13
		150 = food_events.14
		150 = food_events.15
		150 = food_events.16
		150 = food_events.17
		# DHE Armenia
		500 = flavor_arm.3
		500 = flavor_arm.4
		# PIRATE EVENTS
		100 = pirate_events.1
		100 = pirate_events.4
		# THRACE EVENTS
		500 = dhe_thrace_flavor.1
		1000 = dhe_thrace_flavor.2
		1000 = dhe_thrace.1
		1000 = dhe_thrace.8
		500 = dhe_thrace.9
		# CYR Events
		1000 = flavor_egy.12
		# me gre 2 convince events
		250 = me_greek_2_greece.30
		500 = me_greek_2_greece.31
		# Deity Flavor events
		50 = deity_flavor.1
		50 = deity_flavor.2
		50 = deity_flavor.4
		50 = deity_flavor.5
		### Senate Rework ###
		# Party Events Roman
		50 = party_events_rome.1
		50 = party_events_rome.2
		50 = party_events_rome.3
		50 = party_events_rome.4
		50 = party_events_rome.5
		50 = party_events_rome.6
		# Party Events Default
		50 = party_events_default.1
		50 = party_events_default.4
		50 = party_events_default.5
		50 = party_events_default.6
		50 = party_events_default.7
		50 = party_events_default.10
		# OLIGARCHS
		100 = ip_republic.66
		#Tribal Crisis
		200 = tribal_flavour_events.2
		#Mithridates
		300 = dhe_mithridates.9
		300 = distinction.6
		200 = monarchy_events.102
	}
}

monthly_guarantee_pulse = {
	trigger = {
		invention = tribute_income_modifier_inv_2
	}
	random_events = {
		1 = country_diplomacy.56
		239 = 0
	}
}

yearly_gambling_pulse = {
	events = {
		gambling.1
	}
}

yearly_disaster_pulse = {
	trigger = {
		num_of_cities >= 5
		current_date > 480.1.1
	}
	events = {

	}
	random_events = {
		1500 = 0
		4 = dhe_earthquake.1 # Minor Earthquake
		2 = dhe_earthquake.3 # Major Earthquake
		2 = dhe_volcano.1 # Volcano DHE
	}
}

befriend_pulse = {
	trigger = {
		has_variable = currently_befriending
		exists = var:currently_befriending
		var:currently_befriending = {
			has_variable = being_befriended
		}
	}
	random_events = {
		1 = befriend.1
		1 = befriend.2
		1 = befriend.3
		1 = befriend.4
		1 = befriend.5
		1 = befriend.6
	}
	
	fallback = befriend_fail
	
}

befriend_resolution = {
	random_events = {
		1 = befriend.7
		1 = befriend.8
	}
	fallback = befriend_end
}

befriend_end = {
	events = {
		befriend.9
	}
}

befriend_fail = {
	events = {
		befriend.8
	}
	fallback = befriend_end
}

yearly_subject_pulse = {
	trigger = {
		OR = {
			is_subject = yes
			is_overlord = yes
		}
	}
	events = {

	}

	random_events = {
		500 = 0
		100 = country_diplomacy.32
		100 = country_diplomacy.35
		100 = country_diplomacy.36
	}
}

prominent_actors_setup = {
	trigger = {
		NOR = {
			tag = REB
			tag = MER
			tag = PIR
		}
		has_land = yes
		any_character = {
			count < 5
			has_variable = prominent_actor
		}
	}
	
	effect = {
		while = {
			count = 5
			limit = {
				has_land = yes
				any_character = {
					count < 5
					has_variable = prominent_actor
				}
			}
			random_character = {
				limit = {
					NOR = {
						has_character_modifier = foreign_citizen
						has_variable = prominent_actor
					}
					is_ruler = no
					is_adult = yes
				}
				weight = {
					modifier = {
						factor = 100
						prominence >= 60
					}
					modifier = {
						factor = 1.5
						has_any_office = yes
					}
					modifier = {
						factor = 1.5
						has_any_office = yes
					}
					modifier = {
						factor = 1.5
						age >= 50
					}
					modifier = {
						factor = 0
						employer = {
							gender_equality = no
						}
						is_female = yes
					}
				}
				set_variable = {
					name = prominent_actor
					value = 1
				}
			}
		}
	}
}


commander_loyalty_demand_picker = {
	random_events = {
		10 = commander_loyalty.5
		10 = commander_loyalty.6
		10 = commander_loyalty.7
		10 = commander_loyalty.8
		10 = commander_loyalty.9
		50 = 0
	}
}

monthly_tarentum_war_pulse = {
	trigger = {
		exists = this
		NOT = { tag = EPI }
		country_culture_group = hellenic
		capital_scope = { 
			OR = {
				is_in_area = neapolis_area
				is_in_area = cannae_area
				is_in_area = tarentum_area
				is_in_area = heraclea_area
				is_in_area = croton_area
			}
		}
		any_countries_at_war_with = {
			OR = {
				tag = ROM
				AND = {
					capital_scope = {
						OR = {
							is_in_region = magna_graecia_region
							is_in_region = central_italy_region
							is_in_region = carthage_area
						}
					}
					any_owned_province = { is_in_region = magna_graecia_region }
					NOT = { country_culture_group = hellenic } 
				}
			}
			save_temporary_scope_as = rome_temp_scope
		}
	}
	effect = {
		trigger_event = {
			id = dhe_dde_pyrrhus.6
		}
	}
}

monthly_syracuse_war_pulse = {
	trigger = {
		exists = this
		tag = SYR
		war_with = CAR
	}
	effect = {
		trigger_event = {
			id = dhe_dde_pyrrhus.18
		}
	}
}

assassinate_setup = {
	random_events = {
		10 = assassinate.1
	}
	
	fallback = assassinate_fallback
}

assassinate_step_two = {
	random_events = {
		10 = assassinate.5
		10 = assassinate.6
	}
	
	fallback = assassinate_fallback
}

assassinate_preparations_being_made = {
	random_events = {
		10 = assassinate.7
	}
	
	fallback = assassinate_fallback
}

assassinate_result = {
	random_events = {
		10 = assassinate.8
	}
	
	fallback = assassinate_fallback
}

assassinate_fallback = {
	events = {
		assassinate.2
		assassinate.3
		assassinate.4
	}
}

yearly_general_unit_purchase_pulse = {
	trigger = {
		is_general = yes
		exists = employer
		employer = {
			war = no
		}
	}
	random_events = {
		100 = 0
	}
}

### Crisis Framework

yearly_crisis_start_pulse = {
	trigger = {
		num_of_cities > 200
		NOT = {
			has_variable = crisis_ongoing
		}
	}
	
	random_events = {
		1160 = 0
		40 = ip_republic.46
	}
	
}

mercenary_adventurer_pulse = {
	trigger = {
		is_mercenary = yes
		employer = {
			this = c:MER
		}
		has_variable = adventuring_from
		var:adventuring_from = {
			has_land = yes
		}
	}
	random_events = {
		50 = 0
		45 = character_events.41
		5 = character_events.42
		50 = character_events.45
		50 = character_events.46
	}
}

consul_conspiracy_pulse = {
	trigger = {
		tag = ROM
		any_character = {
			has_character_modifier = character_modifier_ambitious_politician
		}
	}

	random_events = {
		100 = 0
		30 = roman_flavor.2
		30 = roman_flavor.3
		30 = roman_flavor.4
	}
}

yearly_italian_flavor = {
	trigger = {
		current_date < 500.1.1
	}
	events = {
		italian_flavor.1 # Tarantine event chain
		italian_flavor.6 # Marsian Rebellion
		italian_flavor.11 # Frentani Fidelity
		italian_flavor.12 # Samnite Aggression
		italian_flavor.14 # Nucerian Trade
	}
}
dictator_rise_pulse = {
	trigger = {
		tag = ROM
		has_variable = rise_dictator_events
		is_republic = yes
		any_character = {
			has_character_modifier = character_modifier_ambitious_general
		}
	}

	random_events = {
		100 = 0
		30 = roman_flavor.9
		30 = roman_flavor.10
		30 = roman_flavor.11
	}
}

trial_step = {
	trigger = {
		exists = scope:target
		scope:target = {
			has_triggered_character_modifier = currently_on_trial
			is_alive = yes
		}
	}
	
	random_events = {
		10 = trial.2
		10 = trial.3
		10 = trial.4
		10 = trial.5
		6 = trial.6
		10 = trial.7
	}
	
}

trial_end = {
	trigger = {
		exists = scope:target
		scope:target = {
			has_triggered_character_modifier = currently_on_trial
			is_alive = yes
		}
	}
	
	events = {
		trial.8
	}
}

ip_mon_42_plot_early = {
	random_events = {
		10 = ip_monarchy.43
		10 = ip_monarchy.44
	}
	fallback = ip_mon_42_plot_late
}

ip_mon_42_plot_late = {
	events = {
		ip_monarchy.46
	}
	fallback = ip_mon_42_plot_fallback
}

ip_mon_42_plot_fallback = {
	events = {
		ip_monarchy.45
	}
}

ip_mon_54_plot_early = {
	random_events = {
		10 = ip_monarchy.55
		10 = ip_monarchy.56
	}
	fallback = ip_mon_54_plot_late
}

ip_mon_54_plot_late = {
	events = {
		ip_monarchy.58
	}
	fallback = ip_mon_54_plot_fallback
}

ip_mon_54_plot_fallback = {
	events = {
		ip_monarchy.57
	}
}

ip_mon_64_events = {
	random_events = {
		10 = ip_monarchy.65
		10 = ip_monarchy.66
		10 = ip_monarchy.67
		10 = ip_monarchy.68
	}
}

brothers_events = {
	random_events = {
		10 = ip_monarchy.31
		10 = ip_monarchy.32
	}
	fallback = brothers_events_fallback
}

brothers_events_fallback = {
	events = {
		ip_monarchy.33
	}
}

friend_request = {
	random_events = {
		10 = friend_rival.2
		5 = friend_rival.1
		10 = friend_rival.11
		10 = friend_rival.4
		10 = office.1
	}
}

rival_request = {
	random_events = {
		10 = friend_rival.3
		10 = friend_rival.13
	}
}

pytheas_return_on_action = {
	events = {
		dhe_massalia.8
	}
	fallback = pytheas_return_on_action_fallback
}

pytheas_return_on_action_fallback = {
	events = {
		dhe_massalia.9
	}
}

ip_rep_66_development_on_action = {
	random_events = {
		10 = ip_republic.68
		10 = ip_republic.69
		10 = ip_republic.72
		10 = ip_republic.73	
		15 = ip_republic.74	
		15 = ip_republic.75
		10 = ip_republic.78
		10 = ip_republic.80
	}
	fallback = ip_rep_66_close_on_action
}

ip_rep_66_close_on_action = {
	events = {
		ip_republic.76
		ip_republic.79
		ip_republic.84
	}
}

generic_1_pulse = {
	trigger = {
		NOT = {
			has_variable = oa_pulse_toggle
		}
	}
	random_events = {
		10 = generic_mission.1
		10 = generic_mission.2
	}
	effect = {
		set_variable = {
			name = oa_pulse_toggle
			days = 75 
		}
	}
}

generic_infra_temple_pulse = {
	trigger = {
		NOT = {
			has_variable = oa_pulse_toggle
		}
	}
	random_events = {
		10 = generic_infra_mission.1 #Governor Stealing
		10 = generic_infra_mission.2 #Influx of People
		10 = generic_infra_mission.3 #Contributions from Governor
		10 = generic_infra_mission.7 #Pilgrim Traders
	}
	effect = {
		set_variable = {
			name = oa_pulse_toggle
			days = 175
		}
	}
}

generic_infra_colonia_pulse = {
	trigger = {
		NOT = {
			has_variable = oa_pulse_toggle
		}
	}
	random_events = {
		10 = generic_infra_mission.8 #Incoming Settlers
		10 = generic_infra_mission.9 #Locals move from surroundings to center
		10 = provincial_events.1 #Settlers vs locals
	}
	effect = {
		set_variable = {
			name = oa_pulse_toggle
			days = 175
		}
	}
}

generic_infra_governor_residence_pulse = {
	trigger = {
		NOT = {
			has_variable = oa_pulse_toggle
		}
	}
	random_events = {
		10 = provincial_events.1 #Settlers vs locals
		10 = generic_infra_mission.17 #Strongmen of X
		10 = generic_infra_mission.18 #Establishing a Local Bureaucracy
		10 = generic_infra_mission.19 #Cadastral Survey
	}
	effect = {
		set_variable = {
			name = oa_pulse_toggle
			days = 175
		}
	}
}

generic_infra_monument_pulse = {
	trigger = {
		NOT = {
			has_variable = oa_pulse_toggle
		}
	}
	random_events = {
		10 = generic_infra_mission.13 #
		10 = generic_infra_mission.14 #
		10 = generic_infra_mission.15 #
	}
	effect = {
		set_variable = {
			name = oa_pulse_toggle
			days = 175
		}
	}
}

prospecting_pulse = {
	trigger = {
		NOT = {
			has_variable = oa_pulse_toggle
		}
	}
	random_events = {
		15 = generic_infra_mission.22 #Iron Found
		10 = generic_infra_mission.23 #Gold Found
		5 = generic_infra_mission.24 #Gems Found
		10 = generic_infra_mission.25 #Base Metals Found
		25 = generic_infra_mission.26 #Minor Deposit Found
		30 = generic_infra_mission.27 #False Lead
	}
	effect = {
		set_variable = {
			name = oa_pulse_toggle
			days = 175
		}
	}
}

yearly_bad_advisor_pulse = {
	trigger = {
		any_character = {
			character_experience <= low_expertise_threshold
			has_any_office = yes
		}
	}
	random_events = {
		1 = stability.4
		1 = stability.8
		1 = stability.10
		3 = 0
	}
}

yearly_good_advisor_pulse = {
	trigger = {
		any_character = {
			character_experience >= high_expertise_threshold
			has_any_office = yes
		}
	}
	random_events = {
		1 = stability.1
		1 = stability.2
		1 = stability.3
		1 = stability.5
		1 = stability.6
		1 = stability.9
		4 = 0
	}
}

monthly_syracuse_revolution_pulse = {
	trigger = {
		tag = SYR
		current_ruler = { has_variable = me_syr_current_tyrant_flag }
		any_character = { has_variable = me_syr_democracy_leader }
	}
	random_events = {
		5 = me_syracuse_1_democracy.25
		20 = 0
	}
}

content_clear_holdings = {
	random_events = {
		50 = 0
		50 = scheme.3
	}
}

great_work_yearly_pulse = {
	trigger = {
        any_owned_province = {
			has_great_work = yes
        }   
	}

	effect = {
	    random_owned_province = {
            limit = {
                has_great_work = yes
            }
            save_scope_as = province
        }
    }  
	events = {
		

	}
	random_events = {
		35 = 0
		1 = gw_existing.5
		1 = gw_existing.6
		1 = gw_existing.9
	}
}

great_work_five_yearly_pulse = {
	trigger = {
		has_any_great_work_country = yes
		NOT = {
			has_variable = gw_5_yearly
		}
	}
	effect = {
		set_variable = {
			name = gw_5_yearly
			days = 1825
		}
	}
	events = {

	}
	random_events = {
		1000 = 0
		100 = gw_existing.1
		100 = gw_existing.7
		100 = gw_existing.8
		10 = gw_existing.10
	}
}

no_great_work_pulse = {
	trigger = {
		NOT = {
			has_any_great_work_country = yes
		}
	}
	events = {

	}
	random_events = {
		11 = 0
		1 = gw_not_existing.2
	}
}

great_work_ai_construction_yearly_pulse = {
	trigger = {
		has_dlc = "Heirs of Alexander"
		is_ai = yes		
		NOT = { has_variable = gw_built_var }
	}
	events = {
		gw_ai_build.1
	}	
}

great_work_misc_yearly_pulse = {
	trigger = {		
		is_ai = no
		NOT = { has_variable = stonehenge_happened }
	}
	
	events = {
	}
	
	random_events = {
		50000 = 0
		1 = stonehenge.1
	}	
}

content_clear_holdings = {
	random_events = {
		50 = 0
		50 = scheme.3
	}
}

me_epi_royal_wedding_step_1_country_on_action = {
	events = { me_epirus_1_epirus.16 }
	fallback = me_epi_royal_wedding_restart_fallback
}

me_epi_royal_wedding_step_2_groom_on_action = {
	events = { me_epirus_1_epirus.17 }
	fallback = me_epi_royal_wedding_restart_fallback
}

me_epi_royal_wedding_step_3_proposal_on_action = {
	events = { me_epirus_1_epirus.18 }
	fallback = me_epi_royal_wedding_restart_fallback
}

me_epi_royal_wedding_step_4_wedding_on_action = {
	events = { 
		me_epirus_1_epirus.19
		me_epirus_1_epirus.20
	}
	fallback = me_epi_royal_wedding_restart_fallback
}

me_epi_royal_wedding_restart_fallback = {
	events = { me_epirus_1_epirus.21 }
}

random_cultural_integration_event_25 = {
	random_events = {
		50 = 0
		30 = cultural_integration.1
		10 = cultural_integration.2
		10 = cultural_integration.3
		10 = cultural_integration.4
		10 = cultural_integration.5
		10 = cultural_integration.6
		10 = cultural_integration.7
	}
}

random_cultural_integration_event_75 = {
	random_events = {
		50 = 0
		30 = cultural_integration.1
		10 = cultural_integration.2
		10 = cultural_integration.3
		10 = cultural_integration.4
		10 = cultural_integration.5
		10 = cultural_integration.6
		10 = cultural_integration.7
		50 = cultural_integration.8
		50 = cultural_integration.9
	}
}

babylonian_priest_yearly_pulse = {
	trigger = {
		OR = {
			has_completed_mission = seleukid_mission_01_babylonia
			has_completed_mission_task = seleukid_mission_01_babylonia_task_1
		}
		NOT = {
			any_character = {
				has_character_modifier = priest_of_babylon_char_modifier
			}
		}
	}
	events = {
		me_seleukid_01_babylon.16
	}
}

espionage_character_pulse = {
	trigger = {
		has_variable = on_espionage_mission_origin
		var:on_espionage_mission_origin = {
			exists = THIS
			has_land = yes
			NOT = { has_variable = espionage_shenanigans_cooldown }
		}
		has_variable = on_espionage_mission_recipient
		var:on_espionage_mission_recipient = {
			exists = THIS
			has_land = yes
		}
		employer = var:on_espionage_mission_recipient
	}
	events = { 
		country_diplomacy.47
	}
}
