############################
#
# Crisis Events II
#
# Written by Henrik Eklund
#
############################

namespace = crisis

@tier1unityreward = 6
@tier1unitymin = 100
@tier1unitymax = 500
@tier2unityreward = 12
@tier2unitymin = 150
@tier2unitymax = 1000
@tier3unityreward = 18
@tier3unitymin = 250
@tier3unitymax = 1500
@tier4unityreward = 24
@tier4unitymin = 350
@tier4unitymax = 2000
@tier5unityreward = 48
@tier5unitymin = 700
@tier5unitymax = 4000

#对原版危机事件修改


# Vanguard Arrives
country_event = {
	id = crisis.18
	title = "crisis.18.name"
	desc = "crisis.18.desc"
	picture = GFX_evt_physics_research
	show_sound = event_alien_nature
	location = event_target:prethoryn_invasion_system
	
	is_triggered_only = yes
	
	immediate = {
		random_rim_system = {
			limit = { has_star_flag = swarm_invasion_target_1 }
			save_event_target_as = prethoryn_invasion_system
		}
	}
	
	option = {
		name = crisis.18.a
		trigger = {
			has_spiritualist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
	option = {
		name = crisis.18.b
		trigger = {
			has_militarist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
	option = {
		name = crisis.18.c
		trigger = {
			has_materialist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
	option = {
		name = crisis.18.d
		trigger = {
			has_pacifist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
	option = {
		name = crisis.18.e
		trigger = {
			has_government = gov_megacorporation
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
	option = {
		name = crisis.18.f
		trigger = {
			OR = {
				has_generic_government = yes
				has_government = gov_enlightened_monarchy
				has_government = gov_elective_monarchy
				has_government = gov_hive_mind
				has_ethic = ethic_gestalt_consciousness
			}
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
	option = {
		name = crisis.18.g
		trigger = {
			has_ethic = "ethic_fanatic_xenophobe"
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
	option = {
		name = crisis.18.h
		trigger = {
			has_ethic = "ethic_fanatic_xenophile"
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
	option = {
		name = crisis.18.i
		trigger = {
			has_ethic = "ethic_fanatic_authoritarian"
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
	option = {
		name = crisis.18.j
		trigger = {
			has_ethic = "ethic_fanatic_egalitarian"
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
	#希灵帝国遇到虫族时的选项
	option = {
		name = crisis.18.b
		trigger = {
			has_authority = auth_xilin_mind
		}
		end_event_chain = "coming_storm_chain"
		begin_event_chain = {
			event_chain = "prethoryn_scourge_chain"
			target = ROOT
		}
	}
}

# Prethoryn Defeated
country_event = {
	id = crisis.211
	title = "crisis.211.name"
	desc = "crisis.211.desc"
	picture = GFX_evt_metropolis
	show_sound = event_celebration
	
	is_triggered_only = yes
	
	option = { # Spiritualist Response
		name = crisis.211.a
		trigger = {
			has_spiritualist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_modifier = {
			modifier = "prethoryn_defeated"
			days = 3600
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
		end_event_chain = "prethoryn_scourge_chain"
	}
	option = { # Militarist Response
		name = crisis.211.b
		trigger = {
			has_militarist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_modifier = {
			modifier = "prethoryn_defeated"
			days = 360
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
		end_event_chain = "prethoryn_scourge_chain"
	}
	option = { # Materialist Response
		name = crisis.211.c
		trigger = {
			has_materialist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_modifier = {
			modifier = "prethoryn_defeated"
			days = 3600
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
		end_event_chain = "prethoryn_scourge_chain"
	}
	option = { # Pacifist Response
		name = crisis.211.d
		trigger = {
			has_pacifist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_modifier = {
			modifier = "prethoryn_defeated"
			days = 3600
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
		end_event_chain = "prethoryn_scourge_chain"
	}
	option = { # Corporate Response
		name = crisis.211.e
		trigger = {
			has_government = gov_megacorporation
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_modifier = {
			modifier = "prethoryn_defeated"
			days = 3600
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
		end_event_chain = "prethoryn_scourge_chain"
	}
	option = { # Default Response
		name = crisis.211.f
		trigger = {
			OR = {
				has_generic_government = yes
				has_government = gov_enlightened_monarchy
				has_government = gov_elective_monarchy
				has_government = gov_hive_mind
				has_ethic = ethic_gestalt_consciousness
			}
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_modifier = {
			modifier = "prethoryn_defeated"
			days = 3600
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
		end_event_chain = "prethoryn_scourge_chain"
	}
	option = { # Xenophobe Response
		name = crisis.211.g
		trigger = {
			has_ethic = "ethic_fanatic_xenophobe"
		}
		add_modifier = {
			modifier = "prethoryn_defeated"
			days = 3600
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
		end_event_chain = "prethoryn_scourge_chain"
	}
	option = { # Xenophile Response
		name = crisis.211.h
		trigger = {
			has_ethic = "ethic_fanatic_xenophile"
		}
		add_modifier = {
			modifier = "prethoryn_defeated"
			days = 3600
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
		end_event_chain = "prethoryn_scourge_chain"
	}
	#希灵帝国击败虫灾
	option = { # Militarist Response
		name = crisis.211.b
		trigger = {
			has_authority = auth_xilin_mind
		}
		add_modifier = {
			modifier = "prethoryn_defeated"
			days = 3600
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
		end_event_chain = "prethoryn_scourge_chain"
	}
}




### EXTRADIMENSIONALS



# Notification (High Intel)
country_event = {
	id = crisis.1007
	title = "crisis.1007.name"
	desc = "crisis.1007.desc"
	picture = GFX_evt_wormhole
	show_sound = event_ex_started
	location = event_target:extradimensional_system
	
	is_triggered_only = yes

	after = {
		begin_event_chain = {
			event_chain = "extradimensional_invasion_chain"
			target = ROOT
		}
		create_point_of_interest = {
			id = extradimensional_invasion_poi.1
			name = "extradimensional_invasion_1_poi"
			desc = "extradimensional_invasion_1_poi_desc"
			event_chain = "extradimensional_invasion_chain"
			location = event_target:extradimensional_system
		}
		create_point_of_interest = {
			id = extradimensional_invasion_poi.4
			name = "extradimensional_invasion_4_poi"
			desc = "extradimensional_invasion_4_poi_desc"
			event_chain = "extradimensional_invasion_chain"
		}
		hidden_effect = { country_event = { id = crisis.1010 } }
	}
	
	option = {
		name = crisis.18.a
		trigger = {
			has_spiritualist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.b
		trigger = {
			has_militarist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.c
		trigger = {
			has_materialist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.d
		trigger = {
			has_pacifist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.e
		trigger = {
			has_government = gov_megacorporation
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.f
		trigger = {
			OR = {
				has_generic_government = yes
				has_government = gov_enlightened_monarchy
				has_government = gov_elective_monarchy
				has_government = gov_hive_mind
			}
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.g
		trigger = {
			has_ethic = "ethic_fanatic_xenophobe"
		}
	}
	option = {
		name = crisis.1007.a
		trigger = {
			has_ethic = "ethic_fanatic_xenophile"
		}
	}
	option = {
		name = crisis.1007.b
		trigger = {
			has_ethic = "ethic_fanatic_authoritarian"
		}
	}
	option = {
		name = crisis.18.j
		trigger = {
			has_ethic = "ethic_fanatic_egalitarian"
		}
	}
	option = {
		name = crisis.18.h
		trigger = {
			has_ethic = ethic_gestalt_consciousness
		}
	}
	#希灵帝国遇到恶魔时的选项
	option = {
		name = crisis.18.c
		trigger = {
			has_authority = auth_xilin_mind
		}
	}
}


# Threat Identified
country_event = {
	id = crisis.1009
	title = "crisis.1007.name"
	desc = "crisis.1009.desc"
	picture = GFX_evt_wormhole
	show_sound = event_ex_started
	
	is_triggered_only = yes
	
	immediate = {
		random_system = {
			limit = { has_star_flag = extradimensional_origin_system }
			save_event_target_as = extradimensional_system
		}
	}

	after = {
		begin_event_chain = {
			event_chain = "extradimensional_invasion_chain"
			target = ROOT
		}
		create_point_of_interest = {
			id = extradimensional_invasion_poi.1
			name = "extradimensional_invasion_1_poi"
			desc = "extradimensional_invasion_1_poi_desc"
			event_chain = "extradimensional_invasion_chain"
			location = event_target:extradimensional_system
		}
		create_point_of_interest = {
			id = extradimensional_invasion_poi.4
			name = "extradimensional_invasion_4_poi"
			desc = "extradimensional_invasion_4_poi_desc"
			event_chain = "extradimensional_invasion_chain"
		}
		hidden_effect = { country_event = { id = crisis.1010 } }
	}
	
	option = {
		name = crisis.18.a
		trigger = {
			has_spiritualist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.b
		trigger = {
			has_militarist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.c
		trigger = {
			has_materialist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.d
		trigger = {
			has_pacifist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.e
		trigger = {
			has_government = gov_megacorporation
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.f
		trigger = {
			OR = {
				has_generic_government = yes
				has_government = gov_enlightened_monarchy
				has_government = gov_elective_monarchy
				has_government = gov_hive_mind
			}
			NOT = {
				has_ethic = "ethic_fanatic_egalitarian"
				has_ethic = "ethic_fanatic_authoritarian"
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
	}
	option = {
		name = crisis.18.g
		trigger = {
			has_ethic = "ethic_fanatic_xenophobe"
		}
	}
	option = {
		name = crisis.1007.a
		trigger = {
			has_ethic = "ethic_fanatic_xenophile"
		}
	}
	option = {
		name = crisis.1007.b
		trigger = {
			has_ethic = "ethic_fanatic_authoritarian"
		}
	}
	option = {
		name = crisis.18.j
		trigger = {
			has_ethic = "ethic_fanatic_egalitarian"
		}
	}
	option = {
		name = crisis.18.h
		trigger = {
			has_ethic = ethic_gestalt_consciousness
		}
	}
	#希灵帝国遇到恶魔时的选项
	option = {
		name = crisis.18.b
		trigger = {
				has_authority = auth_xilin_mind
		}
	}
}

# Extradimensionals Defeated
country_event = {
	id = crisis.1271
	title = "crisis.1271.name"
	desc = "crisis.1271.desc"
	picture = GFX_evt_metropolis
	show_sound = event_celebration
	
	is_triggered_only = yes

	immediate = {
		end_event_chain = "extradimensional_invasion_chain"
		end_event_chain = "extradimensional_invasion_chain_2"
		end_event_chain = "extradimensional_invasion_chain_3"
	}
	
	option = { # Spiritualist Response
		name = crisis.1271.a
		trigger = {
			has_spiritualist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
	}
	option = { # Militarist Response
		name = crisis.1271.b
		trigger = {
			has_militarist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
	}
	option = { # Materialist Response
		name = crisis.1271.c
		trigger = {
			has_materialist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
	}
	option = { # Pacifist Response
		name = crisis.1271.d
		trigger = {
			has_pacifist_government = yes
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
	}
	option = { # Corporate Response
		name = crisis.1271.e
		trigger = {
			has_government = gov_megacorporation
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
	}
	option = { # Default Response
		name = crisis.211.f
		trigger = {
			OR = {
				has_generic_government = yes
				has_government = gov_enlightened_monarchy
				has_government = gov_elective_monarchy
				has_government = gov_hive_mind
				has_authority = auth_machine_intelligence
			}
			NOT = {
				has_ethic = "ethic_fanatic_xenophile"
				has_ethic = "ethic_fanatic_xenophobe"
			}
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
	}
	option = { # Xenophobe Response
		name = crisis.1271.g
		trigger = {
			has_ethic = "ethic_fanatic_xenophobe"
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
	}
	option = { # Xenophile Response
		name = crisis.1271.h
		trigger = {
			has_ethic = "ethic_fanatic_xenophile"
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
	}
	#希灵帝国战胜恶魔奖励
	option = { # Militarist Response
		name = crisis.1271.b
		trigger = {
			has_authority = auth_xilin_mind
		}
		add_monthly_resource_mult = {
			resource = unity
			value = @tier5unityreward
		}
	}
}