﻿namespace = hold_council

# E1: Budget Dispute - Steward proposes getting more gold
hold_council.0001 = {
	type = character_event
	title = hold_council.0001.t
	desc = hold_council.0001.desc
	theme = stewardship_wealth_focus
	override_background = { reference = council_chamber }

	cooldown = { years = 20}
	
	
	
	trigger = {
		is_available = yes # 
		
		is_adult = yes

		is_landed = yes

		
		exists = cp:councillor_steward
		cp:councillor_steward = {
			is_available = yes 
			is_ai = yes
		}

		
		exists = cp:councillor_marshal
		cp:councillor_marshal = {
			is_available = yes 
			is_ai = yes
		}
		exists = cp:councillor_court_chaplain
		cp:councillor_court_chaplain = {
		}	is_available = yes 
			is_ai = yes
	}
	
	left_portrait = {
		character = scope:steward
		animation = personality_rational
	}

	immediate = {
		cp:councillor_steward = {
			save_scope_as = steward
		}
	}

	option = {
		name = hold_council.0001.a # Refuse
		

		scope:steward = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
		}

		stress_impact = {
			greedy = medium_stress_impact_gain
			generous = medium_stress_impact_loss
		}
		
		
		
		trigger_event = {
			id = hold_council.0002
		}

		ai_chance = {
			base = 10
			modifier = {
				add = 0.1
				has_trait = greedy
			}
			modifier = {
				add = 5.0
				has_trait = generous
			}
			modifier = {
				add = 2.0
				has_trait = stubborn
			}
			modifier = {
				add = 1.5
				has_trait = content
			}
			modifier = {
				add = 0.5
				has_trait = ambitious
			}
			modifier = {
				add = 0.7
				has_trait = gregarious
			}
			modifier = {
				add = 5.0
				has_trait = just
			}

		}
	}

	option = {
		name = hold_council.0001.b 
		

		scope:steward = {
			add_opinion = {
				target = root
				modifier = pleased_opinion
				opinion = 30
			}
		}

		stress_impact = {
			greedy = medium_stress_impact_loss
			generous = medium_stress_impact_gain
		}
		
		trigger_event = {
			id = hold_council.0003
		}

		ai_chance = {
			base = 10
			modifier = {
				add = 5.0
				has_trait = greedy
			}
			modifier = {
				add = 0.1
				has_trait = generous
			}
			modifier = {
				add = 0.5
				has_trait = stubborn
			}
			modifier = {
				add = 0.8
				has_trait = content
			}
			modifier = {
				add = 2.0
				has_trait = ambitious
			}
			modifier = {
				add = 1.5
				has_trait = gregarious
			}
		}
	}
}

# E2A: Steward is upset after refusal
hold_council.0002 = {
	type = character_event
	title = hold_council.0002.t
	desc = hold_council.0002.desc
	theme = stewardship_wealth_focus
	override_background = { reference = council_chamber }
	
	left_portrait = {
		character = scope:steward
		animation = anger
	}

	immediate = {
		cp:councillor_steward = {
			save_scope_as = steward
		}
		
		# Additional opinion loss for certain traits
		scope:steward = {
			if = {
				limit = { has_trait = ambitious }
				add_opinion = {
					target = root
					modifier = angry_opinion
					opinion = -30
				}
			}
			if = {
				limit = { has_trait = vengeful }
				add_opinion = {
					target = root
					modifier = angry_opinion
					opinion = -30
				}
			}
			if = {
				limit = { has_trait = stubborn }
				add_opinion = {
					target = root
					modifier = angry_opinion
					opinion = -30
				}
			}
			
			
		}
	}

	option = {
		name = hold_council.0002.a # Understood
		
		ai_chance = {
			base = 100 # Always accept this single option
		}
	}
}

# E1B: Steward presents funding options
hold_council.0003 = {
	type = character_event
	title = hold_council.0003.t
	desc = hold_council.0003.desc
	theme = stewardship_wealth_focus
	override_background = { reference = council_chamber }
	
	left_portrait = {
		character = scope:steward
		animation = personality_rational
	}
	
	lower_left_portrait = {
		character = scope:marshal
		animation = personality_bold
	}
	
	lower_center_portrait = {
		character = scope:chaplain
		animation = personality_rational
	}

	immediate = {
		cp:councillor_steward = {
			save_scope_as = steward
		}
		cp:councillor_marshal = {
			save_scope_as = marshal
		}
		cp:councillor_court_chaplain = {
			save_scope_as = chaplain
		}
	}

	option = {
		name = hold_council.0003.a # Military funds
		
		skill = stewardship
		
		# Moderate difficulty stewardship challenge
		duel = {
			skill = stewardship
			value = 8 # difficulty
			
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				custom_tooltip = hold_council.0003.a.success_outcome_tt # New tooltip for success
				# Success
				trigger_event = {
					id = hold_council.0004
					
				}
			}
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				custom_tooltip = hold_council.0003.a.failure_outcome_tt # New tooltip for failure
				# Failure
				trigger_event = {
					id = hold_council.0005
					
				}
			}
		}
		
		ai_chance = {
			base = 10
			modifier = {
				add = 2.0
				has_trait = brave
			}
			modifier = {
				add = 1.8
				has_trait = wrathful
			}
			modifier = {
				add = 1.5
				has_trait = ambitious
			}
			modifier = {
				add = 0.5
				has_trait = content
			}
			modifier = {
				add = 0.7
				has_trait = compassionate
			}
		}
	}

	option = {
		name = hold_council.0003.b # Common people funds
		
		skill = stewardship
		
		# Moderate difficulty stewardship challenge
		duel = {
			skill = stewardship
			value = 8 # Moderate difficulty
			
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				custom_tooltip = hold_council.0003.b.success_outcome_tt # New tooltip for success
				# Success
				trigger_event = {
					id = hold_council.0006
					
				}
			}
			75 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				custom_tooltip = hold_council.0003.b.failure_outcome_tt # New tooltip for failure
				# Failure
				trigger_event = {
					id = hold_council.0007
					
				}
			}
		}
		
		ai_chance = {
			base = 10
			modifier = {
				add = 2.0
				has_trait = compassionate
			}
			modifier = {
				add = 1.5
				has_trait = generous
			}
			modifier = {
				add = 1.2
				has_trait = just
			}
			modifier = {
				add = 0.5
				has_trait = callous
			}
			modifier = {
				add = 0.7
				has_trait = greedy
			}
			modifier = {
				add = 0.8
				has_trait = arbitrary
			}
		}
	}

	option = {
		name = hold_council.0003.c # Clergy funds
		
		skill = stewardship
		
		# Moderate difficulty stewardship challenge
		duel = {
			skill = stewardship
			value = 8 # Moderate difficulty
			
			50 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = 3.5
					min = -49
				}
				custom_tooltip = hold_council.0003.c.success_outcome_tt # New tooltip for success
				# Success
				trigger_event = {
					id = hold_council.0008
					
				}
			}
			75 = {
				compare_modifier = {
					value = scope:duel_value
					multiplier = -3.5
					min = -49
				}
				custom_tooltip = hold_council.0003.c.failure_outcome_tt # New tooltip for failure
				# Failure
				trigger_event = {
					id = hold_council.0009
					
				}
			}
		}
		
		ai_chance = {
			base = 10
			modifier = {
				add = -7
				has_trait = zealous
			}
			modifier = {
				add = 5
				has_trait = cynical
			}
			modifier = {
				add = -3
				has_trait = compassionate
			}
			modifier = {
				add = 2
				has_trait = greedy
			}
			modifier = {
				add = 1
				has_trait = arbitrary
			}
		}
	}

	option = {
		name = hold_council.0003.d # Cancel
		
		scope:steward = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -40
			}
		}
		
		stress_impact = {
			greedy = medium_stress_impact_gain
		}
		
		trigger_event = {
			id = hold_council.0002
			
		}
		debug_log = "hold_council.0003: Cancel option chosen. Triggering hold_council.0002"
		
		ai_chance = {
			base = 5
			modifier = {
				add = 5
				has_trait = content
			}
			modifier = {
				add = -2
				has_trait = ambitious
			}
			modifier = {
				add = -4
				has_trait = greedy
			}
			modifier = {
				add = 2
				has_trait = paranoid
			}
		}
	}
}

# E4: Military funds - SUCCESS
hold_council.0004 = {
	type = character_event
	title = hold_council.0004.t
	desc = hold_council.0004.desc
	theme = stewardship_wealth_focus
	override_background = { reference = council_chamber }
	
	left_portrait = {
		character = scope:steward
		animation = happiness
	}
	
	right_portrait = {
		character = scope:marshal
		animation = anger
	}

	immediate = {
		cp:councillor_steward = {
			save_scope_as = steward
		}
		cp:councillor_marshal = {
			save_scope_as = marshal
		}
	}

	option = {
		name = hold_council.0004.a # Excellent work
		
		add_gold = medium_gold_max_value

		add_character_modifier = {
			modifier = military_advantage_penalty_modifier
			months = 30
		}
		
		scope:marshal = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
		}
		
		every_vassal = {
			limit = { has_vassal_stance = glory_hound }
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
		}
		
		stress_impact = {
			generous = minor_stress_impact_gain
			compassionate = minor_stress_impact_gain
			just = minor_stress_impact_gain
			greedy = minor_stress_impact_loss
			callous = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100 # Always accept this single option
		}
	}
}

# E5: Military funds - FAILURE
hold_council.0005 = {
	type = character_event
	title = hold_council.0005.t
	desc = hold_council.0005.desc
	theme = stewardship_wealth_focus
	override_background = { reference = council_chamber }
	
	left_portrait = {
		character = scope:steward
		animation = shame
	}
	
	right_portrait = {
		character = scope:marshal
		animation = anger
	}

	immediate = {
		cp:councillor_steward = {
			save_scope_as = steward
		}
		cp:councillor_marshal = {
			save_scope_as = marshal
		}
	}

	option = {
		name = hold_council.0005.a # We tried our best
		
		add_gold = minor_gold_max_value
		
		scope:marshal = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
		}
		
		every_vassal = {
			limit = { has_vassal_stance = glory_hound }
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
		}
		
		add_character_modifier = {
			modifier = military_advantage_penalty_modifier
			months = 30
		}
		
		stress_impact = {
			generous = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			just = medium_stress_impact_gain
			greedy = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100 # Always accept this single option
		}
	}
}

# E6: Common people funds - SUCCESS
hold_council.0006 = {
	type = character_event
	title = hold_council.0006.t
	desc = hold_council.0006.desc
	theme = stewardship_wealth_focus
	override_background = { reference = council_chamber }
	
	left_portrait = {
		character = scope:steward
		animation = happiness
	}

	immediate = {
		cp:councillor_steward = {
			save_scope_as = steward
		}
		
		# Common effects regardless of success
		every_held_county = {
			add_county_modifier = {
				modifier = popular_opinion_funds_common_people_modifier
				years = 3
			}
		}
	}

	option = {
		name = hold_council.0006.a # The people will understand
		
		add_gold = medium_gold_max_value
		
		stress_impact = {
			compassionate = major_stress_impact_gain
			just = major_stress_impact_gain
			generous = major_stress_impact_gain
			humble = medium_stress_impact_gain
			greedy = minor_stress_impact_loss
			callous = medium_stress_impact_loss
			arrogant = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100 # Always accept this single option
		}
	}
}

# E7: Common people funds - FAILURE
hold_council.0007 = {
	type = character_event
	title = hold_council.0007.t
	desc = hold_council.0007.desc
	theme = stewardship_wealth_focus
	override_background = { reference = council_chamber }
	
	left_portrait = {
		character = scope:steward
		animation = shame
	}

	immediate = {
		cp:councillor_steward = {
			save_scope_as = steward
		}
		
		# Common effects regardless of success
		every_held_county = {
			add_county_modifier = {
				modifier = popular_opinion_funds_common_people_modifier
				years = 3
			}
		}
	}

	option = {
		name = hold_council.0007.a # We did what we could
		
		add_gold = minor_gold_max_value
		
		stress_impact = {
			compassionate = major_stress_impact_gain
			just = major_stress_impact_gain
			generous = major_stress_impact_gain
			humble = medium_stress_impact_gain
			greedy = minor_stress_impact_loss
			callous = medium_stress_impact_loss
			arrogant = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100 # Always accept this single option
		}
	}
}

# E8: Clergy funds - SUCCESS
hold_council.0008 = {
	type = character_event
	title = hold_council.0008.t
	desc = hold_council.0008.desc
	theme = stewardship_wealth_focus
	override_background = { reference = council_chamber }
	
	left_portrait = {
		character = scope:steward
		animation = happiness
	}
	
	right_portrait = {
		character = scope:chaplain
		animation = anger
	}

	immediate = {
		cp:councillor_steward = {
			save_scope_as = steward
		}
		cp:councillor_court_chaplain = {
			save_scope_as = chaplain
		}
		
		# Common effects regardless of success
		scope:chaplain = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
			
			
		}
		
		every_vassal = {
			limit = { has_vassal_stance = zealot }
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
		}
		
	 add_piety = major_piety_loss
	}

	option = {
		name = hold_council.0008.a # God will forgive me
		
		add_gold = medium_gold_max_value
		
		stress_impact = {
			zealous = major_stress_impact_gain
			generous = medium_stress_impact_gain
			just = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			greedy = medium_stress_impact_loss
			cynical = minor_stress_impact_loss
			callous = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100 # Always accept this single option
		}
	}
}

# E9: Clergy funds - FAILURE
hold_council.0009 = {
	type = character_event
	title = hold_council.0009.t
	desc = hold_council.0009.desc
	theme = stewardship_wealth_focus
	override_background = { reference = council_chamber }
	
	left_portrait = {
		character = scope:steward
		animation = shame
	}
	
	right_portrait = {
		character = scope:chaplain
		animation = anger
	}

	immediate = {
		cp:councillor_steward = {
			save_scope_as = steward
		}
		cp:councillor_court_chaplain = {
			save_scope_as = chaplain
		}
		
		# Common effects regardless of success
		scope:chaplain = {
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
			
			
		}
		
		every_vassal = {
			limit = { has_vassal_stance = zealot }
			add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -50
			}
		}
		
		add_piety = major_piety_loss
	}

	option = {
		name = hold_council.0009.a # We tried our best
		
		add_gold = medium_gold_max_value
		
		stress_impact = {
			zealous = major_stress_impact_gain
			generous = medium_stress_impact_gain
			just = medium_stress_impact_gain
			compassionate = minor_stress_impact_gain
			greedy = medium_stress_impact_loss
			cynical = minor_stress_impact_loss
			callous = minor_stress_impact_loss
		}
		
		ai_chance = {
			base = 100 
		}
	}
}