﻿random_yearly_playable_pulse = {
	random_on_action = {
		4 = slavic_flavour_yearly_events
	}
}

slavic_flavour_yearly_events = {
	trigger = {
		basic_is_valid_for_yearly_events_trigger = yes
		OR = {
			culture = { has_cultural_pillar = heritage_east_slavic }
			AND = {
				culture = { has_cultural_pillar = heritage_north_germanic }
				capital_province = { geographical_region = custom_brus_kievian_rus }
				primary_title.empire = title:e_russia
			}
		}
	}
	
	weight_multiplier = {
		base = 1
	}
	
	random_events = {
		chance_to_happen = 80

		## Children of Perun Slavic Yearlies
		200 = brus_slavic_yearly.0060 # Druzhina wants silver spoons
		200 = brus_slavic_yearly.0090 # Dispute over Beekeeping Rights
		# Baptism of Rus original Slavic Yearlies
		200 = brus_slavic_yearly.02 # Varangian Passing Through
		200 = brus_slavic_yearly.03 # Foreign Rituals Unnerve Peasants
		200 = brus_slavic_yearly.04 # Volkhv Antagonizes County
		200 = brus_slavic_yearly.05 # Idol Falls Overnight
		200 = brus_slavic_yearly.06 # Pagan Idol Draws Ire
		200 = brus_slavic_yearly.07 # Greek Artisans Offer Services
		200 = brus_slavic_yearly.08 # The Return of River Piracy
		150 = brus_slavic_yearly.09 # Trade Dispute
		200 = brus_slavic_yearly.011 # Creating Coinage
		200 = brus_slavic_yearly.012 # Christian Competition
		200 = brus_slavic_yearly.013 # Anti-clerical Icon
		200 = brus_slavic_yearly.014 # Dispute Over Legal Authority
		200 = brus_slavic_yearly.015 # Christian Conversion in Court
		200 = brus_slavic_yearly.016 # Byzantine Trade Demands
		200 = brus_slavic_yearly.017 # Problematic Artifact Gift
		200 = brus_slavic_yearly.018 # Smorokhs Mock Authorities
		# FP1 General Yearlies
		200 = cop_slavic_yearly_fp1.0001 # Escaped Thrall - A thrall leaves your court in the night.
		200 = cop_slavic_yearly_fp1.0021 # A Matter of Life and Death - Two knights fight to the death over nothing.
		100 = cop_slavic_yearly_fp1.0041 # Explorers from the South - An Islamic explorer stops by for a visit.
		200 = cop_slavic_yearly_fp1.0051 # The Unquiet Dead - You are informed of a reputed-draugr.
		200 = cop_slavic_yearly_fp1.0071 # In the Deep Places of the World - locals in your Scandi capital report a troll.
		200 = cop_slavic_yearly_fp1.0101 # A Game of Riddles - a courtier challenges you to a game of riddles.
		200 = cop_slavic_yearly_fp1.2000 # A Child wants to run away to marry their beloved
		# FP1 Flavour Yearlies
		200 = cop_slavic_yearly_fp1.0511 # The Stench of Success - a courtier won't let an old trophy go.
		200 = cop_slavic_yearly_fp1.0541 # The Beast of [Capital] - your child is playing pranks on courtiers.
		200 = cop_slavic_yearly_fp1.0561 # My Arm Against Yours - a knight challenges you to arm-wrestling.
		200 = cop_slavic_yearly_fp1.0591 # Raised Voices at the Thing - two of your counties are fighting at a regional thing.
		200 = cop_slavic_yearly_fp1.0601 # The Hardest Part of Ruling - you're incredibly bored in a protracted thing session.
		200 = cop_slavic_yearly_fp1.0611 # Leading by Example - one of your children hurts another whilst imitating you.
		200 = cop_slavic_yearly_fp1.0681 # Why Can't I Come? - your child wants to come raiding.
		200 = cop_slavic_yearly_fp1.0691 # Attempted Atonement - a knight has converted after raiding a reformed faith.
		# FP1 Special Yearlies
		50 = cop_slavic_yearly_fp1.1071 # Sparklingly Clean
	}
}

# on_death = {
# 	events = {
# 		cop_slavic_yearly_fp1.0052 #Rumoured Upir
# 	}
# }

on_raid_loot_delivered = {
	on_actions = {
		on_raid_slavic_loot_delivered
	}
}
on_raid_slavic_loot_delivered = {
	random_events = {
		chance_to_happen = 25
		200 = 0
		100 = cop_slavic_yearly_fp1.0622	# FP1 - setup event for a child demanding some of your loot.
		100 = cop_slavic_yearly_fp1.0632	# FP1 - setup event for noticing a cynical knight refuse to sacrifice.
	}
}

# Byzantine Raiding Trade Deal
on_raid_action_completion = {
	on_actions = {
		on_raid_completion_brus
	}
}
# scope:raider is the person owning the raid army
# scope:barony is the barony title that got raided
# scope:county is the county title for the barony
on_raid_completion_brus = {
	effect = {
		if = {
			limit = {
				#Must be raiding any Byzantine province
				scope:barony = {
					holder = {
						top_liege = {
							has_title = title:e_byzantium 
						}
					}
				}
				#Must be a large enough Rus kingdom with at least one tradeport
				scope:raider = {
					is_independent_ruler = yes
					OR = {
						culture = { has_cultural_pillar = heritage_east_slavic }
						culture = { has_cultural_pillar = heritage_north_germanic }
					}
					OR = {
						primary_title.empire = title:e_russia
						capital_province = { geographical_region = custom_brus_kievian_rus }
					}
					NOT = { has_character_flag = negotiated_greek_trade }
					highest_held_title_tier >= tier_kingdom
					sub_realm_size >= 25
					any_sub_realm_county = {
						is_riverside_county = yes
					}
				}
				# Byzantine Emperor must not have already had this event recently
				title:e_byzantium.holder = {
					NOT = { has_character_flag = negotiated_greek_trade }
				}
			}
			scope:barony = {
				save_scope_as = rus_raided_barony
			}
			scope:raider = {
				trigger_event = {
				id = rus_invasion.11
				days = 14
				}
			}
		}
	}
}

# on_raid_action_start = {
# 	random_events = {
# 		100 = cop_slavic_yearly_fp1.0692	# FP1 - setup event for one of your knights converting to a reformed faith.
# 	}
# }