namespace = human_sacrifice

##################################################
#Flowery War CB events

	#0001		- Fail to sacrifice suitable victims by the time limit.
	#0002		- A victim died before they could be sacrificed.
	#0003		- A victim was released rather than be sacrificed.

##################################################

##################################################
# Thirsting Gods
# by Ewan Cowhig Croft
# 0001
##################################################

#	You have disappointed your deities by not sacrificing marked captives.
#		by Ewan Cowhig Croft
human_sacrifice.0001 = {
	type = character_event
	title = human_sacrifice.0001.t
	desc = human_sacrifice.0001.desc
	theme = faith
	left_portrait =	{
		character = root
		animation = shame
	}

	trigger = {
		faith = { has_doctrine_parameter = human_sacrifice_active }
		any_prisoner = { has_character_modifier = designated_human_sacrifice_modifier }
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		every_prisoner = {
			limit = { has_character_modifier = designated_human_sacrifice_modifier }
			add_to_list = designated_sacrifices_list
		}
		save_scope_value_as = {
			name = designated_sacrifice_count
			value = {
				value = 0
				every_in_list = {
					list = designated_sacrifices_list
					add = 1
				}
			}
		}
	}

	option = {	#Immediately sacrifice the remainder to try and make amends.
		name = human_sacrifice.0001.a
		every_prisoner = {
			limit = { has_character_modifier = designated_human_sacrifice_modifier }
			death = {
				death_reason = death_sacrificed_to_gods
				killer = root
			}
		}
		add_piety = {
			value = miniscule_piety_gain
			multiply = scope:designated_sacrifice_count
		}
		add_character_modifier = {
			modifier = human_sacrifice_coward_modifier
			years = 10
		}
		stress_impact = {
			callous = minor_stress_impact_loss
			sadistic = medium_stress_impact_loss
			zealous = major_stress_impact_loss
			compassionate = medium_stress_impact_gain
			cynical = major_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_zeal = -0.5
			}
			modifier = {
				add = 10
				has_trait = callous
			}
			modifier = {
				add = 20
				has_trait = sadistic
			}
			modifier = {
				add = 30
				has_trait = zealous
			}
			modifier = {
				add = -20
				has_trait = compassionate
			}
			modifier = {
				add = -30
				has_trait = cynical
			}
		}
	}
	option = {	#Accept the loss of piety with dignity.
		name = human_sacrifice.0001.b
		add_piety = {
			value = medium_piety_loss
			multiply = scope:designated_sacrifice_count
		}
		stress_impact = { zealous = medium_stress_impact_gain }
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 0.5
				ai_energy = -0.25
			}
			modifier = {
				add = -30
				has_trait = zealous
			}
		}
	}
	option = {	#Internally decry the barbarism of your faith.
		name = human_sacrifice.0001.c
		if = {
			limit = {
				NOT = {
					any_secret = { type = secret_non_believer }
				}
			}
			give_non_believer_secret_effect = yes
		}
		else = { add_prestige = minor_prestige_gain }
		stress_impact = {
			compassionate = medium_stress_impact_loss
			cynical = major_stress_impact_loss
			callous = minor_stress_impact_gain
			sadistic = medium_stress_impact_gain
			zealous = major_stress_impact_gain
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_compassion = 0.5
				ai_zeal = -0.5
			}
			modifier = {
				add = 20
				has_trait = compassionate
			}
			modifier = {
				add = 30
				has_trait = cynical
			}
			modifier = {
				add = -10
				has_trait = callous
			}
			modifier = {
				add = -20
				has_trait = sadistic
			}
			modifier = {
				add = -30
				has_trait = zealous
			}
		}
	}
}

#	A marked captive has died without being sacrificed.
#		by Ewan Cowhig Croft
#human_sacrifice.0002 = {
	#hidden = yes
	#
	#trigger = {
		#has_character_modifier = designated_human_sacrifice_modifier
		#imprisoner = {
			#faith = { has_doctrine_parameter = human_sacrifice_active }
		#}
	#}
	#
	#immediate = {
		#save_scope_as = dead_designated_sacrifice
		#imprisoner = {
			#send_interface_message = {
				#type = event_religious_bad_with_text
				#title = designated_sacrifice_died.t
				#desc = designated_sacrifice_died.desc
				#right_icon = scope:dead_designated_sacrifice
				#add_piety = minor_piety_loss
			#}
		#}
	#}
#}

#	A marked captive has been released without being sacrificed.
#		by Ewan Cowhig Croft
human_sacrifice.0003 = {
	hidden = yes

	trigger = {
		has_character_modifier = designated_human_sacrifice_modifier
		scope:imprisoner = {
			faith = { has_doctrine_parameter = human_sacrifice_active }
		}
	}

	immediate = {
		save_scope_as = released_designated_sacrifice
		scope:imprisoner = {
			if = {
				limit = {
					scope:released_designated_sacrifice = { is_alive = yes }
				}
				send_interface_message = {
					type = event_religious_bad_with_text
					title = designated_sacrifice_release.t
					desc = designated_sacrifice_released.desc
					right_icon = scope:released_designated_sacrifice
					add_piety = medium_piety_loss
				}
			}
		}
		remove_character_modifier = designated_human_sacrifice_modifier
	}
}
