#Remember to change the tooltips if the effects are changed
#State scope. Prev is target country.
LIT_iron_wolf_up_effect = {
	if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_good_2
		}
		add_stability = 0.1
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_good_1
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_good_1
			add_idea = LIT_iron_wolf_idea_good_2
		}
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_good_1
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_good_1
			add_idea = LIT_iron_wolf_idea_good_2
		}
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_1
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_bad_1
			add_idea = LIT_iron_wolf_idea_good_1
		}
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_2
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_bad_2
			add_idea = LIT_iron_wolf_idea_bad_1
		}
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_3
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_bad_3
			add_idea = LIT_iron_wolf_idea_bad_2
		}
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_4
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_bad_4
			add_idea = LIT_iron_wolf_idea_bad_3
		}
	}
}

LIT_iron_wolf_down_effect = {
	if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_4
		}
		if = { #Easier civil war for AI on historical since we don't want historical Lithuanian AI to join the Axis and so on
			limit = {
				is_ai = yes
				OR = {
					AND = {
						is_historical_focus_on = yes
						has_game_rule = {
							rule = LIT_ai_behavior
							option = DEFAULT
						}
					}
					has_country_flag = LIT_AI_RANDOM_HISTORICAL
					has_game_rule = {
						rule = LIT_ai_behavior
						option = HISTORICAL
					}
				}
			}
			start_civil_war = {
				ideology = fascism
				size = 0.2
				army_ratio = 0.2
				capital = 282
			}
		}
		else = { #Regular CW
			start_civil_war = {
				ideology = fascism
				size = 0.45
				army_ratio = 0.3
				capital = 282
			}
		}
		
		hidden_effect = {
			uncomplete_national_focus = {
				focus = LIT_free_voldemares
				uncomplete_children = yes
			}
			unlock_national_focus = LIT_exile_voldemares
		}
		set_country_flag = fought_iron_wolf_flag
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_3
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_bad_3
			add_idea = LIT_iron_wolf_idea_bad_4
		}
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_2
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_bad_2
			add_idea = LIT_iron_wolf_idea_bad_3
		}
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_1
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_bad_1
			add_idea = LIT_iron_wolf_idea_bad_2
		}
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_good_1
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_good_1
			add_idea = LIT_iron_wolf_idea_bad_1
		}
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_good_2
		}
		swap_ideas = {
			remove_idea = LIT_iron_wolf_idea_good_2
			add_idea = LIT_iron_wolf_idea_good_1
		}
	}
	
}

LIT_remove_iron_wolf_effect = {
	if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_4
		}
		remove_ideas = LIT_iron_wolf_idea_bad_4
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_3
		}
		remove_ideas = LIT_iron_wolf_idea_bad_3
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_2
		}
		remove_ideas = LIT_iron_wolf_idea_bad_2
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_bad_1
		}
		remove_ideas = LIT_iron_wolf_idea_bad_1
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_good_1
		}
		remove_ideas = LIT_iron_wolf_idea_good_1
	}
	else_if = {
		limit = {
			has_idea = LIT_iron_wolf_idea_good_2
		}
		remove_ideas = LIT_iron_wolf_idea_good_2
	}
	
}

EST_vaps_down_effect = {
	if = {
		limit = {
			has_idea = EST_vaps_idea_4
		}
		if = { #Easier civil war for AI on historical since we don't want historical Estonian AI to puppet Finland and form the Fino-Ugra Empire
			limit = {
				is_ai = yes
				OR = {
					AND = {
						is_historical_focus_on = yes
						has_game_rule = {
							rule = EST_ai_behavior
							option = DEFAULT
						}
					}
					has_country_flag = EST_AI_RANDOM_HISTORICAL
					has_game_rule = {
						rule = EST_ai_behavior
						option = HISTORICAL
					}
				}
			}
			start_civil_war = {
				ideology = fascism
				size = 0.2
				army_ratio = 0.2
			}
		}
		else = { #Regular CW
			start_civil_war = {
				ideology = fascism
				size = 0.5
				army_ratio = 0.35
			}
		}
	}
	else_if = {
		limit = {
			has_idea = EST_vaps_idea_3
		}
		swap_ideas = {
			remove_idea = EST_vaps_idea_3
			add_idea = EST_vaps_idea_4
		}
	}
	else_if = {
		limit = {
			has_idea = EST_vaps_idea_2
		}
		swap_ideas = {
			remove_idea = EST_vaps_idea_2
			add_idea = EST_vaps_idea_3
		}
	}
	else_if = {
		limit = {
			has_idea = EST_vaps_idea_1
		}
		swap_ideas = {
			remove_idea = EST_vaps_idea_1
			add_idea = EST_vaps_idea_2
		}
	}
}

EST_vaps_up_effect = {
	if = {
		limit = {
			has_idea = EST_vaps_idea_1
		}
	}
	else_if = {
		limit = {
			has_idea = EST_vaps_idea_2
		}
		swap_ideas = {
			remove_idea = EST_vaps_idea_2
			add_idea = EST_vaps_idea_1
		}
	}
	else_if = {
		limit = {
			has_idea = EST_vaps_idea_3
		}
		swap_ideas = {
			remove_idea = EST_vaps_idea_3
			add_idea = EST_vaps_idea_2
		}
	}
	else_if = {
		limit = {
			has_idea = EST_vaps_idea_4
		}
		swap_ideas = {
			remove_idea = EST_vaps_idea_4
			add_idea = EST_vaps_idea_3
		}
	}
}

remove_vaps_effect = {
	if = {
		limit = {
			has_idea = EST_vaps_idea_4
		}
		remove_ideas = EST_vaps_idea_4
	}
	else_if = {
		limit = {
			has_idea = EST_vaps_idea_3
		}
		remove_ideas = EST_vaps_idea_3
	}
	else_if = {
		limit = {
			has_idea = EST_vaps_idea_2
		}
		remove_ideas = EST_vaps_idea_2
	}
	else_if = {
		limit = {
			has_idea = EST_vaps_idea_1
		}
		remove_ideas = EST_vaps_idea_1
	}
}

remove_perkonkrust_effect = {
	if = {
		limit = {
			has_idea = LAT_perkonkrust_idea_neu_1
		}
		remove_ideas = LAT_perkonkrust_idea_neu_1
	}
	else_if = {
		limit = {
			has_idea = LAT_perkonkrust_idea
		}
		remove_ideas = LAT_perkonkrust_idea
	}
	else_if = {
		limit = {
			has_idea = perkonkrust_fas_idea_1
		}
		remove_ideas = perkonkrust_fas_idea_1
	}
}

look_north_focus_effect = {
	if = {
		limit = { FIN = { is_in_faction = no } }
		if = {
			limit = {
				FIN = { has_idea = FIN_the_lone_wolf }
			}
			custom_effect_tooltip = FIN_the_lone_wolf_no_faction_tt
		}
		else = {
			FIN = {
				country_event = {
					id = BALTIC_events.2
					days = 1
				}
			}
		}
	}
	if = {
		limit = { NOR = { is_in_faction = no } }
		NOR = {
			country_event = {
				id = BALTIC_events.2
				days = 2
			}
		}
	}
	if = {
		limit = { SWE = { is_in_faction = no } }
		SWE = {
			country_event = {
				id = BALTIC_events.2
				days = 3
			}
		}
	}
	if = {
		limit = { DEN = { is_in_faction = no } }
		DEN = {
			country_event = {
				id = BALTIC_events.2
				days = 4
			}
		}
	}
}

claim_greater_LIT_effect = {
	784 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	97 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1241 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1242 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1238 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1247 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1248 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1239 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1243 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1244 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1173 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	96 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1240 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1246 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	95 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1261 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1610 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1535 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1484 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	94 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1534 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1533 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	93 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	206 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1264 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1263 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	204 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1094 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1611 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1265 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	194 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1084 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	241 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	207 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1064 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1085 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	199 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	201 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1101 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	198 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1262 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	834 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1500 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	192 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	197 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1606 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	203 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1102 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	202 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	226 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1612 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1103 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	193 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1100 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1537 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	259 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1536 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	221 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1099 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	240 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1076 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	225 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1082 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	220 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1083 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	224 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1111 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1112 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	243 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	242 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	1104 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
	210 = { add_claim_by = ROOT set_state_flag = greater_lithuania_flag }
}
remove_all_temp_boosts_baltic = {
	if = {
		limit = { has_idea = BALTIC_disloyal_parliament }
		remove_ideas = BALTIC_disloyal_parliament
	}
	if = {
		limit = { has_idea = BALTIC_restore_workers_republic_idea }
		remove_ideas = BALTIC_restore_workers_republic_idea
	}
}
give_fascist_tank_licences = { #does not have to take non-dlc into account because everyone who gets the Baltic trees also has the tank designer!
	if = {
		limit = {
			has_tech = main_battle_tank_chassis
		}
		if = {
			limit = { has_dlc = "Death or Dishonor" }
			create_production_license = {
				target = ROOT
				equipment = {
					type = modern_tank_chassis_1
				}
				cost_factor = 0
			}
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = modern_tank_chassis_1
				amount = 360
				producer = PREV
			}
		}
	}
	else_if = {
		limit = {
			has_tech = advanced_medium_tank_chassis
		}
		if = {
			limit = { has_dlc = "Death or Dishonor" }
			create_production_license = {
				target = ROOT
				equipment = {
					type = medium_tank_chassis_3
				}
				cost_factor = 0
			}
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = medium_tank_chassis_3
				amount = 360
				producer = PREV
			}
		}
	}
	else_if = {
		limit = {
			has_tech = improved_medium_tank_chassis
		}
		if = {
			limit = { has_dlc = "Death or Dishonor" }
			create_production_license = {
				target = ROOT
				equipment = {
					type = medium_tank_chassis_2
				}
				cost_factor = 0
			}
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = medium_tank_chassis_2
				amount = 360
				producer = PREV
			}
		}
	}
	else_if = {
		limit = {
			has_tech = basic_medium_tank_chassis
		}
		if = {
			limit = { has_dlc = "Death or Dishonor" }
			create_production_license = {
				target = ROOT
				equipment = {
					type = medium_tank_chassis_1
				}
				cost_factor = 0
			}
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = medium_tank_chassis_1
				amount = 360
				producer = PREV
			}
		}
	}
	else = {
		if = {
			limit = { has_dlc = "Death or Dishonor" }
			create_production_license = {
				target = ROOT
				equipment = {
					type = light_tank_chassis_2
				}
				cost_factor = 0
			}
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = light_tank_chassis_2
				amount = 360
				producer = PREV
			}
		}
	}
}

give_aircraft_and_licences = {	
	if = {
		limit = {
			#has_tech = jet_fighter2
			is_special_project_completed = sp:sp_air_axial_jet_engine
		}
		create_production_license = {
			target = ROOT
			equipment = {
				type = jet_fighter_equipment_2
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = jet_fighter_equipment_2
				amount = 360
				producer = PREV
			}
		}
	}
	else_if = {
		limit = {
			#has_tech = jet_fighter1
			is_special_project_completed = sp:sp_air_jet_engine
		}
		create_production_license = {
			target = ROOT
			equipment = {
				type = jet_fighter_equipment_1
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = jet_fighter_equipment_1
				amount = 360
				producer = PREV
			}
		}
	}
	else_if = {
		limit = {
			has_tech = fighter3
		}
		create_production_license = {
			target = ROOT
			equipment = {
				type = fighter_equipment_3
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = fighter_equipment_3
				amount = 360
				producer = PREV
			}
		}
	}
	else_if = {
		limit = {
			has_tech = fighter2
		}
		create_production_license = {
			target = ROOT
			equipment = {
				type = fighter_equipment_2
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = fighter_equipment_2
				amount = 360
				producer = PREV
			}
		}
	}
	else_if = {
		limit = {
			has_tech = fighter1
		}
		create_production_license = {
			target = ROOT
			equipment = {
				type = fighter_equipment_1
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = fighter_equipment_1
				amount = 360
				producer = PREV
			}
		}
	}
	else_if = {
		limit = {
			NOT = {
				has_dlc = "By Blood Alone"
			}
		}
		create_production_license = {
			target = ROOT
			equipment = {
				type = fighter_equipment_0
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = fighter_equipment_0
				amount = 360
				producer = PREV
			}
		}
	}
	else = {
		create_production_license = {
			target = ROOT
			equipment = {
				type = small_plane_airframe_0
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = small_plane_airframe_0
				amount = 360
				producer = PREV
			}
		}
	}
}

baltic_give_allied_equipment = {
	if = {
		limit = {
			has_tech = advanced_infantry_weapons
		}
		create_production_license = {
			target = ROOT
			equipment = {
				type = infantry_equipment_3
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = infantry_equipment_3
				amount = 2500
				producer = PREV
			}
		}
	}
	else_if = {
		limit = {
			has_tech = improved_infantry_weapons
		}
		create_production_license = {
			target = ROOT
			equipment = {
				type = infantry_equipment_2
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = infantry_equipment_2
				amount = 2500
				producer = PREV
			}
		}
	}
	else_if = {
		limit = {
			has_tech = infantry_weapons1
		}
		create_production_license = {
			target = ROOT
			equipment = {
				type = infantry_equipment_1
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = infantry_equipment_1
				amount = 2500
				producer = PREV
			}
		}
	}
	else = {
		create_production_license = {
			target = ROOT
			equipment = {
				type = infantry_equipment_0
			}
			cost_factor = 0
		}
		ROOT = {
			add_equipment_to_stockpile = {
				type = infantry_equipment_0
				amount = 2500
				producer = PREV
			}
		}
	}
}