﻿namespace = subject_extortion

# Subject Extortion events
	# 0001 - Extort a Powerful Vassal, by Petter Vilberg
	# 0002 - Extort a County, by Petter Vilberg
	# 0003 - Extort your Theocratic Vassals, by Petter Vilberg
	# 0004 - Extort all your Vassals, by Petter Vilberg
	# 0005 - Extort all your Courtiers, by Petter Vilberg
	
	# 9999 - Extortion fallback, by Petter Vilberg
	# 9999 - Fire the extortion effect (used for delays)




# Extort a Powerful Vassal
# by Petter Vilberg
subject_extortion.0001 = {
	type = character_event
	title = subject_extortion.0001.t
	desc = subject_extortion.0001.desc
	theme = stewardship
	left_portrait = {
		character = scope:extortion_target
		animation = disapproval
	}

	immediate = {
		scope:extortion_target = {
			extortion_tracking_effect = yes
		}
	}

	option = { # I feel that you owe me
		name = subject_extortion.0001.a
		add_gold = major_gold_value
		scope:extortion_target = {
			add_opinion = {
				target = root
				modifier = extorted_me_opinion
			}
		}
		add_dread = minor_dread_gain
		ai_chance = {
			base = 100
		}
	}

	option = { # I will have *everyone* pay!
		name = subject_extortion.0001.b
		add_tyranny = medium_tyranny_gain
		add_gold = massive_gold_value
		add_legitimacy = miniscule_legitimacy_loss
		add_dread = medium_dread_gain
		ai_chance = { # Keep the chance extremely low to prevent the AI from doing this very often
			base = 1
			ai_value_modifier = {
				ai_greed = 0.1
			}
		}
	}

	option = { # You *do* owe me...
		name = subject_extortion.0001.c
		trigger = {
			has_hook = scope:extortion_target
		}
		use_hook = scope:extortion_target
		add_gold = medium_gold_value
	}
	
	option = { # Back out
		name = subject_extortion.0001.d
		flavor = subject_extortion.0001.d.flavor
		add_prestige = miniscule_prestige_loss
		ai_chance = {
			base = 10
		}
	}
}


# Extort a County
# by Petter Vilberg
subject_extortion.0002 = {
	type = character_event
	title = subject_extortion.0002.t
	desc = subject_extortion.0002.desc
	theme = stewardship
	left_portrait = {
		character = root
		animation = personality_greedy
	}

	immediate = {
		scope:extortion_target = {
			extortion_tracking_effect = yes
		}
	}
	
	option = { # They can pay to do whatever they want
		name = subject_extortion.0002.a
		add_gold = medium_gold_value
		scope:extortion_target = {
			change_county_control = -100
		}
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_honor = 0.5
			}
		}
	}

	option = { # I take what I need
		name = subject_extortion.0002.b
		add_gold = medium_gold_value
		scope:extortion_target = {
			add_county_modifier = {
				modifier = county_extorted_modifier
				years = 10
			}
		}
		add_dread = medium_dread_gain
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = 0.5
			}
		}
	}
	
	option = { # Back out
		name = subject_extortion.0002.c
		add_prestige = miniscule_prestige_loss
		ai_chance = {
			base = 10
		}
	}
}


# Extort your Theocratic Vassals
# by Petter Vilberg
subject_extortion.0003 = {
	type = character_event
	title = subject_extortion.0003.t
	desc = subject_extortion.0003.desc
	theme = stewardship
	left_portrait = {
		character = scope:extortion_target
		animation = disapproval
	}

	immediate = {
		add_character_flag = {
			flag = recently_extorted_theocratic_vassals
			years = 5
		}
		scope:extortion_target = {
			extortion_tracking_effect = yes
		}
	}

	option = { # The clergy has to contribute!
		name = subject_extortion.0003.a
		add_gold = major_gold_value
		add_character_modifier = {
			modifier = extorted_theocratic_vassals_modifier
			years = 10
		}
		add_dread = minor_dread_gain
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_greed = 0.5
			}
		}
	}

	option = { # Have I not earned this, in HighGod's eyes?
		name = subject_extortion.0003.b
		add_piety = medium_piety_loss
		add_gold = medium_gold_value
		ai_chance = {
			base = 50
			ai_value_modifier = {
				ai_zeal = 1
			}
		}
	}
	
	option = { # Back out
		name = subject_extortion.0003.c
		add_prestige = miniscule_prestige_loss
		ai_chance = {
			base = 10
		}
	}
}


# Extort All of Your Vassals
# by Petter Vilberg
subject_extortion.0004 = {
	type = character_event
	title = subject_extortion.0004.t
	desc = subject_extortion.0004.desc
	theme = stewardship
	left_portrait = {
		character = root
		animation = personality_greedy
	}
	
	immediate = {
		add_character_flag = {
			flag = recently_extorted_vassals_at_large
			years = 5
		}
		scope:extortion_target = {
			extortion_tracking_effect = yes
		}
	}

	option = {
		name = subject_extortion.0004.a
		add_gold = major_gold_value
		add_character_modifier = {
			modifier = extorted_vassals_modifier
			years = 5
		}
		add_dread = minor_dread_gain
	}

	option = {
		name = subject_extortion.0004.b
		add_gold = massive_gold_value
		add_tyranny = medium_tyranny_gain
		add_dread = medium_dread_gain
	}
	
	option = { # Back out
		name = subject_extortion.0004.c
		add_prestige = miniscule_prestige_loss
		ai_chance = {
			base = 10
		}
	}
}

# Extort Courtiers
# by Petter Vilberg
subject_extortion.0005 = {
	type = character_event
	title = subject_extortion.0005.t
	desc = subject_extortion.0005.desc
	theme = stewardship
	left_portrait = {
		character = scope:extortion_target
		animation = worry
	}
	
	immediate = {
		add_character_flag = {
			flag = recently_extorted_courtiers
			years = 5
		}
		scope:extortion_target = {
			extortion_tracking_effect = yes
		}	
	}

	option = { # You know full well everything I do for you!
		name = subject_extortion.0005.a
		add_gold = major_gold_value
		add_character_modifier = {
			modifier = extorted_courtiers_modifier
			years = 10
		}
		add_dread = medium_dread_gain
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_rationality = -0.5
				ai_honor = -0.5
			}
		}
	}

	option = { # I believe gifts are in order
		name = subject_extortion.0005.b
		add_gold = medium_gold_value
		add_prestige = medium_prestige_loss
		ai_chance = {
			base = 100
			ai_value_modifier = {
				ai_greed = 0.5
			}
		}
	}
	
	option = {
		name = subject_extortion.0005.c
		add_prestige = miniscule_prestige_loss
		ai_chance = {
			base = 10
		}
	}
}


# Fallback
subject_extortion.9998 = {
	type = character_event
	title = subject_extortion.9998.t
	desc = {
		first_valid = {
			triggered_desc = {
				trigger = {
					exists = scope:steward
				}
				desc = subject_extortion.9998.desc.steward
			}
			desc = subject_extortion.9998.desc
		}
	}
	theme = stewardship
	left_portrait = {
		character = root
		animation = personality_greedy
	}
	right_portrait = {
		character = scope:steward
		animation = worry
	}

	immediate = {
		if = {
			limit = {
				exists = cp:councillor_steward
			}
			cp:councillor_steward = {
				save_scope_as = steward
			}
		}
	}
	
	option = {
		name = subject_extortion.9998.a
		trigger = {
			exists = scope:steward
		}
		add_gold = minor_gold_value
	}
	
	option = {
		name = subject_extortion.9998.b
		trigger = {
			NOT = { exists = scope:steward }
		}
		add_gold = minor_gold_value
	}
}


# Fire the effect
subject_extortion.9999 = {
	hidden = yes

	immediate = {
		extort_subjects_effect = yes
	}
}
