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

# # called for armies every 30 days; exact date dependent on army ID
# # root is the owner of the army
# # scope:army is the army


####I WANT TO MAKE RAIDING EVENTS ANOTHER TIME#####



# # 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 = {
# 	#added for AGOT compatibility
# 	trigger = {
# 		exists = scope:barony
# 		scope:barony.county.holder = {
# 			NOT = { government_has_flag = government_is_uninteractable }
# 		}
# 	}
# 	events = {
# 		raiding.0001 # An independent liege personally raids a county capital.
# 		raiding.0021 # Adjust raider completion tally.
# 		raiding.0022 # Chance to fire viking/raider acquisition event
# 		raiding.0013 # Chance to kidnap prisoners
# 		raiding.0014 # Chance to steal an artifact
# 		bp2_yearly.8031 # Steal a doll
# 		eps_misc.0014  #LOW added steal a child
# 		raiding.0031 # Hereward adds XP
# 		raiding.0040 # Raid Intent Effects
# 	}
# 	effect = {
# 		scope:raider = {
# 			send_interface_message = {
# 				type = msg_raid_completed
# 				left_icon = scope:county.holder
# 				right_icon = scope:barony
# 			}
# 			if = {
# 				limit = { 
# 					scope:county = {
# 						any_county_province = { has_special_building = yes }
# 					}
# 					NOT = { has_character_flag = raider_legend }
# 					has_dlc_feature = legends
# 					NOT = { has_game_rule = historical_legends_only }
# 				}
# 				random = {
# 					chance = legend_seed_chance_low
# 					add_character_flag = raider_legend
# 					create_legend_seed = {
# 						type = heroic
# 						quality = famed
# 						chronicle = legendary_battle
# 						properties = {
# 							winner = scope:raider
# 							loser = scope:county.holder
# 							location = scope:barony.title_province
# 						}
# 					}
# 				}
# 			}
# 		}
# 		scope:barony.title_province = {
# 			add_province_modifier = {
# 				modifier = recently_looted_modifier
# 				years = 5
# 			}
# 			county = {
# 				if = {
# 					limit = {
# 						holder = {
# 							NOT = { has_perk = enduring_hardships_perk }
# 						}
# 					}
# 					change_county_control = raid_county_control_loss_value
# 					random_list = {
# 						25 = {
# 							change_development_progress_with_overflow = -2
# 						}
# 						25 = {
# 							change_development_progress_with_overflow = -3
# 						}
# 						25 = {
# 							change_development_progress_with_overflow = -4
# 						}
# 						25 = {
# 							change_development_progress_with_overflow = -5
# 						}
# 					}
# 				}
# 			}
# 		}
# 		scope:county.holder = { add_to_list = raid_targets }
# 		scope:county.holder.liege ?= { add_to_list = raid_targets }
# 		scope:county.holder.liege.liege ?= { add_to_list = raid_targets }
# 		scope:county.holder.liege.liege.liege ?= { add_to_list = raid_targets }
# 		every_in_list = {
# 			list = raid_targets
# 			send_interface_message = {
# 				type = msg_raid_lost
# 				left_icon = scope:raider
# 				right_icon = scope:barony
# 			}
# 		}

# 		## Struggles
# 		if = {
# 			limit = {
# 				scope:raider = {
# 					any_character_struggle = {
# 						activate_struggle_catalyst_secondary_character_involvement_involved_trigger = {
# 							CATALYST = catalyst_raided_involved
# 							CHAR = scope:county.holder
# 						}
# 					}
# 				}
# 				scope:county.holder = { # Theoretical edge case where X is from one struggle, Y from another one and they trigger catalysts. But unlikely to be an issue.
# 					any_character_struggle = {
# 						involvement = involved
# 						phase_has_catalyst = catalyst_raided_involved
# 					}
# 				}
# 			}
# 			scope:raider = {
# 				every_character_struggle = {
# 					limit = {
# 						activate_struggle_catalyst_secondary_character_involvement_involved_trigger = {
# 							CATALYST = catalyst_raided_involved
# 							CHAR = scope:county.holder
# 						}
# 					}
# 					activate_struggle_catalyst = {
# 						catalyst = catalyst_raided_involved
# 						character = scope:raider
# 					}
# 					log_debug_variable_for_persian_struggle_effect = { VAR = concession_catalyst_raided_involved }
# 				}
# 			}
# 		}

# 		# Commander trait leveling
# 		root.army_commander ?= {
# 			if = {
# 				limit = {
# 					has_trait = reaver
# 					is_commanding_army = yes
# 				}
# 				add_trait_xp = {
# 					trait = reaver
# 					value = {
# 						value = 0.5
# 						add = {
# 							value = martial
# 							divide = 10
# 						}
# 					}
# 				}
# 			}
# 		}
# 	}
# }