namespace = acot_pmc

################

# DIPLOMACY
country_event = {
	id = acot_pmc.2
	title = "acot_pmc.diplo_title"
	desc = acot_pmc.2.desc.a
	desc = acot_pmc.2.desc.b
	desc = acot_pmc.2.desc.c
	desc = acot_pmc.2.desc.d
	desc = acot_pmc.2.desc.e

	trigger = {
		from = {
			has_country_flag = phanon_base_country
		}
		NOR = { 
			has_country_flag = acot_phanon_diplomacy_engaged 
			has_country_flag = attacked_phanon_property
			has_global_flag = acot_phanon_portal_disabled
			has_global_flag = acot_phanon_retaliation_crisis_initiated
		}
	}

	is_triggered_only = yes

	diplomatic = yes
	show_sound = event_yellow_alert
    
	picture_event_data = {
		room = acot_phanon_bridge_room
	}
	custom_gui = "acot_enclave_phanon_window"
	custom_gui_option = "acot_enclave_phanon_option"
	
	immediate = {
		set_country_flag = acot_phanon_diplomacy_engaged
	}

	after = {
		hidden_effect = {
			remove_country_flag = acot_phanon_diplomacy_engaged
		}
    }
    
	option = {
		name = acot_pmc.2.a
		custom_tooltip = acot_pmc.2.a.explain
		hidden_country_self_event_call = {
			EVENT_ID = acot_pmc.3
		}
	}

	option = {
		name = acot_pmc.2.b
		custom_tooltip = acot_pmc.2.b.explain
		allow = {
			custom_tooltip = {
				text = acot_pmc.2.b.fail_text
				event_target:phanon_base_country = {
					check_variable = {
						which = acot_phanon_merc_count
						value >= 1
					}			
				}
			}
		}
		hidden_effect = {
			country_event = { id = acot_pmc.4 }
		}
	}

	option = {
		name = acot_pmc.2.c
		custom_tooltip = acot_pmc.2.c.explain
		hidden_country_self_event_call = {
			EVENT_ID = acot_pmc.5
		}
	}

	option = {
		name = acot_pmc.2.d
		custom_tooltip = acot_pmc.2.d.explain
		trigger = {
			has_modifier = acot_phanon_subscription
		}
		hidden_country_self_event_call = {
			EVENT_ID = acot_pmc.6
		}
	}
	option = {
		name = acot_pmc.2.d.purchase
		custom_tooltip = acot_pmc.2.d.purchase.explain
		response_text = acot_pmc.2.d.purchase.response
		trigger = {
			NOT = { has_modifier = acot_phanon_subscription }
		}
		allow = {
			resource_stockpile_compare = {
				resource = energy
				value >= 500000
			}
		}
		add_resource = {
			energy = -500000
		}
		hidden_effect = {
			add_modifier = {
				modifier = acot_phanon_subscription
				years = 10
			}
			phanon_ultra_random_duty_rolls = yes
			country_event = {
				id = acot_pmc.605
				days = 3600
			}
			change_variable = {
				which = acot_phanon_coin_var
				value = 1
			}
			while = {
				count = 3
				random_list = {
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_leader_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_leader_delay
							days = 1800
						}
					}
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_fleet_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_fleet_delay
							days = 1800
						}
					}
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_money_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_money_delay
							days = 3600
						}
					}
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_dutymen_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_dutymen_delay
							days = 3600
						}
					}
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_dutyfleet_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_dutyfleet_delay
							days = 1800
						}
					}
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_research_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_research_delay
							days = 3600
						}
					}
				}
			}
		}
	}

	option = {
		name = acot_pmc.2.e
		custom_tooltip = acot_pmc.2.e.explain
		hidden_country_self_event_call = {
			EVENT_ID = acot_pmc.7
		}
	}

	option = {
		name = acot_pmc.2.border
		response_text = acot_pmc.2.border.response
		custom_tooltip = acot_pmc.2.border.explain
		trigger = {
			event_target:phanon_base_country = {
				has_closed_borders = root
			}
		}
		allow = {
			resource_stockpile_compare = {
				resource = energy
				value >= 25000
			}
		}
		add_resource = {
			energy = -25000
		}
		event_target:phanon_base_country = {
			set_closed_borders = {
				who = root
				status = no
			}
		}
	}

	option = {
		name = acot_pmc.2.f
		custom_tooltip = acot_pmc.2.f.explain
		trigger = {
			has_country_flag = acot_phanon_rival_contact_enabled
			NOR = {
				has_country_flag = acot_phanon_rival_being_an_idiot
				has_global_flag = acot_phanon_rival_plan_succeed
			}
		}
		hidden_country_self_event_call = {
			EVENT_ID = acot_pmc.2003
		}
	}

	option = {
		name = sots_rival_diplo
		custom_tooltip = sots_rival_diplo.explain
		trigger = {
			has_country_flag = phanon_super_super_premium_member
		}
		hidden_country_self_event_call = {
			EVENT_ID = sots_pmc.1
		}
	}

	option = {
		name = acot_pmc.2.end
		trigger = {
			is_homicidal = no
		}
		default_hide_option = yes
	}

	option = {
		name = acot_pmc.2.end.genocide
		trigger = {
			is_homicidal = yes
		}
		default_hide_option = yes
	}
}

# DIPLOMACY FOR REDIRECTION
country_event = {
	id = acot_pmc.200
	title = "acot_pmc.diplo_title"
	desc = acot_pmc.2.desc.a
	desc = acot_pmc.2.desc.b
	desc = acot_pmc.2.desc.c
	desc = acot_pmc.2.desc.d
	desc = acot_pmc.2.desc.e

	is_triggered_only = yes

	diplomatic = yes
    
	picture_event_data = {
		room = acot_phanon_bridge_room
	}
	custom_gui = "acot_enclave_phanon_window"
	custom_gui_option = "acot_enclave_phanon_option"
	
	immediate = {
		set_country_flag = acot_phanon_diplomacy_engaged
	}

	after = {
		hidden_effect = {
			remove_country_flag = acot_phanon_diplomacy_engaged
		}
    }
    
	option = {
		name = acot_pmc.2.a
		custom_tooltip = acot_pmc.2.a.explain
		hidden_country_self_event_call = {
			EVENT_ID = acot_pmc.3
		}
	}

	option = {
		name = acot_pmc.2.b
		custom_tooltip = acot_pmc.2.b.explain
		allow = {
			custom_tooltip = {
				text = acot_pmc.2.b.fail_text
				event_target:phanon_base_country = {
					check_variable = {
						which = acot_phanon_merc_count
						value >= 1
					}			
				}
			}
		}
		hidden_effect = {
			country_event = { id = acot_pmc.4 }
		}
	}

	option = {
		name = acot_pmc.2.c
		custom_tooltip = acot_pmc.2.c.explain
		hidden_country_self_event_call = {
			EVENT_ID = acot_pmc.5
		}
	}

	option = {
		name = acot_pmc.2.d
		custom_tooltip = acot_pmc.2.d.explain
		trigger = {
			has_modifier = acot_phanon_subscription
		}
		hidden_country_self_event_call = {
			EVENT_ID = acot_pmc.6
		}
	}
	option = {
		name = acot_pmc.2.d.purchase
		custom_tooltip = acot_pmc.2.d.purchase.explain
		response_text = acot_pmc.2.d.purchase.response
		trigger = {
			NOT = { has_modifier = acot_phanon_subscription }
		}
		allow = {
			resource_stockpile_compare = {
				resource = energy
				value >= 500000
			}
		}
		add_resource = {
			energy = -500000
		}
		hidden_effect = {
			add_modifier = {
				modifier = acot_phanon_subscription
				years = 10
			}
			country_event = {
				id = acot_pmc.605
				days = 3600
			}
			change_variable = {
				which = acot_phanon_coin_var
				value = 1
			}
			while = {
				count = 3
				random_list = {
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_leader_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_leader_delay
							days = 1800
						}
					}
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_fleet_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_fleet_delay
							days = 1800
						}
					}
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_money_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_money_delay
							days = 3600
						}
					}
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_dutymen_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_dutymen_delay
							days = 3600
						}
					}
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_dutyfleet_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_dutyfleet_delay
							days = 1800
						}
					}
					1 = {
						modifier = {
							factor = 0
							has_country_flag = acot_phanon_contract_research_delay
						}
						set_timed_country_flag = {
							flag = acot_phanon_contract_research_delay
							days = 3600
						}
					}
				}
			}
		}
	}

	option = {
		name = acot_pmc.2.e
		custom_tooltip = acot_pmc.2.e.explain
		hidden_country_self_event_call = {
			EVENT_ID = acot_pmc.7
		}
	}

	option = {
		name = acot_pmc.2.border
		response_text = acot_pmc.2.border.response
		custom_tooltip = acot_pmc.2.border.explain
		trigger = {
			event_target:phanon_base_country = {
				has_closed_borders = root
			}
		}
		allow = {
			resource_stockpile_compare = {
				resource = energy
				value >= 25000
			}
		}
		add_resource = {
			energy = -25000
		}
		event_target:phanon_base_country = {
			set_closed_borders = {
				who = root
				status = no
			}
		}
	}

	option = {
		name = acot_pmc.2.f
		custom_tooltip = acot_pmc.2.f.explain
		trigger = {
			has_country_flag = acot_phanon_rival_contact_enabled
			NOR = {
				has_country_flag = acot_phanon_rival_being_an_idiot
				has_global_flag = acot_phanon_rival_plan_succeed
			}
		}
		hidden_country_self_event_call = {
			EVENT_ID = acot_pmc.2003
		}
	}

	option = {

		name = sots_rival_diplo
		custom_tooltip = sots_rival_diplo.explain
		trigger = {
			has_country_flag = phanon_super_super_premium_member
		}
		hidden_country_self_event_call = {
			EVENT_ID = sots_pmc.1
		}
	}

	option = {
		name = acot_pmc.2.end
		trigger = {
			is_homicidal = no
		}
		default_hide_option = yes
	}

	option = {
		name = acot_pmc.2.end.genocide
		trigger = {
			is_homicidal = yes
		}
		default_hide_option = yes
	}
}