namespace = shipsinscaling

event = {
	id = shipsinscaling.1
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		set_global_flag = has_shipsinscaling
	}
}

# Star Game
event = {
	id = shipsinscaling.2
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		every_galaxy_fleet = {
			every_owned_ship = {
				#Longer Battles Mode
				ship_event = { id = shipsinscaling.4 }
			}
		}
	}
}

#Fleet entering a new system
fleet_event = {
	id = shipsinscaling.3
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		every_owned_ship = {
			#Longer Battles Mode
			ship_event = { id = shipsinscaling.4 }
		}
	}
}

# Longer Battles Mode
ship_event = {
    id = shipsinscaling.4
    hide_window = yes
	
	is_triggered_only = yes
	
    trigger = {
		NOT = { has_global_flag = longer_battles_mode_off }
        OR = {
            is_ship_class = shipclass_military
            is_ship_class = shipclass_transport
            is_ship_class = shipclass_starbase
            is_ship_class = shipclass_military_station
            is_ship_class = shipclass_military_special
		}
        NOR = {
            has_modifier = fire_rate_reduction
            has_modifier = hp_increased
        }
    }
    immediate = {
        add_modifier = { modifier = fire_rate_reduction }
        add_modifier = { modifier = hp_increased }
    }
}

# Applying RS Settings
event = {
	id = shipsinscaling.5
	hide_window = yes
	is_triggered_only = yes
	
	immediate = {
		if = {
			limit = { has_global_flag = sustained_ship_acceleration }
			sustained_acceleration_mode_on = yes
		}
		if = {
			limit = { has_global_flag = longer_battles_mode_off }
			longer_battles_mode_off = yes
		}
	}
}