
# Triggers when the game starts
on_game_start = {
	events = {
		MT_gamestart.9999 # set global flag hydras_more_traditions_installed
	}
}

# Fired when a science ship succesfully analyzed or scavenged debris
# this = country
# from = debris
# fromfrom = controller of destroyed ship
on_debris_scavenged = {
	events = {
		#MT_events.12 # Artifacts from fallen empire debris
		MT_piracy.2 # Unity from scavenging debris
	}
}

# Fired when a science ship succesfully analyzed or scavenged debris
# this = country
# from = debris
# fromfrom = controller of destroyed ship
on_debris_researched = {
	events = {
		#MT_events.12 # Artifacts from fallen empire debris
		MT_piracy.2 # Unity from scavenging debris
	}
}

# Fired when a science ship succesfully analyzed or scavenged debris
# this = country
# from = debris
# fromfrom = controller of destroyed ship
on_debris_scavenged_and_researched = {
	events = {
		#MT_events.12 # Artifacts from fallen empire debris
		MT_piracy.2 # Unity from scavenging debris
	}
}

# No scope, like on_game_start
on_yearly_pulse = {
	events = {
		MT_curiosity.1 # Extra Astral Rifts
	}
}

on_decade_pulse_country = {
	events = {
		MT_archaeology.2 # arcsite spawn / Finisher
	}
}

on_arch_site_finished = {
	events = {
		MT_archaeology.1 # Media Coverage
	}
}

# A fleet executes a move order to exit borders
# Scope = Fleet
# From = Origin System
# FromFrom = Destination System
on_crossing_border = {
	events = {
		MT_movement.1 # Crossing border gives intel
	}
}

# A war has been won
# Root = Winner Warleader
# From = Loser Warleader
# FromFrom = War
on_war_won = {
	events = {
		MT_agenda.1 # Instantly finish Envy and Insurgency Agenda
		MT_annihilation.2 # Annihilation Final Strike Tradition
		MT_events.98 # Freedom tax
	}
}

#You have changed the location of your capital. Also called when a country's capital is first set e.g. during galaxy creation (but then FROM is not set)
#this/root = new capital
#from = old capital
on_capital_changed = {
	events = {
		MT_urban.1
		MT_events.1000 # Genesis // Adoption // planetary feature move
		MT_events.1001 # Genesis // Finisher // planetary feature move
	}
}

# Triggers country_event for the attacker upon victory (before controller is switched)
# This = country, lead attacker
# From = country, colony owner
# FromFrom = colony
# 'Attacker' is the side that "IsHostile" to the colony controller. For example: spawned monster armies are attackers, but if they win and the player attempts to retake the colony, the player is the attacker
#on_colony_attackers_win = {
#	events = {
#		MT_events.80 # Piracy Plunder
#	}
#}

# A pop has finished purging
# This = Planet scope
# From = Country
# FromFrom = Pop
on_pop_purged = {
	events = {
		#MT_events.18	# Gain unity for purging as fanatic purifiers with envy traditions
		MT_events.25	# Annihilation Beauty of Annihilation Tradition
		MT_events.1005 # Geology // Crystal Infection, purifier swap // mineral on purge
	}
}

# A leader is added to the leader pool, available for recruitment
# scope: country, from: leader
on_added_to_leader_pool = {
	events = {
		MT_piracy.1 # Piracy Privateers (Material Liberator Trait)
		MT_archaeology.3 # Archeology Private Collector Appropriation (Archeologist trait)
		#MT_events.27 # Mystic Messengers
		MT_cosmopolitan.1 # Cosmopolitan external leaders get extra trait
	}
}

# This = Country
on_relic_activated = {
	events = {
		MT_antiquity.1 # xp to all leaders for activating a relic
	}
}

# Planet has taken damage from orbital bombardment - Damage is applied daily
# This = Planet
# From = Bombarder
on_planet_bombarded = {
	events = {
		MT_events.84 # Liberation Propaganda Bombardment
	}
}

# Executed whenever a pop is killed due to bombardment damages
# This = Colony where the pop was bombed to death
# From = Country which is raining down fire and brimstone
# FromFrom = Biggest fleet bombarding the planet (the one we used the bombardment stance from)
# local_kill_pop_amount = amount of pop killed
on_pop_bombed_to_death = {
	events = {
		MT_annihilation.1 # Beauty of Annihilation
	}
}

# this = country
on_monthly_pulse_country = {
	events = {
		#MT_events.96 # Synaptic Lathe job suppression
	}
}

# A leader leveled up.
# Scope = Country
# From = Leader
on_leader_level_up = {
	events = {
		#MT_events.28 # Enegmatic Leaders Fate
	}
}

# Fired when a fleet activates cloaking
# This = Fleet
on_cloaking_activated = {
	events = {
		MT_events.68 # Legion Speed
	}
}

# Fired when cloaking is deactivated for a fleet (voluntarily or involuntarily)
# This = Fleet
on_cloaking_deactivated = {
	events = {
		MT_events.29 # Enigmatic Element of Surprise
		MT_events.32 # Swarm Ambush
		MT_events.45 # Valor Apply Cloaking Flag
		MT_events.50 # Valor Ambusher Trait
		MT_events.65 # When uncloaking in a vigilant empire's borders, give 20 intel to the vigilant empire
		MT_events.69 # Legion remove speed
	}
}

# A fleet has successfully escaped from combat, executed right before the fleet enters FTL
# This = escaping fleet
# From = system escaped from
# FromFrom = system escaping to
#on_emergency_ftl = {
#	events = {
#	}
#}

# This = owner of ship 1 (destroyed)
# From = owner of ship 2 (combatant)
# FromFrom = ship 1
# FromFromFrom = ship 2
on_ship_destroyed_victim = {
	events = {
		MT_events.30 # Swarm Always More
		MT_events.42 # Chaotic ship destroyed
		MT_events.52 # Diligence Never Surrender
		MT_events.66 # Brightburn Supernova
	}
}

# This = owner of ship 1 (combatant)
# From = owner of ship 2 (destroyed)
# FromFrom = ship 1
# FromFromFrom = ship 2
on_ship_destroyed_perp = {
	events = {
		MT_events.31 # Swarm Feast
		MT_events.39 # Bulwark Kill Ship
		MT_events.70 # Legion Perfection
		MT_events.73 # Vengeance Glee
		MT_desperation.3 # Desperation Finisher
	}
}

# This = Country
# From = Fleet
#on_fleet_detected = {
#	events = {
#		MT_events.32
#	}
#}

#This = destroyed country
#From = optional, destroyer (country)
on_country_destroyed = {
	events = {
		MT_events.33 # Purifiers unity from destroying empires
		#MT_events.34 # Purifiers unity from destroying fallen empires
		MT_events.37 # Insurgents gets their revenge
		MT_events.74 # Vengeance gets their revenge
	}
}

# A fleet has entered a system | See also: on_fleet_auto_move_arrival
# Scope = Fleet
# From = System
on_entering_system_fleet = {
	events = {
		MT_events.35    # Black Hole Boost
	}
}

# Scope: Ship Event
#A ship has been built
# Root = Ship
# From = Planet
on_ship_built = {
	events = {
		MT_events.36 # Black Hole Boost
	}
}

# This = subject
# From = subject's overlord
on_becoming_subject = {
	events = {
		# Give overlord loyalty modifier
	}
}

# fires when a country finishes being integrated
# This = overlord
# From = subject
on_subject_integrated = {
	events = {
		# Remove loyalty modifier
	}
}

# A country has increased the level of a tech, use last_increased_tech trigger to check tech and level.
# This = Country
on_tech_increased = {
	events = {
		MT_events.38 # Loyalty: Scholarium
	}
}

# From = system
# FromFrom = country (new owner)
# This = country (previous owner)
on_system_lost = {
	events = {
		#MT_events.60
		MT_events.83
		MT_desperation.2
	}
}

# From = system
# FromFrom = country (previous owner)
# This = country (new owner)
on_system_gained = {
	events = {
		#MT_events.59
		MT_events.82
		MT_desperation.1
	}
}

# This = owner of fleet 1 (loser)
# From = owner of fleet 2 (winner)
# FromFrom = fleet 1
# FromFromFrom = fleet 2
on_space_battle_lost = {
	events = {
		MT_events.41
		MT_events.47 # Valor, remove flags
	}
}

# This = owner of fleet 1 (winner)
# From = owner of fleet 2 (loser)
# FromFrom = fleet 1
# FromFromFrom = fleet 2
on_space_battle_won = {
	events = {
		MT_events.46 # Give heroic symbols trait
		MT_events.48 # Valor, give xp
	}
}

# This = owner of fleet 1
# From = owner of fleet 2
# FromFrom = fleet 1
# FromFromFrom = fleet 2
on_entering_battle = {
	events = {
		MT_events.43 # Valor Charge
		MT_events.44 # Valor Apply Flags
		MT_events.71 # Legion Rapid Response
	}
}

# Called upon a catapult jump being finished, per fleet
# THIS = Fleet
# FROM = System jumping to
# FROMFROM = System jumped from
on_fleet_quantum_catapult = {
	events = {
		MT_events.49
	}
}

# THIS = Espionage operation
# FROM = Operation target
on_operation_finished = {
	events = {
		MT_events.53 # Manipulation Planted Evidence
		MT_events.77 # Envy Data Siphon
		MT_events.81 # Disruption Adoption
	}
}

# Executed when an astral rift spawns
# THIS = AstralRift: spawned astral rift
on_astral_rift_spawned = {
	events = {
		MT_curiosity.2 # Call of the unknown, curiosity, gain physics research
	}
}

# Executed when the exploration of an astral rift ends
# THIS = Country: Explorer country
# FROM = AstralRift: Explored astral rift
# FROMFROM = Exploring Fleet
on_astral_rift_exploration_complete = {
	events = {
		MT_curiosity.3 # Unity when completing rift
	}
}

# A pop has finished assembling
# This = Planet scope
# From = Country
# FromFrom = Pop
#on_pop_assembled = {
#	events = {
#		MT_events.56 # Royalty Broodmother Machine
#		MT_events.57 # Royalty Broodmother Machine
#	}
#}

# A pop amount has been assembled
# This = Colony scope
# From = Country
# FromFrom = Pop group
# local_pop_amount = variable of how much was assembled
on_pop_assembly = {
	events = {
		MT_royalty.1 	# Add Special Care trait
	}
}

# A war is beginning, executed for every country in the war.
# Root = Country
# From = War
on_war_beginning = {
	events = {
		MT_royalty.2 # Grand Entrance
		MT_events.93 # Set years of war variable
	}
}

# A pop has finished growing
# This = Planet scope
# From = Country
# FromFrom = Pop
on_pop_grown = {
	events = {
		#MT_events.61
		#MT_events.62
	}
}

# Fired when a subject has started converting to a specialist type
# This = agreement
# owner = overlord
# target = subject
on_specialist_subject_conversion_started = {
	events = {
		MT_events.63
	}
}

# Fired when a subject has finished converting to a specialist type
# This = agreement
# owner = overlord
# target = subject
on_specialist_subject_conversion_finished = {
	events = {
		MT_events.64
	}
}

# Fired when a subject specialist conversion has been aborted
# This = agreement
# owner = overlord
# target = subject
on_specialist_subject_conversion_aborted = {
	events = {
		MT_events.64
	}
}

# THIS = Ship
on_jump_drive = {
	events = {
		MT_events.76 # Chaotics Trip Through Hell
	}
}

# Fired whenever a new owner is set for a planet, following a war or through trade
# This = Planet scope
# From = Country scope (new owner)
# FromFrom = Country scope (previous owner, if any)
on_planet_transfer = {
	events = {
		#MT_events.78 # Create Background Leader
		MT_events.85 # Create Modifier Situation
	}
}

# A planet has been colonized.
# Scope = Planet
on_colonized = {
	events = {
		#MT_events.79 # Create Background Leader
		MT_events.86 # Create Modifier Situation
		MT_events.1002 # Genesis // Gen Zero // timed planetary modifier add
	}
}

on_colonization_started = {
	events = {
		MT_events.1004 # Genesis // Cradle of Civilizations // lumpsum science
	}
}

# Planet has changed planet class in whatever way. Note that this is also called during galaxy creation in some places.
# This = Planet
on_planet_class_changed = {
	events = {
		MT_events.89 # Ruination Situations
	}
}

# THIS = Planet: Branch office planet
# FROM = Country: Branch office owner
#on_branch_office_established = {
#	events = {
#		#MT_events.87 # Branch Office Opened
#	}
#}

# This = Colony
on_blocker_cleared = {
	events = {
		MT_greed.3 # Greed landfill blocker
	}
}

# Fired whenever a new owner is set for a planet, and the planet was aggressively conquered
# NOTE: fired in ADDITION to on_planet_transfer
# This = Planet scope
# From = Country scope (new owner)
# FromFrom = Former Owner
#on_planet_conquer = {
#	events = {
#		MT_events.95 # Conquest Finisher
#	}
#}

# Fired whenever a new owner is set for a planet, and the planet was aggressively conquered
# NOTE: fired in ADDITION to on_colony_transfer
# This = Colony scope
# From = Country scope (new owner)
# FromFrom = Former Owner
on_colony_conquer = {
	events = {
		MT_conquest.1
	}
}

on_ascension_perk_picked = {
	events = {
		MT_events.1003 # Genesis // Paradigm Shift // +resources for 5 years on AP pick
	}
}

on_terraforming_complete = {
	events = {
		MT_botany.1 # Botany // Evolution in Miniature // x months of research on terraforming completion
	}
}

#From = Planet/Starbase/Megastructure/Astral Rift scope
#This = Fleet scope
on_fleet_enter_orbit = {
	events = {
		MT_greed.1 # Greed - Fleet enters orbit of hostile planet
	}
}

#This = Fleet scope
#From = Planet/Starbase/Megastructure/Astral Rift scope
on_fleet_leave_orbit = {
	events = {
		MT_greed.2 # Greed - Fleet exits orbit of hostile planet
	}
}

MT_precursor_events = {
	random_events = {
		10 = MT_precursor_events.7 # Vultaum
		10 = MT_precursor_events.8 # Irassian
		10 = MT_precursor_events.9 # First League
		10 = MT_precursor_events.10 # Yuth
		10 = MT_precursor_events.11 # Cybrex
		10 = MT_precursor_events.12 # Zroni
		10 = MT_precursor_events.13 # Baol
		#10 = MT_precursor_events.14 # Inetian
		#10 = MT_precursor_events.15 # Adakkaria
	}
}