﻿# On actions for army events, triggered automatically by the game

# Called when a raid action finishes
# root is the raid army
# 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_action_completion = {
	on_actions = {
		regula_on_raid_action_completion
	}
}

regula_on_raid_action_completion = {
	events = {
		regula_raiding.0001	# Raid a holding, enslave a character
		regula_council_event.3001 # Capture Scouted Targets
		regula_raid_intent.0001 # Run any raid intents
	}
}


# For the purpose of weights, there are three standard weights to use
# 100 - Common
# 50 - Uncommon
# 25 - Rare
# This does not include weight multipliers on the events themselves
regula_on_raid_tribal_holding = {
	random_events = {
		100 = regula_raiding.0101	## 0101 - Capture Feisty OR gain trinket
		100 = regula_raiding.0102	## 0102 - Capture Submissive OR gain tiny gold
		50 = regula_raiding.0103	## 0103 - Capture Giant OR gain prestige
		25 = regula_raiding.0104	## 0104 - Capture Both Feisty and Submissive OR gain loot (Famuli Warriors)
		50 = regula_raiding.0105	## 0105 - Feisty and Submissive Join AND gain loot (Barony is Magistrian)
		25 = regula_raiding.0106	## 0106 - Capture a Tribal Chieftess (Bonus chance/effects if you have Famuli Warriors tradition)

		25 = regula_raiding.0502	## 0502 - Capture Foreign Adventurer OR gain prestige
		25 = regula_raiding.0505	## 0505 - Capture multiple Peasants OR gain legitmancy
		25 = regula_raiding.0507 	## 0507 - Recruit Witch or gain piety (no third option)
	}
}

regula_on_raid_castle_holding = {
	random_events = {
		100 = regula_raiding.0201	## 0201 - Capture Noble OR gain prestige
		100 = regula_raiding.0202	## 0202 - Capture Knight OR gain prowess bonus
		100 = regula_raiding.0203	## 0203 - Capture Ranger OR gain movement speed
		50 = regula_raiding.0204	## 0204 - Capture Princess OR gain gold (Famuli Warriors)
		50 = regula_raiding.0205	## 0205 - Princess AND Knight join AND gain gold (Barony is Magistrian)

		25 = regula_raiding.0501	## 0501 - Capture Farmers Daughter OR gain army supply modifer
		25 = regula_raiding.0502	## 0502 - Capture Foreign Adventurer OR gain prestige
		25 = regula_raiding.0503	## 0503 - Capture Orphans OR gain dynasty prestige
		25 = regula_raiding.0504 	## 0504 - Capture Dwarf in a Barrel OR gain prestige (Eager reveler bonus prestige)
		25 = regula_raiding.0505	## 0505 - Capture multiple Peasants OR gain legitmancy
		25 = regula_raiding.0506 	## 0506	- Capture Princess Bride or marry/make concubine
		25 = regula_raiding.0507 	## 0507 - Recruit Witch or gain piety (no third option)
	}
}

regula_on_raid_church_holding = {
	random_events = {
		100 = regula_raiding.0301	## 0301 - Capture Priestess OR piety gain
		50 = regula_raiding.0302	## 0302	- Capture Gardener OR health boost
		50 = regula_raiding.0303	## 0303 - Capture Head Priestess OR fervor gain/loss + piety gain (Famuli Warriors)
		100 = regula_raiding.0304	## 0304 - Two random Common Initiates join (Barony is Magistrian)

		25 = regula_raiding.0501	## 0501 - Capture Farmers Daughter OR gain army supply modifer
		25 = regula_raiding.0502	## 0502 - Capture Foreign Adventurer OR gain prestige
		25 = regula_raiding.0504 	## 0504 - Capture Dwarf in a Barrel OR gain prestige (Eager reveler bonus prestige)
		25 = regula_raiding.0505	## 0505 - Capture multiple Peasants OR gain legitmancy
	}
}

regula_on_raid_city_holding = {
	random_events = {
		100 = regula_raiding.0401	## 0401 - Capture Merchant OR gain medium gold
		100 = regula_raiding.0402	## 0402 - Capture Diplomat OR gain claim
		100 = regula_raiding.0403	## 0403 - Capture Spy OR intrigue bonus
		100 = regula_raiding.0404	## 0404 - Capture Guard OR gain common weapon
		100 = regula_raiding.0405	## 0405 - Capture Teacher OR gain book


		50 = regula_raiding.0501	## 0501 - Capture Farmers Daughter OR gain army supply modifer
		25 = regula_raiding.0502	## 0502 - Capture Foreign Adventurer OR gain prestige
		25 = regula_raiding.0503	## 0503 - Capture Orphans OR gain dynasty prestige
		25 = regula_raiding.0504 	## 0504 - Capture Dwarf in a Barrel OR gain prestige (Eager reveler bonus prestige)
		25 = regula_raiding.0505	## 0505 - Capture multiple Peasants OR gain legitmancy
		25 = regula_raiding.0506 	## 0506	- Capture Princess Bride or marry/make concubine
		25 = regula_raiding.0507 	## 0507 - Recruit Witch or gain piety (no third option)
	}
}

regula_on_raid_generic_holding = {
	random_events = {
		50 = regula_raiding.0501	## 0501 - Capture Farmers Daughter OR gain army supply modifer
		25 = regula_raiding.0502	## 0502 - Capture Foreign Adventurer OR gain prestige
		25 = regula_raiding.0503	## 0503 - Capture Orphans OR gain dynasty prestige
		25 = regula_raiding.0504 	## 0504 - Capture Dwarf in a Barrel OR gain prestige (Eager reveler bonus prestige)
		50 = regula_raiding.0505	## 0505 - Capture multiple Peasants OR gain legitmancy
		25 = regula_raiding.0506 	## 0506	- Capture Princess Bride or marry/make concubine
		25 = regula_raiding.0507 	## 0507 - Recruit Witch or gain piety (no third option)
	}
}

# called when a siege completes. Does *not* fire on reoccupation by province order
# root is the occupant
# scope:barony is the barony title that got occupied
# scope:county is the county title for the barony
# scope:previous_controller is the previous controller of the county
# scope:war is the war causing the previous controller and the occupant to be hostile
# occupied_baronies is a list of all baronies that the siege caused the occupier to control (I.E., can include baronies with no fort level)
on_siege_completion = {
	on_actions = {
		regula_siege_looting_raid_event_adapter
	}
}

# Simple adaptor which allows calling raiding capture events as part of siege
# looting.
regula_siege_looting_raid_event_adapter = {
	effect = {
		# Save the root as scope:raider - which the below events depend on.
		save_scope_as = raider

		trigger_event = { id = regula_council_event.3001 } # Capture Scouted Targets
	}
}
