sweden_to_the_fold = {
	type = country
		
	allow = {
		tag = HSA
		government = merchant_republic
		exists = SWE
		is_subject = no
		is_lesser_in_union = no
		
		NOT = {
			trade_agreement_with = SWE
		}
		
	}
	
	abort = {
		is_subject = yes
		is_lesser_in_union = yes
		NOT = {
			exists = SWE
		}
		NOT = {
			government = merchant_republic
		}
	}
	
	success = {
		trade_agreement_with = SWE
	}
	chance = {
		factor = 1000
	}
	effect = {
		merchants = 2
		treasury = 10
		prestige = 0.1
	}
}

england_to_the_fold = {
	type = country
		
	allow = {
		tag = HSA
		government = merchant_republic
		exists = ENG
		is_subject = no
		is_lesser_in_union = no
		NOT = {
			trade_agreement_with = ENG
		}
	}
	
	abort = {
		is_subject = yes
		is_lesser_in_union = yes
		NOT = {
			exists = ENG
		}
		NOT = {
			government = merchant_republic
		}
	}
	
	success = {
		trade_agreement_with = ENG
	}
	chance = {
		factor = 1000
	}
	effect = {
		treasury = 20
		merchants = 3
		prestige = 0.1
	}
}

save_the_league = {
	type = country
	
	allow = {
		tag = HSA
		government = merchant_republic
		NOT = {
			is_subject = yes
			is_lesser_in_union = yes
		}
		num_of_league_members = 2
		NOT = {
			num_of_league_members = 3
		}
	}
	abort = {
		is_subject = yes
		is_lesser_in_union = yes
		NOT = {
			government = merchant_republic
		}
	}
	success = {
		num_of_league_members = 6
	}
	chance = {
		factor = 5000
	}
	effect = {
		treasury = 50
		merchants = 3
		prestige = 0.1
	}
}

end_sound_toll = {
	type = country
	
	allow = {
		tag = HSA
		government = merchant_republic
		NOT = {
			has_country_modifier = free_shipping_through_the_sound
		}
		NOT = {
			is_subject = yes
			is_lesser_in_union = yes
		}
		12 = {
			owner = {
				has_country_modifier = sound_toll
			}
		}
	}
	abort = {
		NOT = {
			government = merchant_republic
		}
		is_subject = yes
		is_lesser_in_union = yes
	}
	success = {
		OR = {
			AND = {
				controls = 6
				controls = 12
			}
			AND = {
				any_known_country = {
					has_country_modifier = sound_toll
					relation = {who = THIS value = 190}
				}
			}
		}
	}
	chance = {
		factor = 5000
	}
	effect = {
		add_country_modifier = {
			name = "free_shipping_through_the_sound"
			duration = -1
		}
	}
}

gain_swedish_iron = {
	type = country
	
	allow = {
		TAG = HSA
		owns = 45
		45 = {
			cot = yes
		}
		government = merchant_republic
		NOT = {
			trade_rights = {
				TAG = SWE
				trade_goods = iron
			}
		}
		exists = SWE
		SWE = {
			iron = 1
		}
	}
	abort = {
		NOT = {
			government = merchant_republic
			exists = SWE
			SWE = {
				iron = 1
			}
		}
	}
	success = {
		trade_rights = {
			TAG = SWE
			trade_goods = iron
		}
	}
	chance = {
		factor = 2000
	}
	effect = {
		treasury = 30
		merchants = 2
	}
}

gain_polish_grain_trade = {
	type = country
	
	allow = {
		TAG = HSA
		owns = 45
		exists = POL
		POL = {
			grain = 1
		}
		45 = {
			cot = yes
		}
		government = merchant_republic
		NOT = {
			trade_rights = {
				TAG = POL
				trade_goods = grain
			}
			has_country_modifier = polish_grain_trade
		}
	}
	abort = {
		NOT = {
			government = merchant_republic
			exists = POL
			POL = {
				grain = 1
			}
		}
		
	}
	success = {
		trade_rights = {
			TAG = POL
			trade_goods = grain
		}
	}
	chance = {
		factor 2600
	}
	effect = {
		add_country_modifier = {
			name = "polish_grain_trade"
			duration = -1
		}
	}
}