tr_est_piracy_adopt = {
	custom_tooltip = tr_est_piracy_adopt_desc

	modifier = {
		piracy_growth_mult = -0.25
	}
	
	on_enabled = {
		if = {
			limit = {
				is_at_war = yes
			}
			add_modifier = {
				modifier = "mod_est_piracy_adopt"
				days = -1
			}
		}
	}
}

tr_est_piracy_finish = {
	custom_tooltip = tr_est_piracy_finish_effect

	modifier = {	
		army_damage_mult = 0.15
		ascension_perks_add = 1
	}

	tradition_swap = {
		name = tr_est_piracy_finish_passive_AI
		inherit_icon = yes
		inherit_name = yes
		trigger = { est_AI_no_passive_aggressive_traditons = yes }
		modifier = {	
			army_damage_mult = 0.25
			ascension_perks_add = 1
		}
		weight = { factor = 1 }
	}
}


tr_est_piracy_1 = {
	modifier = {
		ship_fire_rate_mult = 0.05
		ship_weapon_damage = 0.05
	}
	
	ai_weight = { factor = 5000 }
}

tr_est_piracy_2 = {
	custom_tooltip = tr_est_piracy_2_desc

	ai_weight = { factor = 5000 }
}

tr_est_piracy_3 = {
	custom_tooltip = tr_est_piracy_3_desc

	possible = { has_tradition = tr_est_piracy_2 }
	
	on_enabled = {
		if = {
			limit = {
				Not = { has_global_flag = est_piracy_2_picked_flag }
			}
			set_global_flag = est_piracy_2_picked_flag
		}
	}

	tradition_swap = {
		name = tr_est_piracy_3_AI
		inherit_icon = yes
		inherit_name = yes
		trigger = { is_ai = yes }
		modifier = {
			country_energy_produces_mult = 0.10
		}
		weight = { factor = 1 }
	}
	
	ai_weight = { factor = 5000 }
}

tr_est_piracy_4 = {
	custom_tooltip = tr_est_piracy_4_desc

	possible = { has_tradition = tr_est_piracy_3 }
	
	on_enabled = {
		every_country = {
			limit = { 
				is_rival = root 
				Not = {
					has_modifier = mod_est_piracy_3
				}
			}
			add_modifier = {
				modifier = "mod_est_piracy_3"
				days = -1
			}	
		}
	}
	
	modifier = {
		max_rivalries = 1
	}

	tradition_swap = {
		name = tr_est_piracy_3_other
		inherit_icon = yes
		inherit_name = yes
		trigger = {
			OR = {
				est_AI_no_passive_aggressive_traditons = yes
				has_valid_civic = civic_fanatic_purifiers
				has_valid_civic = civic_inwards_perfection
				has_valid_civic = civic_hive_devouring_swarm
				has_valid_civic = civic_machine_terminator		
				has_valid_civic = civic_machine_assimilator		
			}
		}
		modifier = {
			ship_weapon_damage = 0.05
		}
		weight = { factor = 1 }
	}

	ai_weight = { factor = 5000 }
}

tr_est_piracy_5 = {
	custom_tooltip = tr_est_piracy_5_desc

	modifier = {
		pop_cat_ruler_happiness = 0.15
		pop_cat_worker_political_power = -0.25
	}

	tradition_swap = {
		custom_tooltip = tr_est_piracy_5_slavery_desc
	
		name = tr_est_piracy_5_slavery
		inherit_icon = yes
		inherit_name = yes
		trigger = {
			has_policy_flag = slavery_allowed
			NOR = {
				has_ethic = ethic_fanatic_egalitarian
				has_ethic = ethic_egalitarian
			}
		}
		modifier = {
			pop_cat_ruler_happiness = 0.15
			pop_cat_slave_political_power = -0.25
			pop_cat_worker_political_power = -0.25
		}
		weight = { factor = 1 }
	}

	tradition_swap = {
		name = tr_est_piracy_5_nice
		trigger = {
			has_policy_flag = slavery_not_allowed
			Or = {
				has_ethic = ethic_fanatic_egalitarian
				has_ethic = ethic_egalitarian
			}
		}
		modifier = {
			pop_growth_from_immigration = 0.15
			ship_speed_mult = 0.10
		}
		weight = { factor = 1 }
	}
	
	ai_weight = { factor = 5000 }
}