namespace = isbs_blink

#Blink mode timeout
country_event = {
	id = isbs_blink.2
	hide_window = yes
	is_triggered_only = yes

	trigger = {
		# Incase something else goes wrong, remove blink marker anyway
		#has_country_flag = flag_blink_mode
		NOT = { has_country_flag = flag_blink_mode_new}
	}

	immediate = {
		if = {
			limit = {
				has_country_flag = flag_blink_mode
			}
			remove_country_flag = flag_blink_mode
		}
		every_ambient_object = {
			limit = {
				has_ambient_object_flag = isbs_blink_marker
			}
			destroy_ambient_object = THIS
		}
	}
}

# On fleet enter combat. bugged atm and fires twice for same country
country_event = {
	id = isbs_blink.6
	hide_window = yes
	is_triggered_only = yes

	picture = GFX_evt_physics_research

	title = country_trigger

	desc = {
		text = you_are_country
	}

	trigger = {
	}

	immediate = {
		save_event_target_as = player_owner
		if = {
			limit = {
				FROMFROM = {
					OWNER = { is_ai = no }
				}
			}

			FROMFROM = {
				# reset
				if = {
					limit = {
						NOT = { has_fleet_flag = flag_just_combat }
						has_fleet_flag = flag_can_blink
					}
					remove_fleet_flag = flag_can_blink
				}
				save_event_target_as = fleet_owner
				if = {
					limit = {						
						OWNER = {
							count_owned_ships = {
								limit = {
									FLEET = { is_same_value = event_target:fleet_owner }
									is_ship_size = blink_ship
								}
								count > 0
							}
						}
					}
					
					# Blink fleet just entered combat
					if = {
						limit = {
							NOT = { has_fleet_flag = flag_just_combat }
						}
						OWNER = { set_country_flag = flag_blink_button }

						set_fleet_flag = flag_can_blink
						# hack to fix enter battle firing twice for the player
						set_timed_fleet_flag = { flag = flag_just_combat days = 5 }
						fleet_event = { id = isbs_blink.102 }

						# Set auto-jump target
						if = {
							limit = {
								check_variable = {
									which = "blink_fleet_id"
									value = 100
								}
							}
							PREV = {
								FROMFROMFROM = {
									set_fleet_flag = flag_blink_auto_100
								}
							}

							else = {
								if = {
									limit = {
										check_variable = {
											which = "blink_fleet_id"
											value = 101
										}
									}
									PREV = {
										FROMFROMFROM = {
											set_fleet_flag = flag_blink_auto_101
										}
									}

									else = {
										if = {
											limit = {
												check_variable = {
													which = "blink_fleet_id"
													value = 102
												}
											}
											PREV = {
												FROMFROMFROM = {
													set_fleet_flag = flag_blink_auto_102
												}
											}

											else = {
												if = {
													limit = {
														check_variable = {
															which = "blink_fleet_id"
															value = 103
														}
													}
													PREV = {
														FROMFROMFROM = {
															set_fleet_flag = flag_blink_auto_103
														}
													}
												}
											}
										}
									}
								}
							}
						}

						# auto blink if enabled
						if = {
							limit = {
								has_fleet_flag = flag_blink_auto_on
							}

							fleet_event = { id = isbs_blink.9 days = 15 }
							PREV = { set_country_flag = flag_blink_auto_on_country }
						}
						
						else = {
							# new fleet engages blink fleet, change auto jump target
							if = {
								limit = {
									check_variable = {
										which = "blink_fleet_id"
										value = 100
									}
								}
								
								#remove old target
								SOLAR_SYSTEM = {
									random_fleet_in_system = {
										limit = { has_fleet_flag = flag_blink_auto_100 }
										remove_fleet_flag = flag_blink_auto_100
									}
								}
								
								PREV = {
									FROMFROMFROM = {
										set_fleet_flag = flag_blink_auto_100
									}
								}

								else = {
									if = {
										limit = {
											check_variable = {
												which = "blink_fleet_id"
												value = 101
											}
										}
										
										SOLAR_SYSTEM = {
											random_fleet_in_system = {
												limit = { has_fleet_flag = flag_blink_auto_101 }
												remove_fleet_flag = flag_blink_auto_101
											}
										}
										
										PREV = {
											FROMFROMFROM = {
												set_fleet_flag = flag_blink_auto_101
											}
										}

										else = {
											if = {
												limit = {
													check_variable = {
														which = "blink_fleet_id"
														value = 102
													}
												}
												
												SOLAR_SYSTEM = {
													random_fleet_in_system = {
														limit = { has_fleet_flag = flag_blink_auto_102 }
														remove_fleet_flag = flag_blink_auto_102
													}
												}
												
												PREV = {
													FROMFROMFROM = {
														set_fleet_flag = flag_blink_auto_102
													}
												}

												else = {
													if = {
														limit = {
															check_variable = {
																which = "blink_fleet_id"
																value = 103
															}
														}
														
														SOLAR_SYSTEM = {
															random_fleet_in_system = {
																limit = { has_fleet_flag = flag_blink_auto_103 }
																remove_fleet_flag = flag_blink_auto_103
															}
														}
														
														PREV = {
															FROMFROMFROM = {
																set_fleet_flag = flag_blink_auto_103
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		if = {
			limit = {
				FROMFROMFROM = {
					OWNER = { is_ai = no }
				}
			}

			FROMFROMFROM = {
				# reset
				if = {
					limit = {
						NOT = { has_fleet_flag = flag_just_combat }
						has_fleet_flag = flag_can_blink
					}
					remove_fleet_flag = flag_can_blink
				}
				save_event_target_as = fleet_owner
				if = {
					limit = {						
						OWNER = {
							count_owned_ships = {
								limit = {
									FLEET = { is_same_value = event_target:fleet_owner }
									is_ship_size = blink_ship
								}
								count > 0
							}
						}
					}
					if = {
						limit = {
							NOT = { has_fleet_flag = flag_just_combat }
						}
						OWNER = { set_country_flag = flag_blink_button }

						set_fleet_flag = flag_can_blink
						set_timed_fleet_flag = { flag = flag_just_combat days = 5}
						fleet_event = { id = isbs_blink.102 }

						if = {
							limit = {
								check_variable = {
									which = "blink_fleet_id"
									value = 100
								}
							}
							PREV = {
								FROMFROM = {
									set_fleet_flag = flag_blink_auto_100
								}
							}

							else = {
								if = {
									limit = {
										check_variable = {
											which = "blink_fleet_id"
											value = 101
										}
									}
									PREV = {
										FROMFROM = {
											set_fleet_flag = flag_blink_auto_101
										}
									}

									else = {
										if = {
											limit = {
												check_variable = {
													which = "blink_fleet_id"
													value = 102
												}
											}
											PREV = {
												FROMFROM = {
													set_fleet_flag = flag_blink_auto_102
												}
											}

											else = {
												if = {
													limit = {
														check_variable = {
															which = "blink_fleet_id"
															value = 103
														}
													}
													PREV = {
														FROMFROM = {
															set_fleet_flag = flag_blink_auto_103
														}
													}
												}
											}
										}
									}
								}
							}
						}
						# auto blink if enabled
						if = {
							limit = {
								has_fleet_flag = flag_blink_auto_on
							}

							fleet_event = { id = isbs_blink.9 days = 15}
							PREV = { set_country_flag = flag_blink_auto_on_country }
						}
						
						else = {
							if = {
								limit = {
									check_variable = {
										which = "blink_fleet_id"
										value = 100
									}
								}
								
								SOLAR_SYSTEM = {
									random_fleet_in_system = {
										limit = { has_fleet_flag = flag_blink_auto_100 }
										remove_fleet_flag = flag_blink_auto_100
									}
								}
								
								PREV = {
									FROMFROM = {
										set_fleet_flag = flag_blink_auto_100
									}
								}

								else = {
									if = {
										limit = {
											check_variable = {
												which = "blink_fleet_id"
												value = 101
											}
										}
										
										SOLAR_SYSTEM = {
											random_fleet_in_system = {
												limit = { has_fleet_flag = flag_blink_auto_101 }
												remove_fleet_flag = flag_blink_auto_101
											}
										}
										
										PREV = {
											FROMFROM = {
												set_fleet_flag = flag_blink_auto_101
											}
										}

										else = {
											if = {
												limit = {
													check_variable = {
														which = "blink_fleet_id"
														value = 102
													}
												}
												
												SOLAR_SYSTEM = {
													random_fleet_in_system = {
														limit = { has_fleet_flag = flag_blink_auto_102 }
														remove_fleet_flag = flag_blink_auto_102
													}
												}
												
												PREV = {
													FROMFROM = {
														set_fleet_flag = flag_blink_auto_102
													}
												}

												else = {
													if = {
														limit = {
															check_variable = {
																which = "blink_fleet_id"
																value = 103
															}
														}
														
														SOLAR_SYSTEM = {
															random_fleet_in_system = {
																limit = { has_fleet_flag = flag_blink_auto_103 }
																remove_fleet_flag = flag_blink_auto_103
															}
														}
														
														PREV = {
															FROMFROM = {
																set_fleet_flag = flag_blink_auto_103
															}
														}
													}
												}
											}
										}
									}
								}
							}							
						}
					}					
				}
			}
		}
	}
}

#blink delayed
fleet_event = {
	id = isbs_blink.7
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		# energy cost
		OWNER = {
			if = {
				limit = {
					NOT = { has_country_flag = flag_disable_blink_cost }
				}

				if = {
					limit = {
						PREV = { fleet_size > 50 }
					}
					add_energy = -50

					if = {
						limit = {
							PREV = { fleet_size > 150 }
						}

						add_energy = -50
						if = {
							limit = {
								PREV = { fleet_size > 250 }
							}

							add_energy = -50
							if = {
								limit = {
									PREV = { fleet_size > 350 }
								}

								add_energy = -50
								if = {
									limit = {
										PREV = { fleet_size > 450 }
									}

									add_energy = -50
								}
							}
						}
					}
				}
			}
		}

		random_ambient_object = {
			limit = { has_ambient_object_flag = isbs_blink_in }
			PREV = {
				set_location = {
					target = PREV
					distance = 0.1
					angle = random
				}
			}

			destroy_ambient_object = THIS
		}

		random_ambient_object = {
			limit = { has_ambient_object_flag = isbs_blink_out }

			destroy_ambient_object = THIS
		}

		create_ambient_object = {
			type = "isbs_blink_in_bunny_object"
		}

		last_created_ambient_object = {
			set_ambient_object_flag = "isbs_blink_in_final"
			set_location = {
				target = PREV
				distance = 0.1
				angle = random
			}
		}

		set_event_locked = no

		# Clear final effect
		OWNER = { country_event = { id = isbs_blink.8 days = 6 } }
	}
}

# clear last ambient
country_event = {
	id = isbs_blink.8
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		every_ambient_object = {
			limit = {
				has_ambient_object_flag = isbs_blink_in_final
			}

			destroy_ambient_object = THIS
		}
	}
}

#auto-blink delayed start
fleet_event = {
	id = isbs_blink.9
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				is_in_combat = yes
				NOT = { has_fleet_flag = flag_blink_cooldown }
				has_fleet_flag = flag_blink_auto_on
				SOLAR_SYSTEM = {
					any_ship_in_system = {
						FLEET = { is_same_value = PREVPREVPREV }
						is_ship_size = blink_ship
					}
				}
			}

			set_timed_fleet_flag = { flag = flag_blink_cooldown days = 90 }
			OWNER = { set_timed_country_flag = { flag = flag_fleet_blinking days = 6 } }
			set_event_locked = yes

			if = {
				limit = {
					check_variable = {
						which = "blink_fleet_id"
						value = 100
					}
				}
				create_ambient_object = {
					type = "isbs_blink_out_bunny_object"
				}
				last_created_ambient_object = {
					set_ambient_object_flag = "isbs_blink_out_auto_100"
				}

				else = {
					if = {
						limit = {
							check_variable = {
								which = "blink_fleet_id"
								value = 101
							}
						}
						create_ambient_object = {
							type = "isbs_blink_out_bunny_object"
						}
						last_created_ambient_object = {
							set_ambient_object_flag = "isbs_blink_out_auto_101"
						}

						else = {
							if = {
								limit = {
									check_variable = {
										which = "blink_fleet_id"
										value = 102
									}
									#NOT = { has_fleet_flag = flag_blink_cooldown }
								}
								create_ambient_object = {
									type = "isbs_blink_out_bunny_object"
								}
								last_created_ambient_object = {
									set_ambient_object_flag = "isbs_blink_out_auto_102"
								}

								else = {
									if = {
										limit = {
											check_variable = {
												which = "blink_fleet_id"
												value = 103
											}
										}
										create_ambient_object = {
											type = "isbs_blink_out_bunny_object"
										}
										last_created_ambient_object = {
											set_ambient_object_flag = "isbs_blink_out_auto_103"
										}
									}
								}
							}
						}
					}
				}
			}

			fleet_event = { id = isbs_blink.10 days = 5}
		}
	}
}

#auto-blink delayed blink
fleet_event = {
	id = isbs_blink.10
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				check_variable = {
					which = "blink_fleet_id"
					value = 100
				}
			}
			SOLAR_SYSTEM = {
				random_fleet_in_system = {
					limit = {
						has_fleet_flag = flag_blink_auto_100
					}
					remove_fleet_flag = flag_blink_auto_100

					PREVPREV = {
						random_list = {
							15 = {
								set_location = {
									target = PREV
									distance = 5
									angle = random
								}
							}
							35 = {
								set_location = {
									target = PREV
									distance = 20
									angle = random
								}
							}
							40 = {
								set_location = {
									target = PREV
									distance = 30
									angle = random
								}
							}
							10 = {
								set_location = {
									target = PREV
									distance = 40
									angle = random
								}
							}
						}
					}
				}
				random_system_ambient_object = {
					limit = { has_ambient_object_flag = isbs_blink_out_auto_100 }

					destroy_ambient_object = THIS
				}
			}

			else = {
				if = {
					limit = {
						check_variable = {
							which = "blink_fleet_id"
							value = 101
						}
					}
					SOLAR_SYSTEM = {
						random_fleet_in_system = {
							limit = {
								has_fleet_flag = flag_blink_auto_101
							}
							remove_fleet_flag = flag_blink_auto_101
							
							PREVPREV = {
								random_list = {
									15 = {
										set_location = {
											target = PREV
											distance = 5
											angle = random
										}
									}
									35 = {
										set_location = {
											target = PREV
											distance = 20
											angle = random
										}
									}
									40 = {
										set_location = {
											target = PREV
											distance = 30
											angle = random
										}
									}
									10 = {
										set_location = {
											target = PREV
											distance = 40
											angle = random
										}
									}
								}
							}
						}
						random_system_ambient_object = {
							limit = { has_ambient_object_flag = isbs_blink_out_auto_101 }

							destroy_ambient_object = THIS
						}
					}

					else = {
						if = {
							limit = {
								check_variable = {
									which = "blink_fleet_id"
									value = 102
								}
							}
							SOLAR_SYSTEM = {
								random_fleet_in_system = {
									limit = {
										has_fleet_flag = flag_blink_auto_102
									}
									remove_fleet_flag = flag_blink_auto_102
									
									PREVPREV = {
										random_list = {
											15 = {
												set_location = {
													target = PREV
													distance = 5
													angle = random
												}
											}
											35 = {
												set_location = {
													target = PREV
													distance = 20
													angle = random
												}
											}
											40 = {
												set_location = {
													target = PREV
													distance = 30
													angle = random
												}
											}
											10 = {
												set_location = {
													target = PREV
													distance = 40
													angle = random
												}
											}
										}
									}
								}
								random_system_ambient_object = {
									limit = { has_ambient_object_flag = isbs_blink_out_auto_102 }

									destroy_ambient_object = THIS
								}
							}

							else = {
								if = {
									limit = {
										check_variable = {
											which = "blink_fleet_id"
											value = 103
										}
									}									
									SOLAR_SYSTEM = {
										random_fleet_in_system = {
											limit = {
												has_fleet_flag = flag_blink_auto_103
											}
											remove_fleet_flag = flag_blink_auto_103
											PREVPREV = {
												random_list = {
													15 = {
														set_location = {
															target = PREV
															distance = 5
															angle = random
														}
													}
													35 = {
														set_location = {
															target = PREV
															distance = 20
															angle = random
														}
													}
													40 = {
														set_location = {
															target = PREV
															distance = 30
															angle = random
														}
													}
													10 = {
														set_location = {
															target = PREV
															distance = 40
															angle = random
														}
													}
												}
											}
										}
										random_system_ambient_object = {
											limit = { has_ambient_object_flag = isbs_blink_out_auto_103 }

											destroy_ambient_object = THIS
										}
									}
								}
							}
						}
					}
				}
			}
		}

		create_ambient_object = {
			type = "isbs_blink_in_bunny_object"
		}

		last_created_ambient_object = {
			set_ambient_object_flag = "isbs_blink_in_final_auto"
			set_location = {
				target = PREV
				distance = 0.1
				angle = random
			}
		}

		set_event_locked = no

		# Clear final auto effect
		OWNER = { country_event = { id = isbs_blink.11 days = 15 } }
	}
}

# clear last auto ambient
country_event = {
	id = isbs_blink.11
	hide_window = yes
	is_triggered_only = yes

	immediate = {
		every_ambient_object = {
			limit = {
				has_ambient_object_flag = isbs_blink_in_final_auto
			}

			destroy_ambient_object = THIS
		}
	}
}

#blink marker bunny create. Fleet = blinking fleet
fleet_event = {
	id = isbs_blink.101
	hide_window = yes
	is_triggered_only = yes

	picture = GFX_evt_physics_research

	title = blink_trigger

	desc = {
		text = you_are_blink
	}

	trigger = {
		#has_fleet_flag = flag_fleet_blinking
	}

	immediate = {

		create_ambient_object = {
			type = "isbs_blink_marker_bunny_object"
		}
		last_created_ambient_object = {
			set_ambient_object_flag = "isbs_blink_marker"
			# Flag for timeout

			set_location = {
				#target = event_target:fleet_target
				target = PREV
				distance = 0.1
				angle = random
			}
		}
	}
}

# Set fleet ID, only on first entering combat
# Also clears previous auto target
fleet_event = {
	id = isbs_blink.102
	hide_window = yes
	is_triggered_only = yes

	title = id_trigger

	desc = {
		text = you_are_fleetid
	}

	immediate = {
		# Very first initialisation
		OWNER = {
			if = {
				limit = {
					check_variable = {
						which = "blink_fleet_id_country"
						value < 100
					}
				}

				set_variable = {
					which = "blink_fleet_id_country"
					value = 100
				}

				else = {
					change_variable = {
						which = "blink_fleet_id_country"
						value = 1
					}
				}
			}

			if = {
				limit = {
					check_variable = {
						which = "blink_fleet_id_country"
						value > 103
					}
				}

				set_variable = {
					which = "blink_fleet_id_country"
					value = 100
				}
			}
		}

		if = {
			limit = {
				OWNER = {
					check_variable = {
						which = "blink_fleet_id_country"
						value = 100
					}
				}
			}

			# clears any previous fleet with same ID
			OWNER = {
				random_owned_fleet = {
					limit = {
						check_variable = {
							which = "blink_fleet_id"
							value = 100
						}
					}
					set_variable = {
						which = "blink_fleet_id"
						value = 0
					}
				}

				set_variable = {
					which = "blink_fleet_selector"
					value = 100
				}
			}
			# clear auto flag from previous fleet
			SOLAR_SYSTEM = {
				random_fleet_in_system = {
					limit = {
						has_fleet_flag = flag_auto_100
					}
					remove_fleet_flag = flag_auto_100
				}
			}
			set_variable = {
				which = "blink_fleet_id"
				value = 100
			}

			else = {
				if = {
					limit = {
						OWNER = {
							check_variable = {
								which = "blink_fleet_id_country"
								value = 101
							}
						}
					}

					# clears any previous fleet with same ID
					OWNER = {
						random_owned_fleet = {
							limit = {
								check_variable = {
									which = "blink_fleet_id"
									value = 101
								}
							}
							set_variable = {
								which = "blink_fleet_id"
								value = 0
							}
						}

						set_variable = {
							which = "blink_fleet_selector"
							value = 101
						}
					}

					# clear auto flag from previous fleet
					SOLAR_SYSTEM = {
						random_fleet_in_system = {
							limit = {
								has_fleet_flag = flag_auto_101
							}
							remove_fleet_flag = flag_auto_101
						}
					}
					set_variable = {
						which = "blink_fleet_id"
						value = 101
					}

					else = {
						if = {
							limit = {
								OWNER = {
									check_variable = {
										which = "blink_fleet_id_country"
										value = 102
									}
								}
							}

							# clears any previous fleet with same ID
							OWNER = {
								random_owned_fleet = {
									limit = {
										check_variable = {
											which = "blink_fleet_id"
											value = 102
										}
									}
									set_variable = {
										which = "blink_fleet_id"
										value = 0
									}
								}

								set_variable = {
									which = "blink_fleet_selector"
									value = 102
								}
							}

							# clear auto flag from previous fleet
							SOLAR_SYSTEM = {
								random_fleet_in_system = {
									limit = {
										has_fleet_flag = flag_auto_102
									}
									remove_fleet_flag = flag_auto_102
								}
							}
							set_variable = {
								which = "blink_fleet_id"
								value = 102
							}

							else = {
								if = {
									limit = {
										OWNER = {
											check_variable = {
												which = "blink_fleet_id_country"
												value = 103
											}
										}
									}

									# clears any previous fleet with same ID
									OWNER = {
										random_owned_fleet = {
											limit = {
												check_variable = {
													which = "blink_fleet_id"
													value = 103
												}
											}
											set_variable = {
												which = "blink_fleet_id"
												value = 0
											}
										}

										set_variable = {
											which = "blink_fleet_selector"
											value = 103
										}
									}

									# clear auto flag from previous fleet
									SOLAR_SYSTEM = {
										random_fleet_in_system = {
											limit = {
												has_fleet_flag = flag_auto_103
											}
											remove_fleet_flag = flag_auto_103
										}
									}

									set_variable = {
										which = "blink_fleet_id"
										value = 103
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

#blink marker
fleet_event = {
	id = isbs_blink.110
	hide_window = yes
	is_triggered_only = yes

	picture = GFX_evt_physics_research

	title = blink_trigger

	desc = {
		text = you_are_blink
	}

	trigger = {
		#has_fleet_flag = flag_fleet_blinking
	}

	immediate = {

	}
}

#blink marker bunny left
fleet_event = {
	id = isbs_blink.111
	hide_window = yes
	is_triggered_only = yes

	picture = GFX_evt_physics_research

	title = blink_trigger

	desc = {
		text = you_are_blink
	}

	trigger = {
		#has_fleet_flag = flag_fleet_blinking
	}

	immediate = {
		set_location = {
			#target = event_target:fleet_target
			target = THIS
			distance = 15
			angle = 180
		}
	}
}

country_event = {
	id = isbs_blink.96
	hide_window = yes
	is_triggered_only = yes
	picture = GFX_evt_physics_research

	title = isbs_blink.98.name

	desc = {
		text = isbs_blink.98.desc
	}

	immediate = {		
		every_ambient_object = {
			limit = {
				OR = {
					has_ambient_object_flag = isbs_blink_in_final_auto
					has_ambient_object_flag = isbs_blink_out_auto_100
					has_ambient_object_flag = isbs_blink_out_auto_101
					has_ambient_object_flag = isbs_blink_out_auto_102
					has_ambient_object_flag = isbs_blink_out_auto_103
				}
			}

			destroy_ambient_object = THIS
		}
	}
}

# auto_blink_test
country_event = {
	id = isbs_blink.97
	hide_window = yes
	is_triggered_only = yes
	picture = GFX_evt_physics_research

	title = isbs_blink.98.name

	desc = {
		text = isbs_blink.98.desc
	}

	immediate = {
		every_owned_fleet = {
			limit = {
				OWNER = {
					count_owned_ships = {
						limit = {
							FLEET = { is_same_value = PREVPREVPREV }
							is_ship_size = blink_ship
						}
						count > 0
					}
				}
			}

			set_fleet_flag = flag_blink_auto_on
		}
	}
}

# turn on energy cost
country_event = {
	id = isbs_blink.98
	hide_window = no
	is_triggered_only = yes
	picture = GFX_evt_physics_research

	title = isbs_blink.98.name

	desc = {
		text = isbs_blink.98.desc
	}

	immediate = {
		if = {
			limit = {
				has_country_flag = flag_disable_blink_cost
			}
			remove_country_flag = flag_disable_blink_cost
		}
	}

	option = {
		name = isbs_blink.98.a
	}
}

# turn off energy cost permanently until .98 is called
country_event = {
	id = isbs_blink.99
	hide_window = no
	is_triggered_only = yes
	picture = GFX_evt_physics_research

	title = isbs_blink.99.name

	desc = {
		text = isbs_blink.99.desc
	}

	immediate = {
		set_country_flag = flag_disable_blink_cost
	}

	option = {
		name = isbs_blink.99.a
	}
}

#No selected fleet error
country_event = {
	id = isbs_blink.197
	hide_window = no
	is_triggered_only = yes
	picture = GFX_evt_physics_research

	title = isbs_blink.197.name

	desc = {
		text = isbs_blink.197.desc
	}

	immediate = {

	}

	option = {
		name = isbs_blink.197.a
	}
}

#blink failed error message
country_event = {
	id = isbs_blink.198
	hide_window = no
	is_triggered_only = yes
	picture = GFX_evt_physics_research

	title =  isbs_blink.198.name

	desc = {
		text =  isbs_blink.198.desc
	}

	immediate = {

	}

	option = {
		name =  isbs_blink.198.a
	}
}

# Fleet selector show fleet
fleet_event = {
	id = isbs_blink.199
	hide_window = yes
	is_triggered_only = yes

	immediate = {
	}
}

#blink marker bunny left
country_event = {
	id = isbs_blink.200
	hide_window = no
	is_triggered_only = yes

	picture = GFX_evt_physics_research

	title = blink_trigger

	desc = {
		text = you_are_failed
	}

	trigger = {
		#has_fleet_flag = flag_fleet_blinking
	}

	immediate = {
	}

	option = {
		name = failed
	}
}