﻿# Applies a wound to the scoped character if BOOL_SCOPE exists & is yes.
#
# BOOL_SCOPE = a boolean scope to use for controlling this effect
# REASON = the reason the wound occured
#
# scope = the character to apply the wound to
regula_contubernalis_supervisor_apply_wound = {
	if = {
		limit = {
			exists = scope:$BOOL_SCOPE$
			scope:$BOOL_SCOPE$ = yes
		}
		increase_wounds_no_death_effect = { 
			REASON = $REASON$
		}
	}
}

# Kills to the scoped character if BOOL_SCOPE exists & is yes.
#
# BOOL_SCOPE = a boolean scope to use for controlling this effect.
# DEATH_REASON = the death reason
#
# scope = the character to apply the wound to
regula_contubernalis_supervisor_death_effect = {
	if = {
		limit = {
			exists = scope:$BOOL_SCOPE$
			scope:$BOOL_SCOPE$ = yes
		}
		death = {
			death_reason = $DEATH_REASON$
		}
	}
}

# Picks an immediate liege-oriented positive side effect to occur as part of
# task_beasts_of_burden.
#
# SAVE_AS = the output flag scope denoting the side effect to occur
# scope = the character for whom the side effect is being selected
regula_task_beasts_of_burden_pick_positive_liege_side_effect = {
	random_list = {
		1 = {
			save_temporary_scope_value_as = {
				name = $SAVE_AS$
				value = flag:dread
			}
		}
		1 = {
			save_temporary_scope_value_as = {
				name = $SAVE_AS$
				value = flag:gold
			}
		}
		1 = {
			save_temporary_scope_value_as = {
				name = $SAVE_AS$
				value = flag:prestige
			}
		}
	}
}

# Applies an immediate liege-oriented side effect to occur as part of
# task_beasts_of_burden.
#
# FLAG_SCOPE = the flag scope denoting the side effect to occur
#
# scope:contubernalis_participant = the contubernalis doing labor
# scope:county_participant = the county gaining free labor
# scope = the character for whom the side effect is being applied
regula_task_beasts_of_burden_apply_liege_side_effect = {
	if = {
		limit = {
			exists = scope:$FLAG_SCOPE$
		}
		switch = {
			trigger = scope:$FLAG_SCOPE$
			flag:dread = {
				custom_tooltip = regula_beasts_of_burden_dread_tt
				add_dread = minor_dread_gain
			}
			flag:gold = {
				custom_tooltip = regula_beasts_of_burden_gold_tt
				add_gold = minor_gold_value
			}
			flag:prestige = {
				custom_tooltip = regula_beasts_of_burden_prestige_tt
				add_prestige = minor_prestige_gain
			}
		}
	}
}
