#################################
#
# THE REPUBLIC
# - Trade Events
#
#################################

# Written by Henrik Eklund

namespace = REP

### Shipping Events

# Thieving Captain (AI)
character_event = {
	id = REP.1
	hide_window = yes
	
	ai = yes
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
		liege = { is_merchant_republic = yes }
		OR = {
			liege = { ai = no }
			liege = {
				any_vassal = {
					is_patrician = yes
					ai = no
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1520
		
		modifier = {
			factor = 1.25
			realm_stewardship = 70
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 65
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 60
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 55
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 50
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 45
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 10 }
		}
		
		modifier = {
			factor = 1.25
			realm_intrigue = 70
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 65
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 60
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 55
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 50
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 45
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_intrigue = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_intrigue = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_intrigue = 10 }
		}
	}
	
	immediate = {
		if = {
			limit = {
				liege = { ai = no }
			}
			liege = { 
				character_event = { id = REP.2 } 
			}
		}
		if = {
			limit = {
				liege = { 
					any_vassal = {
						is_patrician = yes
						ai = no 
					}
				}
			}
			liege = {
				random_vassal = {
					limit = {
						is_patrician = yes
						ai = no
					}
					character_event = { id = REP.2 } 
				}
			}
		}
	}
}

# Thieving Captain (Player)
character_event = {
	id = REP.2
	desc = EVTDESC_REP_002
	picture = GFX_evt_trade_post_republic
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_002
		scaled_wealth = -0.125
	}
}

# Spoiled Cargo
character_event = {
	id = REP.3
	desc = EVTDESC_REP_003
	picture = GFX_evt_merchant_ship_at_sea_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
	
	mean_time_to_happen = {
		months = 1220
		
		modifier = {
			factor = 1.25
			realm_stewardship = 70
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 65
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 60
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 55
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 50
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 45
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_003
		scaled_wealth = -0.125
	}
}

# Ship Lost in Storm (AI)
character_event = {
	id = REP.4
	hide_window = yes
	
	ai = yes
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
		liege = { is_merchant_republic = yes }
		OR = {
			liege = { ai = no }
			liege = {
				any_vassal = {
					is_patrician = yes
					ai = no
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1520
		
		modifier = {
			factor = 1.25
			realm_stewardship = 70
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 65
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 60
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 55
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 50
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 45
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 10 }
		}
	}
	
	immediate = {
		if = {
			limit = {
				liege = { ai = no }
			}
			liege = { 
				character_event = { id = REP.5 } 
			}
		}
		if = {
			limit = {
				liege = { 
					any_vassal = {
						is_patrician = yes
						ai = no 
					}
				}
			}
			liege = {
				random_vassal = {
					limit = {
						is_patrician = yes
						ai = no
					}
					character_event = { id = REP.5 } 
				}
			}
		}
	}
}

# Ship Lost in Storm (Player)
character_event = {
	id = REP.5
	desc = EVTDESC_REP_005
	picture = GFX_evt_bad_news
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_005
		scaled_wealth = -0.125
	}
}

# Pirates Attack Ships
character_event = {
	id = REP.6
	desc = EVTDESC_REP_006
	picture = GFX_evt_merchant_ship_at_sea_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
	
	mean_time_to_happen = {
		months = 1220
		
		modifier = {
			factor = 1.25
			realm_stewardship = 70
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 65
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 60
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 55
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 50
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 45
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 10 }
		}
		modifier = {
			factor = 1.25
			realm_martial = 70
		}
		modifier = {
			factor = 1.25
			realm_martial = 65
		}
		modifier = {
			factor = 1.25
			realm_martial = 60
		}
		modifier = {
			factor = 1.25
			realm_martial = 55
		}
		modifier = {
			factor = 1.25
			realm_martial = 50
		}
		modifier = {
			factor = 1.25
			realm_martial = 45
		}
		modifier = {
			factor = 1.25
			realm_martial = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_martial = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_martial = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_martial = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_006
		scaled_wealth = -0.125
	}
}

# Pirates Captured
character_event = {
	id = REP.7
	desc = EVTDESC_REP_007
	picture = GFX_evt_merchant_ship_at_sea_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
	
	mean_time_to_happen = {
		months = 1020
		
		modifier = {
			factor = 0.8
			realm_stewardship = 70
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 65
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 60
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 55
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 50
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 45
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 10 }
		}
		modifier = {
			factor = 0.8
			realm_martial = 70
		}
		modifier = {
			factor = 0.8
			realm_martial = 65
		}
		modifier = {
			factor = 0.8
			realm_martial = 60
		}
		modifier = {
			factor = 0.8
			realm_martial = 55
		}
		modifier = {
			factor = 0.8
			realm_martial = 50
		}
		modifier = {
			factor = 0.8
			realm_martial = 45
		}
		modifier = {
			factor = 0.8
			realm_martial = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_martial = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_martial = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_martial = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_007
		scaled_wealth = 0.25
	}
}

# Valuable Spice Obtained
character_event = {
	id = REP.8
	desc = EVTDESC_REP_008
	picture = GFX_evt_busy_trading_dock_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
		in_revolt = no
	}
	
	mean_time_to_happen = {
		months = 1020
		
		modifier = {
			factor = 0.8
			realm_stewardship = 70
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 65
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 60
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 55
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 50
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 45
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_008
		scaled_wealth = 0.25
	}
}

# New Markets Discovered
character_event = {
	id = REP.9
	desc = EVTDESC_REP_009
	picture = GFX_evt_trade_post_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
	
	mean_time_to_happen = {
		months = 1020
		
		modifier = {
			factor = 0.8
			realm_stewardship = 70
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 65
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 60
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 55
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 50
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 45
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_009
		scaled_wealth = 0.25
	}
}

# Lost Ship Appears
character_event = {
	id = REP.10
	desc = EVTDESC_REP_010
	picture = GFX_evt_merchant_ship_at_sea_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
		
	mean_time_to_happen = {
		months = 1020
		
		modifier = {
			factor = 0.8
			realm_stewardship = 70
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 65
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 60
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 55
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 50
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 45
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_010
		scaled_wealth = 0.25
	}
}

# Dockworkers Strike
character_event = {
	id = REP.11
	desc = EVTDESC_REP_011
	picture = GFX_evt_busy_trading_dock_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
	
	mean_time_to_happen = {
		months = 1220
		
		modifier = {
			factor = 1.25
			realm_stewardship = 70
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 65
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 60
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 55
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 50
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 45
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 10 }
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 70
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 65
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 60
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 55
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 50
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 45
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_diplomacy = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_diplomacy = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_diplomacy = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_011
		scaled_wealth = -0.125
	}
}

# Warehouse Fire
character_event = {
	id = REP.12
	desc = EVTDESC_REP_012
	picture = GFX_evt_burning_house
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
	
	mean_time_to_happen = {
		months = 1220
		
		modifier = {
			factor = 1.25
			realm_stewardship = 70
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 65
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 60
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 55
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 50
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 45
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_012
		scaled_wealth = -0.125
	}
}

# Noble Books Passage (AI)
character_event = {
	id = REP.13
	hide_window = yes
	
	ai = yes
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
		liege = { is_merchant_republic = yes }
		OR = {
			liege = { ai = no }
			liege = {
				any_vassal = {
					is_patrician = yes
					ai = no
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1520
		
		modifier = {
			factor = 0.8
			realm_intrigue = 70
		}
		modifier = {
			factor = 0.8
			realm_intrigue = 65
		}
		modifier = {
			factor = 0.8
			realm_intrigue = 60
		}
		modifier = {
			factor = 0.8
			realm_intrigue = 55
		}
		modifier = {
			factor = 0.8
			realm_intrigue = 50
		}
		modifier = {
			factor = 0.8
			realm_intrigue = 45
		}
		modifier = {
			factor = 0.8
			realm_intrigue = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_intrigue = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_intrigue = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_intrigue = 10 }
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 70
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 65
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 60
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 55
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 50
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 45
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_diplomacy = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_diplomacy = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_diplomacy = 10 }
		}
	}
	
	immediate = {
		if = {
			limit = {
				liege = { ai = no }
			}
			liege = { 
				character_event = { id = REP.14 } 
			}
		}
		if = {
			limit = {
				liege = { 
					any_vassal = {
						is_patrician = yes
						ai = no 
					}
				}
			}
			liege = {
				random_vassal = {
					limit = {
						is_patrician = yes
						ai = no
					}
					character_event = { id = REP.14 } 
				}
			}
		}
	}
}

# Noble Books Passage (Player)
character_event = {
	id = REP.14
	desc = EVTDESC_REP_014
	picture = GFX_evt_trade_post_republic
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_014
		scaled_wealth = 0.25
	}
}

# Efficient Dockworkers
character_event = {
	id = REP.15
	desc = EVTDESC_REP_015
	picture = GFX_evt_busy_trading_dock_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
	
	mean_time_to_happen = {
		months = 1020
		
		modifier = {
			factor = 0.8
			realm_stewardship = 70
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 65
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 60
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 55
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 50
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 45
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 10 }
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 70
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 65
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 60
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 55
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 50
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 45
		}
		modifier = {
			factor = 0.8
			realm_diplomacy = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_diplomacy = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_diplomacy = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_diplomacy = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_015
		scaled_wealth = 0.25
	}
}

# Treasure Found!
character_event = {
	id = REP.16
	desc = EVTDESC_REP_016
	picture = GFX_evt_trade_post_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
	
	mean_time_to_happen = {
		months = 1020
		
		modifier = {
			factor = 0.8
			realm_stewardship = 70
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 65
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 60
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 55
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 50
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 45
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 10 }
		}
		modifier = {
			factor = 0.8
			realm_learning = 70
		}
		modifier = {
			factor = 0.8
			realm_learning = 65
		}
		modifier = {
			factor = 0.8
			realm_learning = 60
		}
		modifier = {
			factor = 0.8
			realm_learning = 55
		}
		modifier = {
			factor = 0.8
			realm_learning = 50
		}
		modifier = {
			factor = 0.8
			realm_learning = 45
		}
		modifier = {
			factor = 0.8
			realm_learning = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_learning = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_learning = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_learning = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_016
		scaled_wealth = 0.25
	}
}

# Improved Charts
character_event = {
	id = REP.17
	desc = EVTDESC_REP_017
	picture = GFX_evt_merchant_ship_at_sea_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
	
	mean_time_to_happen = {
		months = 1020
		
		modifier = {
			factor = 0.8
			realm_stewardship = 70
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 65
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 60
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 55
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 50
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 45
		}
		modifier = {
			factor = 0.8
			realm_stewardship = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_stewardship = 10 }
		}
		modifier = {
			factor = 0.8
			realm_learning = 70
		}
		modifier = {
			factor = 0.8
			realm_learning = 65
		}
		modifier = {
			factor = 0.8
			realm_learning = 60
		}
		modifier = {
			factor = 0.8
			realm_learning = 55
		}
		modifier = {
			factor = 0.8
			realm_learning = 50
		}
		modifier = {
			factor = 0.8
			realm_learning = 45
		}
		modifier = {
			factor = 0.8
			realm_learning = 40
		}
		modifier = {
			factor = 1.25
			NOT = { realm_learning = 30 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_learning = 20 }
		}
		modifier = {
			factor = 1.25
			NOT = { realm_learning = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_017
		scaled_wealth = 0.25
	}
}

# Captain Rams Pier
character_event = {
	id = REP.18
	desc = EVTDESC_REP_018
	picture = GFX_evt_busy_trading_dock_republic
	
	ai = no
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
	}
	
	mean_time_to_happen = {
		months = 1220
		
		modifier = {
			factor = 1.25
			realm_stewardship = 70
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 65
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 60
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 55
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 50
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 45
		}
		modifier = {
			factor = 1.25
			realm_stewardship = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_stewardship = 10 }
		}
	}
	
	option = {
		name = EVTOPTA_REP_018
		trigger = {
			NOT = { trait = drunkard }
		}
		scaled_wealth = -0.125
	}
	option = {
		name = EVTOPTB_REP_018
		tooltip_info = drunkard
		trigger = {
			trait = drunkard
		}
		scaled_wealth = -0.125
	}
}

# Mutiny! (AI)
character_event = {
	id = REP.19
	hide_window = yes
	
	ai = yes
	is_patrician = yes
	
	trigger = {
		has_dlc = "The Republic"
		liege = { is_merchant_republic = yes }
		OR = {
			liege = { ai = no }
			liege = {
				any_vassal = {
					is_patrician = yes
					ai = no
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1520
		
		modifier = {
			factor = 1.25
			realm_martial = 70
		}
		modifier = {
			factor = 1.25
			realm_martial = 65
		}
		modifier = {
			factor = 1.25
			realm_martial = 60
		}
		modifier = {
			factor = 1.25
			realm_martial = 55
		}
		modifier = {
			factor = 1.25
			realm_martial = 50
		}
		modifier = {
			factor = 1.25
			realm_martial = 45
		}
		modifier = {
			factor = 1.25
			realm_martial = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_martial = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_martial = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_martial = 10 }
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 70
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 65
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 60
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 55
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 50
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 45
		}
		modifier = {
			factor = 1.25
			realm_diplomacy = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_diplomacy = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_diplomacy = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_diplomacy = 10 }
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 70
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 65
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 60
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 55
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 50
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 45
		}
		modifier = {
			factor = 1.25
			realm_intrigue = 40
		}
		modifier = {
			factor = 0.8
			NOT = { realm_intrigue = 30 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_intrigue = 20 }
		}
		modifier = {
			factor = 0.8
			NOT = { realm_intrigue = 10 }
		}
	}
	
	immediate = {
		if = {
			limit = {
				liege = { ai = no }
			}
			liege = { 
				character_event = { id = REP.20 } 
			}
		}
		if = {
			limit = {
				liege = { 
					any_vassal = {
						is_patrician = yes
						ai = no 
					}
				}
			}
			liege = {
				random_vassal = {
					limit = {
						is_patrician = yes
						ai = no
					}
					character_event = { id = REP.20 } 
				}
			}
		}
	}
}

# Mutiny! (Player)
character_event = {
	id = REP.20
	desc = EVTDESC_REP_020
	picture = GFX_evt_merchant_ship_at_sea_republic
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_020
		wealth = -50
	}
}

### Seize Trade Post Plot

# Decision Fired
character_event = {
	id = REP.300
	desc = EVTDESC_REP_300
	picture = GFX_evt_trade_post_republic
	
	hide_from = yes
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_300
		trigger = {
			plot_power = 1.0
			NOT = { plot_power = 1.5 }
		}
		
		wealth = -100
		custom_tooltip = {
			text = EVTOPTA_REP_300_tooltip
			hidden_tooltip = {
				plot_target_char = {
					character_event = { id = REP.302 days = 5 }
				}
			}
		}
	}
	option = {
		name = EVTOPTB_REP_300
		trigger = {
			plot_power = 1.5
		}
		
		wealth = -50
		custom_tooltip = {
			text = EVTOPTB_REP_300_tooltip
			hidden_tooltip = {
				plot_target_char = {
					character_event = { id = REP.308 days = 5 }
				}
			}
		}
	}
	option = {
		name = EVTOPTC_REP_300
		trigger = {
			NOT = { plot_power = 1.0 }
		}
		
		wealth = -200
		custom_tooltip = {
			text = EVTOPTC_REP_300_tooltip
			hidden_tooltip = {
				plot_target_char = {
					character_event = { id = REP.301 days = 5 }
				}
			}
		}
	}
	option = {
		name = EVTOPTE_REP_300
		trigger = {
			is_merchant_republic = no
			plot_target_char = { 
				is_merchant_republic = no
				num_of_trade_post_diff = {
					character = ROOT
					value = 10
				}
			}
		}
		custom_tooltip = {
			text = EVTOPTE_REP_300_tooltip
			hidden_tooltip = {
				liege = {
					letter_event = { id = REP.310 days = 5 }
				}
			}
		}
	}
	option = {
		name = EVTOPTD_REP_300
		custom_tooltip = { text = EVTOPTD_REP_300_tooltip }
		cancel_plot = plot_seize_trade_post
		clr_character_flag = plot_seize_trade_post_decision_taken
	}
}

# Trade Post Owner Informed Of Bribe
character_event = {
	id = REP.301
	desc = EVTDESC_REP_301
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_301
		
		wealth = -250
		custom_tooltip = {
			text = EVTOPTA_REP_301_tooltip
			hidden_tooltip = {
				FROM = {
					character_event = { id = REP.303 days = 5 }
				}
			}
		}
	}
	option = {
		name = EVTOPTB_REP_301
		
		custom_tooltip = {
			text = EVTOPTB_REP_301_tooltip
			hidden_tooltip = {
				FROM = {
					character_event = { id = REP.306 days = 5 }
				}
			}
		}
	}
}

# Trade Post Owner Informed Of Plot Support
character_event = {
	id = REP.302
	desc = EVTDESC_REP_302
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_302
		
		wealth = -250
		custom_tooltip = {
			text = EVTOPTA_REP_302_tooltip
			hidden_tooltip = {
				FROM = {
					character_event = { id = REP.303 days = 5 }
				}
			}
		}
	}
	option = {
		name = EVTOPTB_REP_302
		
		custom_tooltip = {
			text = EVTOPTB_REP_302_tooltip
			hidden_tooltip = {
				FROM = {
					character_event = { id = REP.306 days = 5 }
				}
			}
		}
	}
}

# Plotter Informed Of Bribe
character_event = {
	id = REP.303
	desc = EVTDESC_REP_303
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_303
		
		wealth = -300
		custom_tooltip = {
			text = EVTOPTA_REP_303_tooltip
			hidden_tooltip = {
				FROM = {
					character_event = { id = REP.304 days = 5 }
				}
			}
		}
	}
	option = {
		name = EVTOPTB_REP_303
		cancel_plot = plot_seize_trade_post
		clr_character_flag = plot_seize_trade_post_decision_taken
		
		custom_tooltip = { 
			text = EVTOPTB_REP_303_tooltip
			hidden_tooltip = {
				FROM = {
					character_event = { id = REP.307 days = 5 }
				}
			}
		}
	}
}

# Owner Informed Of Counter-Bribe
character_event = {
	id = REP.304
	desc = EVTDESC_REP_304
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_304
		
		wealth = -350
		custom_tooltip = { 
			text = EVTOPTA_REP_304_tooltip
			hidden_tooltip = {
				FROM = {
					character_event = { id = REP.305 days = 5 }
				}
			}
		}
	}
	option = {
		name = EVTOPTB_REP_304
		
		custom_tooltip = { 
			text = EVTOPTB_REP_302_tooltip
			hidden_tooltip = {
				FROM = {
					character_event = { id = REP.306 days = 5 }
				}
			}
		}
	}
}

# Plotter Informed He Has Been Outbid
character_event = {
	id = REP.305
	desc = EVTDESC_REP_305
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_305
		cancel_plot = plot_seize_trade_post
		clr_character_flag = plot_seize_trade_post_decision_taken
		
		prestige = -50
		custom_tooltip = {
			text = EVTOPTB_REP_303_tooltip
			hidden_tooltip = {
				FROM = {
					character_event = { id = REP.307 days = 5 }
				}
			}
		}
	}
}

# Victorious Plotter Informed About Success
character_event = {
	id = REP.306
	desc = EVTDESC_REP_306
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_306
		plot_target_province =  {
			seize_trade_post = ROOT
		}
		clr_character_flag = plot_seize_trade_post_decision_taken
		FROM = {
			opinion = {
				who = ROOT
				modifier = opinion_seized_tp
				months = 60
			}
		}
	}
}

# Victorious Owner Informed About Success
character_event = {
	id = REP.307
	desc = EVTDESC_REP_306
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_306
		prestige = 50
	}
}

# Trade Post Owner Informed Of Overwhelming Plot Support
character_event = {
	id = REP.308
	desc = EVTDESC_REP_308
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_308
		
		custom_tooltip = { 
			text = EVTOPTB_REP_306_tooltip
			hidden_tooltip = {
				FROM = {
					character_event = { id = REP.306 days = 5 }
				}
			}
		}
	}
}

# Plotter goes to Doge
letter_event = {
	id = REP.310
	desc = EVTDESC_REP_310
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_310
		ai_chance = {
			factor = 1
			modifier = {
				factor = 1.5
				opinion = { who = FROM value =  25 }
			}
			modifier = {
				factor = 2
				opinion = { who = FROM value =  50 }
			}
			modifier = {
				factor = 3
				opinion = { who = FROM value =  75 }
			}
			modifier = {
				factor = 0
				NOT = { opinion = { who = FROM value =  0 } }
			}
		}
		FROM = {
			plot_target_char = {
				letter_event = { id = REP.311 days = 5 tooltip =  EVTTOOLTIPREP.311 }
				opinion = {
					who = ROOT
					modifier = opinion_disgruntled
					months = 60
				}
			}
		}
		FROM = {
			letter_event = { id = REP.313 days = 5 tooltip = EVTTOOLTIPREP.311 }
			opinion = {
				who = ROOT
				modifier = opinion_glad
			}
		}
	}
	option = {
		name = EVTOPTB_REP_310
		ai_chance = {
			factor = 1
			modifier = {
				factor = 2
				NOT = { opinion = { who = FROM value =  10 } }
			}
			modifier = {
				factor = 0
				opinion = { who = FROM value =  90 }
			}
		}
		FROM = {
			letter_event = { id = REP.312 days = 5 tooltip = EVTTOOLTIPREP.313 }
			opinion = {
				who = ROOT
				modifier = opinion_disgruntled
				months = 60
			}
		}
	}
}

# Owner Told of Doge's Support
letter_event = {
	id = REP.311
	desc = EVTDESC_REP_311
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_311
		prestige = -30
	}
}

# Plotter Told Doge Refuses Support
letter_event = {
	id = REP.312
	desc = EVTDESC_REP_312
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_312
		cancel_plot = plot_seize_trade_post
		prestige = -50
		clr_character_flag = plot_seize_trade_post_decision_taken
	}
}

# Plotter Informed of Doge's Support
letter_event = {
	id = REP.313
	desc = EVTDESC_REP_313
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_313
		clr_character_flag = plot_seize_trade_post_decision_taken
		plot_target_char = {
			opinion = {
				who = ROOT
				modifier = opinion_seized_tp
				months = 60
			}
		}
		plot_target_province =  {
			seize_trade_post = ROOT
		}
	}
}

### Dynastic Marriage Events

# Family member marries burgher daughter (AI)
character_event = {
	id = REP.400
	hide_window = yes
	
	ai = yes
	capable_only = yes
	prisoner = no
	min_age = 18
	only_men = yes
	is_married = no
	
	trigger = {
		NOT = { has_character_flag = getting_married }
		is_betrothed = no
		is_primary_heir = no
		is_pretender = no
		is_theocracy = no
		is_priest = no
		NOR = { 
			trait = chaste
			is_ascetic_trigger = yes
		}
		liege = {
			NOT = { any_child = { character = ROOT } }
			is_patrician = yes
			dynasty = ROOT
		}
	}
	
	mean_time_to_happen = {
		months = 210
	}
	
	immediate = {
		set_character_flag = getting_married
		if = {
			limit = {
				age = 18
				NOT = { age = 30 }
			}
			liege = {
				character_event = { id = REP.401 }
			}
		}
		if = {
			limit = {
				age = 30
				NOT = { age = 45 }
			}
			liege = {
				character_event = { id = REP.402 }
			}
		}
		if = {
			limit = {
				age = 45
			}
			liege = {
				character_event = { id = REP.403 }
			}
		}
	}
}

# Family member marries burgher daughter (18 - 29)
character_event = {
	id = REP.401
	desc = EVTDESC_REP_401
	picture = GFX_evt_marriage
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_401
		FROM = {
			create_character = {
				random_traits = yes
				dynasty = NONE
				female = yes
				age = 24
				religion = FROM
				culture = FROM
			}
			new_character = {
				add_spouse = PREV
			}
			clr_character_flag = getting_married
		}
	}
}

# Family member marries burgher daughter (30 - 44)
character_event = {
	id = REP.402
	desc = EVTDESC_REP_401
	picture = GFX_evt_marriage
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_401
		FROM = {
			create_character = {
				random_traits = yes
				dynasty = NONE
				female = yes
				age = 35
				religion = FROM
				culture = FROM
			}
			new_character = {
				add_spouse = PREV
			}
			clr_character_flag = getting_married
		}
	}
}

# Family member marries burgher daughter (44+)
character_event = {
	id = REP.403
	desc = EVTDESC_REP_401
	picture = GFX_evt_marriage
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_401
		FROM = {
			create_character = {
				random_traits = yes
				dynasty = NONE
				female = yes
				age = 48
				religion = FROM
				culture = FROM
			}
			new_character = {
				add_spouse = PREV
			}
			clr_character_flag = getting_married
		}
	}
}

# Family member marries bar wench/peasant girl/rich girl (AI)
character_event = {
	id = REP.404
	hide_window = yes
	
	ai = yes
	capable_only = yes
	prisoner = no
	min_age = 18
	only_men = yes
	is_married = no
	
	trigger = {
		NOT = { has_character_modifier = old_age }
		NOT = { has_character_flag = getting_married }
		is_betrothed = no
		is_primary_heir = no
		is_pretender = no
		is_theocracy = no
		is_priest = no
		NOT = { trait = chaste }
		liege = {
			NOT = { any_child = { character = ROOT } }
			is_patrician = yes
			dynasty = ROOT
		}
	}
	
	mean_time_to_happen = {
		months = 300
	}
	
	immediate = {
		set_character_flag = getting_married
		random_list = {
			33 = {
				liege = {
					character_event = { id = REP.405 }
				}
			}
			33 = {
				liege = {
					character_event = { id = REP.406 }
				}
			}
			33 = {
				liege = {
					character_event = { id = REP.407 }
				}
			}
		}
	}
}

# Family member marries bar wench
character_event = {
	id = REP.405
	desc = EVTDESC_REP_405
	picture = GFX_evt_marriage
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_405
		FROM = {
			create_character = {
				random_traits = yes
				dynasty = NONE
				female = yes
				age = 25
				religion = FROM
				culture = FROM
			}
			new_character = {
				add_spouse = PREV
			}
			clr_character_flag = getting_married
		}
	}
}

# Family member marries peasant girl
character_event = {
	id = REP.406
	desc = EVTDESC_REP_406
	picture = GFX_evt_marriage
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_406
		FROM = {
			create_character = {
				random_traits = yes
				dynasty = NONE
				female = yes
				age = 24
				religion = FROM
				culture = FROM
				trait = fair
			}
			new_character = {
				add_spouse = PREV
			}
			clr_character_flag = getting_married
		}
	}
}

# Family member marries rich girl
character_event = {
	id = REP.407
	desc = EVTDESC_REP_407
	picture = GFX_evt_marriage
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_407
		FROM = {
			create_character = {
				random_traits = yes
				dynasty = NONE
				female = yes
				age = 28
				religion = FROM
				culture = FROM
				trait = ugly
			}
			new_character = {
				add_spouse = PREV
			}
			wealth = 100
			clr_character_flag = getting_married
		}
	}
}

# Old family member marries young woman (AI)
character_event = {
	id = REP.408
	hide_window = yes
	
	ai = yes
	capable_only = yes
	prisoner = no
	only_men = yes
	is_married = no
	
	trigger = {
		has_character_modifier = old_age
		is_betrothed = no
		is_primary_heir = no
		is_pretender = no
		is_theocracy = no
		is_priest = no
		NOT = { trait = chaste }
		liege = {
			NOT = { any_child = { character = ROOT } }
			is_patrician = yes
			dynasty = ROOT
		}
	}
	
	mean_time_to_happen = {
		months = 450
	}
	
	immediate = {
		liege = {
			character_event = { id = REP.409 }
		}
	}
}

# Old family member marries young woman
character_event = {
	id = REP.409
	desc = EVTDESC_REP_409
	picture = GFX_evt_marriage
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_409
		FROM = {
			create_character = {
				random_traits = yes
				dynasty = NONE
				female = yes
				age = 20
				religion = FROM
				culture = FROM
			}
			new_character = {
				add_spouse = PREV
			}
		}
	}
}

# Young family member marries older woman (AI)
character_event = {
	id = REP.410
	hide_window = yes
	
	ai = yes
	capable_only = yes
	prisoner = no
	min_age = 18
	max_age = 26
	only_men = yes
	is_married = no
	
	trigger = {
		is_betrothed = no
		is_primary_heir = no
		is_pretender = no
		is_theocracy = no
		is_priest = no
		NOT = { trait = chaste }
		liege = {
			NOT = { any_child = { character = ROOT } }
			is_patrician = yes
			dynasty = ROOT
		}
	}
	
	mean_time_to_happen = {
		months = 450
	}
	
	immediate = {
		liege = {
			character_event = { id = REP.411 }
		}
	}
}

# Young family member marries older woman
character_event = {
	id = REP.411
	desc = EVTDESC_REP_411
	picture = GFX_evt_marriage
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_411
		FROM = {
			create_character = {
				random_traits = yes
				dynasty = NONE
				female = yes
				age = 41
				religion = FROM
				culture = FROM
			}
			new_character = {
				add_spouse = PREV
			}
		}
	}
}

# Family member marries foreign woman (AI)
character_event = {
	id = REP.412
	hide_window = yes
	
	ai = yes
	capable_only = yes
	prisoner = no
	min_age = 18
	only_men = yes
	is_married = no
	
	trigger = {
		is_betrothed = no
		is_primary_heir = no
		is_pretender = no
		is_theocracy = no
		is_priest = no
		NOT = { trait = chaste }
		can_marry = yes
		NOT = { culture = haak }
		liege = {
			NOT = { any_child = { character = ROOT } }
			NOT = { culture = haak }
			is_patrician = yes
			dynasty = ROOT
		}
	}
	
	mean_time_to_happen = {
		months = 450
	}
	
	immediate = {
		liege = {
			character_event = { id = REP.413 }
		}
	}
}

# Family member marries foreign woman
character_event = {
	id = REP.413
	desc = EVTDESC_REP_413
	picture = GFX_evt_marriage
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_413
		FROM = {
			create_character = {
				random_traits = yes
				dynasty = NONE
				female = yes
				age = 26
				religion = FROM
				culture = haak
			}
			new_character = {
				add_spouse = PREV
			}
		}
	}
}

### Trade Post Decisions

# Doge approached by Patrician
letter_event = {
	id = REP.500
	desc = EVTDESC_REP_500
	
	is_triggered_only = yes
	
	immediate = {
		if = {
			limit = {
				FROM = { num_of_trade_posts = 1 }
				any_vassal = {
					is_patrician = yes
					NOT = { character = FROM }
					num_of_trade_post_diff = {
						character = FROM
						value = 10
					}
				}
			}
			random_vassal = {
				limit = {
					is_patrician = yes
					NOT = { character = FROM }
					num_of_trade_post_diff = {
						character = FROM
						value = 10
					}
				}
				set_character_flag = target_patrician
			}
		}
		if = {
			limit = {
				FROM = { NOT = { num_of_trade_posts = 1 } }
				any_vassal = {
					is_patrician = yes
					num_of_trade_posts = 10
				}
			}
			random_vassal = {
				limit = {
					is_patrician = yes
					num_of_trade_posts = 10
				}
				set_character_flag = target_patrician
			}
		}
		FROM = { set_character_flag = poor_patrician }
	}
	
	option = {
		name = EVTOPTA_REP_500
		FROM = {
			letter_event = { id = REP.501 }
			clr_character_flag = poor_patrician
		}
		hidden_tooltip = {
			any_vassal = {
				limit = { has_character_flag = target_patrician }
				clr_character_flag = target_patrician
			}
		}
	}
	option = {
		name = EVTOPTB_REP_500
		ai_chance = { factor = 100 }
		any_vassal = {
			limit = { has_character_flag = target_patrician }
			letter_event = { id = REP.502 tooltip = EVTTOOLTIP_REP_502 }
		}
	}
}

# Doge refuses request
letter_event = {
	id = REP.501
	desc = EVTDESC_REP_501
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_501
		prestige = -100
	}
}

# Doge makes request to wealthy patrician
letter_event = {
	id = REP.502
	desc = EVTDESC_REP_502
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_502
		FROM = {
			letter_event = { id = REP.503 tooltip = EVTTOOLTIP_REP_503 }
		}
		tooltip = {
			random_trade_post = {
				seize_trade_post = FROMFROM
				any_neighbor_province = {
					limit = {
						trade_post_owner = { character = ROOT } 
					}
					seize_trade_post = FROMFROM
				}
			}
		}
	}
	option = {
		name = EVTOPTB_REP_510
		tooltip_info = stewardship
		trigger = {
			stewardship = 10
		}
		FROM = {
			letter_event = { id = REP.505 tooltip = EVTTOOLTIP_REP_512 }
		}
	}
	option = {
		name = EVTOPTC_REP_510
		tooltip_info = diplomacy
		trigger = {
			diplomacy = 10
		}
		FROM = {
			letter_event = { id = REP.506 tooltip = EVTTOOLTIP_REP_513 }
		}
	}
	option = {
		name = EVTOPTD_REP_510
		tooltip_info = intrigue
		trigger = {
			intrigue = 10
		}
		FROM = {
			letter_event = { id = REP.507 tooltip = EVTTOOLTIP_REP_514 }
		}
	}
}

# Patrician grants Doge's request
letter_event = {
	id = REP.503
	desc = EVTDESC_REP_503
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_503
		FROM = {
			opinion = {
				who = ROOT
				modifier = opinion_disgruntled
				months = 60
			}
		}
		any_vassal = {
			limit = { has_character_flag = poor_patrician }
			letter_event = { id = REP.504 tooltip = EVTTOOLTIP_REP_504 }
		}	
	}
}

# Doge informs original Patrician that request has been granted
letter_event = {
	id = REP.504
	desc = EVTDESC_REP_504
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_504
		clr_character_flag = poor_patrician
		FROMFROM = {
			opinion = {
				who = ROOT
				modifier = opinion_angry
				months = 60
			}
			clr_character_flag = target_patrician
			random_trade_post = {
				seize_trade_post = ROOT
				any_neighbor_province = {
					limit = { 
						trade_post_owner = { character = PREVPREVPREV } 
					}
					seize_trade_post = ROOT
				}
			}
		}
	}
}

# Patrician refuses demand due to stewardship
letter_event = {
	id = REP.505
	desc = EVTDESC_REP_512
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_505
		any_vassal = {
			limit = { has_character_flag = poor_patrician }
			letter_event = { id = REP.508 tooltip = EVTTOOLTIP_REP_508 }
		}	
	}
}

# Patrician refuses demand due to diplomacy
letter_event = {
	id = REP.506
	desc = EVTDESC_REP_513
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_505
		any_vassal = {
			limit = { has_character_flag = poor_patrician }
			letter_event = { id = REP.508 tooltip = EVTTOOLTIP_REP_508 }
		}	
	}
}

# Patrician refuses demand due to intrigue
letter_event = {
	id = REP.507
	desc = EVTDESC_REP_514
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_505
		any_vassal = {
			limit = { has_character_flag = poor_patrician }
			letter_event = { id = REP.508 tooltip = EVTTOOLTIP_REP_508 }
		}	
	}
}

# Doge informs Patrician of failure
letter_event = {
	id = REP.508
	desc = EVTDESC_REP_508
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_508
		hidden_tooltip = {
			FROMFROM = {
				clr_character_flag = target_patrician
			}
		}
		clr_character_flag = poor_patrician
		prestige = -50
	}
}

# Patrician approached by Doge
letter_event = {
	id = REP.510
	desc = EVTDESC_REP_510
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_510
		hidden_tooltip = {
			FROM = {
				letter_event = { id = REP.511 }
			}
		}
		tooltip = {
			random_trade_post = {
				seize_trade_post = FROM
				any_neighbor_province = {
					limit = { 
						trade_post_owner = { character = ROOT } 
					}
					seize_trade_post = FROM
				}
			}
		}
	}
	option = {
		name = EVTOPTB_REP_510
		tooltip_info = stewardship
		trigger = {
			stewardship = 10
			FROM = {
				NOT = { stewardship = 8 }
			}
		}
		FROM = {
			letter_event = { id = REP.512 tooltip = EVTTOOLTIP_REP_512 }
		}
	}
	option = {
		name = EVTOPTC_REP_510
		tooltip_info = diplomacy
		trigger = {
			diplomacy = 10
			FROM = {
				NOT = { diplomacy = 8 }
			}
		}
		FROM = {
			letter_event = { id = REP.513 tooltip = EVTTOOLTIP_REP_513 }
		}
	}
	option = {
		name = EVTOPTD_REP_510
		tooltip_info = intrigue
		trigger = {
			intrigue = 10
			FROM = {
				NOT = { intrigue = 8 }
			}
		}
		FROM = {
			letter_event = { id = REP.514 tooltip = EVTTOOLTIP_REP_514 }
		}
	}
}

# Patrician agrees to demand
letter_event = {
	id = REP.511
	desc = EVTDESC_REP_511
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_511
		FROM = {
			clr_character_flag = target_patrician_doge
			opinion = {
				who = ROOT
				modifier = opinion_angry
				months = 60
			}
			random_trade_post = {
				seize_trade_post = ROOT
				any_neighbor_province = {
					limit = {
						trade_post_owner = { character = PREVPREVPREV } 
					}
					seize_trade_post = ROOT
				}
			}
		}
	}
}

# Patrician refuses demand due to stewardship
letter_event = {
	id = REP.512
	desc = EVTDESC_REP_512
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_512
		prestige = -50
	}
}

# Patrician refuses demand due to diplomacy
letter_event = {
	id = REP.513
	desc = EVTDESC_REP_513
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_512
		prestige = -50
	}
}

# Patrician refuses demand due to intrigue
letter_event = {
	id = REP.514
	desc = EVTDESC_REP_514
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_512
		prestige = -50
	}
}

### Trade Post Razing

# Province has TP
province_event = {
	id = REP.600
	hide_window = yes
	
	trigger = {
		has_trade_post = yes
		owner = {
			is_patrician = no
			top_liege = {
				is_patrician = no
			}
		}

		trade_post_owner = {
			is_patrician = yes
			ROOT = {
				owner = {
					NOT = {
						any_realm_character = { character = PREVPREVPREV }
					}
					top_liege = {
						NOR = {
							is_vassal_or_below = PREVPREVPREV #this is backwards
							opinion = { who = PREVPREVPREV value =  0 }
							has_opinion_modifier = { who = PREVPREVPREV modifier = opinion_bribed_tp }
							has_opinion_modifier = { who = PREVPREVPREV modifier = opinion_thwarted_tp_destruction }
							has_opinion_modifier = { who = PREVPREVPREV modifier = opinion_burned_tp }
							has_opinion_modifier = { who = PREVPREVPREV modifier = opinion_burned_tp_despite_bribe }
							war_with = PREVPREVPREV
						}
					}
					
					# Only if there is no non-aggression-pact with the trade post owner
					NOT = {
						has_non_aggression_pact_with = PREVPREV
					}
				}
			}
		}
	}
	
	mean_time_to_happen = {
		months = 1620
		
		modifier = {
			factor = 0.7
			trade_post_owner = {
				ROOT = {
					owner = {
						top_liege = {
							NOT = { opinion = { who = PREVPREVPREV value =  -20 } }
						}
					}
				}
			}
		}
		modifier = {
			factor = 0.6
			trade_post_owner = {
				ROOT = {
					owner = {
						top_liege = {
							NOT = { opinion = { who = PREVPREVPREV value =  -40 } }
						}
					}
				}
			}
		}
		modifier = {
			factor = 0.5
			trade_post_owner = {
				ROOT = {
					owner = {
						top_liege = {
							NOT = { opinion = { who = PREVPREVPREV value =  -60 } }
						}
					}
				}
			}
		}
		modifier = {
			factor = 0.4
			trade_post_owner = {
				ROOT = {
					owner = {
						top_liege = {
							NOT = { opinion = { who = PREVPREVPREV value =  -80 } }
						}
					}
				}
			}
		}
	}
	
	immediate = {
		owner = {
			top_liege = {
				character_event = { id = REP.601 }
			}
		}
	}
}

# Liege informed
character_event = {
	id = REP.601
	desc = EVTDESC_REP_601
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_601
		ai_chance = { factor = 100 }
		FROM = {
			trade_post_owner = {
				character_event = { id = REP.602 days = 6 tooltip = EVTTOOLTIP_REP_602 }
			}
		}
	}
	option = {
		name = EVTOPTB_REP_601
		custom_tooltip = { text = tp_spare }
	}
}

# Trade Post Owner Confronted
character_event = {
	id = REP.602
	desc = EVTDESC_REP_602
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = { # Accept
		name = EVTOPTA_REP_602
		destroy_tradepost = FROMFROM
		hidden_tooltip = {
			FROM = {
				character_event = { id = REP.603 }
			}
		}
	}
	option = { # Bribe
		name = EVTOPTB_REP_602
		trigger = {
			wealth = 100
		}
		wealth = -100
		FROMFROM = {
			province_event = { id = REP.608 days = 6 tooltip = EVTTOOLTIP_REP_604 }
		}
		tooltip = {
			FROM = { wealth = 100 }
		}
	}
	option = { # Stewardship
		name = EVTOPTC_REP_602
		tooltip_info = stewardship
		trigger = {
			stewardship = 12
		}
		FROM = {
			character_event = { id = REP.605 days = 6 tooltip = EVTTOOLTIP_REP_605 }
		}
	}
	option = { # Diplomacy
		name = EVTOPTD_REP_602
		tooltip_info = diplomacy
		trigger = {
			diplomacy = 12
		}
		FROM = {
			character_event = { id = REP.606 days = 6 tooltip = EVTTOOLTIP_REP_605 }
		}
	}
}

# Trade Post Destroyed
character_event = {
	id = REP.603
	desc = EVTDESC_REP_603
	picture = GFX_evt_burning_house
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_603
		prestige = 30
		FROM = {
			opinion = {
				modifier = opinion_burned_tp
				who = ROOT
			}
		}
	}
}

# Bribe Offered
character_event = {
	id = REP.604
	desc = EVTDESC_REP_604
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_604
		ai_chance = { factor = 70 }
		wealth = 100
		opinion = {
			modifier = opinion_bribed_tp
			who = FROMFROM
		}
		tooltip = {
			FROMFROM = {
				wealth = -100
			}
		}
	}
	option = {
		name = EVTOPTB_REP_604
		ai_chance = { factor = 30 }
		wealth = 100
		tooltip = {
			FROMFROM = {
				wealth = -100
			}
		}
		piety = -50
		FROMFROM = {
			opinion = {
				modifier = opinion_burned_tp_despite_bribe
				who = ROOT
			}
			if = {
				limit = {
					liege = {
						is_merchant_republic = yes 
						NOT = { character = FROMFROM }
					}
				}
				liege = {
					opinion = {
						modifier = opinion_burned_tp_despite_bribe
						who = ROOT
					}
				}
			}
		}
		hidden_tooltip = {
			FROMFROM = {
				character_event = { id = REP.607 days = 6 }
			}
		}
		tooltip = {
			destroy_tradepost = FROM
		}	
	}
}

# Stewardship used to save TP
character_event = {
	id = REP.605
	desc = EVTDESC_REP_605
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_605
		opinion = {
			modifier = opinion_thwarted_tp_destruction
			who = FROM
		}
		prestige = -30
	}
}

# Diplomacy used to save TP
character_event = {
	id = REP.606
	desc = EVTDESC_REP_606
	picture = GFX_evt_trade_post_republic
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_605
		opinion = {
			modifier = opinion_thwarted_tp_destruction
			who = FROM
		}
		prestige = -30
	}
}

# TP owner informed of treachery
character_event = {
	id = REP.607
	desc = EVTDESC_REP_607
	picture = GFX_evt_burning_house
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTA_REP_607
		destroy_tradepost = FROMFROM
	}
}

# Hidden province owner event
province_event = {
	id = REP.608
	hide_window = yes
	
	is_triggered_only = yes
	
	immediate = {
		FROMFROM = {
			character_event = { id = REP.604 }
		}
	}		
}
