﻿je_brazil_navy = {
	icon = "gfx/interface/icons/event_icons/bicorne_hat.dds"

	group = je_group_historical_content

	is_shown_when_inactive = {
		c:BRZ ?= THIS
		has_dlc_feature = rp1_content
	}

	possible = {
		country_rank >= rank_value:minor_power
		any_scope_character = {
			has_role = admiral
		}
		OR = {
			has_technology_researched = power_of_the_purse
			has_technology_researched = screw_frigate
		}
	}

	immediate = {
		set_variable = {
			name = brazil_navy_var
			value = 0
		}
		# startup event
		trigger_event = {
			id = brazil_navy.1
			popup = yes
		}
	}

	on_monthly_pulse = {
		random_events = {
			100 = 0
			5 = brazil_navy.2 # Navy complains that it's not as powerful as it should be
			5 = brazil_navy.3 # navy is strong
		}
		effect = {
			if = {
				limit = {
					NOT = {
						any_country = {
							naval_power_projection > root.naval_power_projection
							count > 10
						}
					}
					NOT = {
						any_country = {
							naval_power_projection > root.naval_power_projection
							country_is_in_south_america = yes
						}
					}
				}
				change_variable = {
					name = brazil_navy_var
					add = 1
				}
			}
		}
	}

	is_progressing = {
		NOT = {
			any_country = {
				naval_power_projection > root.naval_power_projection
				count > 10
			}
		}
		NOT = {
			any_country = {
				naval_power_projection > root.naval_power_projection
				country_is_in_south_america = yes
			}
		}
	}

	complete = {
		any_scope_character = {
			has_role = admiral
		}
		scope:journal_entry = {
			is_goal_complete = yes
		}
		NOT = {
			any_country = {
				naval_power_projection > root.naval_power_projection
				count > 10
			}
		}
		custom_tooltip = {
			text = best_south_american_navy
			NOT = {
				any_country = {
					naval_power_projection > root.naval_power_projection
					country_is_in_south_america = yes
				}
			}
		}
	}

	on_complete = {
		trigger_event = {
			id = brazil_navy.4
			popup = yes
		}
		if = {
			limit = {
				has_journal_entry = je_pedro_brazil
			}
			show_as_tooltip = {
				add_pedropoint_effect = yes
			}
		}
	}

	fail = {
		country_rank < rank_value:minor_power
	}

	timeout = 25550

	current_value = {
		value = root.var:brazil_navy_var
	}

	goal_add_value = {
		add = 480
	}

	progressbar = yes

	weight = 100

	can_revolution_inherit = no
	transferable = no
	should_be_pinned_by_default = yes
}