﻿namespace = enfp_bastard

# "A Bastard at Court" Pious powerful vassal is ticked off that you have a bastard  
enfp_bastard.0001 = {
	type = character_event
	title = enfp_bastard.0001.t
	desc = enfp_bastard.0001.desc
	theme = dynasty
	override_background = { reference = council_chamber }
	cooldown = { years = 50 }

	trigger = {
		is_available = yes

		any_child = {
			OR = {
				has_trait = bastard
				has_trait = bastard_founder
			}
			NOT = {
				has_trait = devoted
			}
			is_courtier_of = root
			is_ai = yes
			is_available = yes
		}

		any_vassal = {
			OR = {
				has_vassal_stance = zealot
				has_trait = zealous
			}
			is_available = yes
			age > 13
			faith = {
				OR = {
					has_doctrine_parameter = bastards_legitimize
					has_doctrine_parameter = bastards_always
				}
			}
			is_powerful_vassal = yes
			is_ai = yes
		}
	}

	immediate = {
		random_child = {
			limit = {
				is_available = yes
				OR = {
					has_trait = bastard
					has_trait = bastard_founder
				}
			}
			save_scope_as = bastardkid
		}

		random_vassal = {
			limit = {
				is_available = yes
				OR = {
					has_vassal_stance = zealot
					has_trait = zealous
				}
				faith = {
					OR = {
						has_doctrine_parameter = bastards_legitimize
						has_doctrine_parameter = bastards_always
					}
				}
				is_powerful_vassal = yes
				age > 13
			}
			save_scope_as = angryvassal
		}
	}

	left_portrait = {
		character = root
		animation = idle
	}

	right_portrait = {
		character = scope:angryvassal
		animation = disapproval
	}

	lower_center_portrait = {
		character = scope:bastardkid
	}

	option = {
		name = enfp_bastard.0001.a # choose your child

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

		scope:bastardkid = {
			add_opinion = {
					target = root
					opinion = 75
					modifier = grateful_opinion

				}
			
		}		
				scope:angryvassal = {
					set_relation_rival = {
						target = root
						reason = enfp_bastard.0001_chose_bastard
						}
					}
				
		}

		

	


		stress_impact = {
			compassionate = medium_stress_impact_loss
			stubborn = medium_stress_impact_loss
			zealous = major_stress_impact_gain
		}

		ai_chance = {
			base = 10
			modifier = { add = 15 has_trait = compassionate }
			modifier = { add = 15 has_trait = stubborn }
		}
	}

	option = {
		name = enfp_bastard.0001.b # choose to please your angry vassal

		scope:bastardkid = {
			if = {
				limit = {
					NOR = {
						has_trait = zealous
						has_trait = content
						
					}
				}
				scope:bastardkid = {

					set_relation_rival = { 
						target = root
						reason = enfp_bastard.0001.b.chose_vassal
					}
				}

				add_opinion = {
					target = root
					opinion = -75
					modifier = angry_opinion

				}
			}
			add_trait = devoted
		}

		stress_impact = {
			stubborn = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain
			compassionate = medium_stress_impact_gain
			zealous = major_stress_impact_loss
			just = medium_stress_impact_gain
		}

		ai_chance = {
			base = 10
			modifier = { add = -10 has_trait = stubborn }
			modifier = { add = 10 has_trait = arrogant }
			modifier = { add = -15 has_trait = compassionate }
			modifier = { add = 50 has_trait = zealous }
			modifier = { add = -15 has_trait = just }
		}

		scope:angryvassal = {
			add_opinion = {
				target = root
				modifier = grateful_opinion
				opinion = 50
			}
		}
	}
}

# "The Weight of Bastardy" As a legitimized bastard, you feel unworthy to hold your titles.
enfp_bastard.0002 = {
	type = character_event
	title = enfp_bastard.0002.t
	desc = enfp_bastard.0002.desc
	theme = dynasty
	cooldown = { years = 25 }

	trigger = {
		age > 13
		is_landed = yes
		has_trait = legitimized_bastard
		is_available = yes
		NOT = {
			has_trait = sadistic
			has_trait = callous
		}
		faith = {
			OR = {
				has_doctrine_parameter = bastards_legitimize
				has_doctrine_parameter = bastards_always
			}
		}
	}

	left_portrait = {
		character = root
		animation = worry
	}

	# lose legitimacy or influence, gain stress, you are unworthy! (default option)
	option = {
		name = enfp_bastard.0002.a

		if = {
			limit = { has_government = administrative_government }
			change_influence = major_influence_loss
		}
		else = {
			add_legitimacy = major_legitimacy_loss
		}

		add_prestige = major_prestige_loss

		stress_impact = {
			ambitious = major_stress_impact_gain
			arrogant = major_stress_impact_gain
			humble = major_stress_impact_loss
			content = major_stress_impact_loss
		}

		ai_chance = {
			base = 50
			modifier = { add = -50 has_trait = ambitious }
			modifier = { add = -50 has_trait = arrogant }
			modifier = { add = 50 has_trait = humble }
			modifier = { add = 50 has_trait = content }
		}
	}

	# I am arrogant or ambitious, who cares who my mother or father was--I will do great things!
	option = {
		name = enfp_bastard.0002.b

		trigger = {
			OR = {
				has_trait = arrogant
				has_trait = ambitious
			}
		}

		stress_impact = {
			ambitious = major_stress_impact_loss
			arrogant = major_stress_impact_loss
			humble = major_stress_impact_gain
			content = major_stress_impact_gain
		}

		ai_chance = {
			base = 50
			modifier = { add = 50 has_trait = ambitious }
			modifier = { add = 50 has_trait = arrogant }
			modifier = { add = -50 has_trait = humble }
			modifier = { add = -50 has_trait = content }
		}
	}
}


# "Bastard Blood," You catch one of your vassals talking trash about your heritage behind your back.
enfp_bastard.0003 = {
	type = character_event
	title = enfp_bastard.0003.t
	desc = enfp_bastard.0003.desc
	theme = dynasty
	cooldown = { years = 25 }

	trigger = {
		age > 13
		is_landed = yes
		OR = {
		has_trait = legitimized_bastard
		has_trait = bastard_founder
		
		}
		is_available = yes
		
		
		faith = {
			OR = {
				has_doctrine_parameter = bastards_legitimize
				has_doctrine_parameter = bastards_always
			}
		}

		any_vassal = {
			is_available = yes
			is_powerful_vassal = yes
			age > 13
			faith = {
			OR = {
				has_doctrine_parameter = bastards_legitimize
				has_doctrine_parameter = bastards_always
			}
			}
		}
		
	}

	immediate = {
		random_vassal = {
			limit = {
				is_available = yes
				is_powerful_vassal = yes
				age > 13
				faith = {
				OR = {
				has_doctrine_parameter = bastards_legitimize
				has_doctrine_parameter = bastards_always
				}
				}
			}
				save_scope_as = meanvassal

		}
	}

	left_portrait = {
		character = root
		animation = eavesdrop
		
	}
	lower_center_portrait = {
		character = scope:meanvassal

	}

# How dare you!
	option = {
	name = enfp_bastard.0003.a
		set_relation_rival = scope:meanvassal
		add_prestige = major_prestige_loss

	if = {
			limit = { has_government = administrative_government }
			change_influence = major_influence_loss
		}
			else = {
			add_legitimacy = major_legitimacy_loss
		}

		stress_impact = {
			ambitious = medium_stress_impact_gain
			arrogant = medium_stress_impact_gain	
		}

		ai_chance = {
			base = 50
			modifier = { add = 50 has_trait = ambitious }
			modifier = { add = 50 has_trait = arrogant }
			modifier = { add = -50 has_trait = humble }
			modifier = { add = -50 has_trait = content }
			modifier = { add = -50 has_trait = shy }
			modifier = { add = -50 has_trait = compassionate }
			modifier = { add = -50 has_trait = forgiving }
		}

	}
# whatever man, I'll let it go this time
	option = {
	name = enfp_bastard.0003.b
		add_piety = major_piety_gain
	if = {
			limit = { has_government = administrative_government }
			change_influence = major_influence_loss
		}
			else = {
			add_legitimacy = major_legitimacy_loss
		}
		scope:meanvassal = {
			add_opinion = {
                target = root
                modifier = grateful_opinion
                opinion = 50
            }
		}

		stress_impact = {
			ambitious = massive_stress_impact_gain
			arrogant = massive_stress_impact_gain
			forgiving = major_stress_impact_loss
			humble = medium_stress_impact_loss	
		}
		ai_chance = {
			base = 50
			modifier = { add = -50 has_trait = ambitious }
			modifier = { add = -50 has_trait = arrogant }
			modifier = { add = 50 has_trait = humble }
			modifier = { add = 50 has_trait = content }
			modifier = { add = 50 has_trait = compassionate }
			modifier = { add = 50 has_trait = forgiving }

			
		}
	}
# erm well, uh... I didnt even hear anything!
	
	option = {
		trait = shy
		name = enfp_bastard.0003.c
		
		trigger = { 
			has_trait = shy
		}

		if = {
			limit = { has_government = administrative_government }
			change_influence = medium_influence_loss
		}
			else = {
			add_legitimacy = medium_legitimacy_loss
		}
		stress_impact = {
			shy = major_stress_impact_loss
			ambitious = massive_stress_impact_gain
			arrogant = massive_stress_impact_gain

		} 

		ai_chance = {
			base = 50
			modifier = { add = -50 has_trait = ambitious }
			modifier = { add = -50 has_trait = arrogant }
			modifier = { add = 75 has_trait = shy}
		}
	
	}
# obligatory sadistic option
	option = {
		trait = sadistic
		trait = wrathful
		name =  enfp_bastard.0003.d 
		trigger = {
			has_trait = sadistic
		}

		scope:meanvassal = {
            death = {
                death_reason = death_execution
                killer = root
            }
        }

		murder_opinion_effect = {
			VICTIM = scope:meanvassal
			MURDERER = root
		}

		add_tyranny = major_tyranny_gain
		add_dread = major_dread_gain

	
		ai_chance = {
			base = 25
			modifier = { add = 25 has_trait = sadistic }
			modifier = { add = 10 has_trait = wrathful }
		}
	}
	
}

# "Odd One Out," a rude kid at your playdate cant help but refer to your unfortunate status as a bastard 
enfp_bastard.0004 = {
	type = activity_event
	title = enfp_bastard.0004.t 
	desc = enfp_bastard.0004.desc
	theme = playdate_activity
	cooldown = { years = 30}

	trigger = {
		faith = {
			OR = {
				has_doctrine_parameter = bastards_legitimize
				has_doctrine_parameter = bastards_always
			}
		}
		OR = {
			has_trait = legitimized_bastard
			has_trait = bastard
		}
		scope:activity = {
			any_attending_character = {
				NOT = { this = root }
				faith = {
			OR = {
				has_doctrine_parameter = bastards_legitimize
				has_doctrine_parameter = bastards_always
			}
		}

			OR = {
				has_trait = arrogant
				has_trait = chaste
				has_trait = honest
				has_trait = callous 
				has_trait = zealous
				has_trait = rowdy
				has_trait = bossy
				

			}
			NOR = {
				
				has_trait = compassionate
				has_trait = pensive
				has_trait = shy
				has_trait = reclusive
				has_trait = bastard
				has_trait = legitimized_bastard
			}

			}
		}
	}

	immediate = {
	scope:activity = {
		random_attending_character = {
			limit = {
				NOT = { this = root }

				faith = {
					OR = {
						has_doctrine_parameter = bastards_legitimize
						has_doctrine_parameter = bastards_always
					}
				}

				OR = {
					has_trait = arrogant
					has_trait = chaste
					has_trait = honest
					has_trait = callous 
					has_trait = zealous
					has_trait = rowdy
					has_trait = bossy
				}

				NOR = {
					has_trait = compassionate
					has_trait = pensive
					has_trait = shy
					has_trait = reclusive
					has_trait = bastard
					has_trait = legitimized_bastard
				}
			}
			save_scope_as = rudekid
		}
	}
	}

	left_portrait = {
        character = root
        animation = worry
    }

	right_portrait = {
        character = scope:rudekid
        animation = disapproval
    }

# stop being mean to me!
	option = {
	name = enfp_bastard.0004.a

	add_prowess_skill = 3
	
	scope:rudekid = {
		add_opinion = {
			target = root
			opinion = -75
			modifier = angry_opinion
		}
		set_relation_rival = {
			target = root
			reason = enfp_bastard.0004_rude_bastard
		}

		scope:activity = {
				add_activity_log_entry = {
					key = enfp_bastard_playdate_became_rivals
					tags = { bad }
					score = 10
					character = root
					target = scope:rudekid
				}
			}
	}
	stress_impact = {
		shy = major_stress_impact_gain
		pensive = major_stress_impact_gain
		forgiving = major_stress_impact_gain
		vengeful = major_stress_impact_loss
		rowdy = major_stress_impact_loss

	}

	ai_chance = {
		base = 10
		modifier = { add = 15 has_trait = vengeful }
			modifier = { add = 15 has_trait = rowdy }

	}
	

	}
# Diplomatic option
	option = {
	name = enfp_bastard.0004.b

	add_diplomacy_skill = 3
	
	stress_impact = {
		shy = major_stress_impact_loss
		pensive = major_stress_impact_loss
		forgiving = major_stress_impact_loss
		vengeful = major_stress_impact_gain
		rowdy = major_stress_impact_gain

	}

	ai_chance = {
		base = 10
		modifier = { add = 15 has_trait = shy }
		modifier = { add = 15 has_trait = pensive }
		modifier = { add = 15 has_trait = forgiving
	}

	}
	}

}

# "Bad Blood," your bastard child gets into a fight with one of your close family members
enfp_bastard.0005 = {
	type = character_event
	title = enfp_bastard.0005.t
	desc = enfp_bastard.0005.desc
	theme = family
	cooldown = { years = 30}

	immediate = {
		random_child = {
			limit = {
				OR = {
					has_trait = bastard
					has_trait = legitimized_bastard
		
				}
				is_available = yes
				age > 13
			}
			save_scope_as = bastardkid
		}
		random_close_family_member = {
			limit = {
				NOR = {
					has_trait = bastard
					has_trait = bastard_founder
					has_trait = legitimized_bastard
					has_trait = compassionate
					has_trait = shy
					is_ai = no
				}
				is_available = yes
				age > 13
			}
			save_scope_as = meanfamily
		}

		scope:bastardkid = {
			set_relation_rival = {
				target = scope:meanfamily
				reason = enfp_family_fight
			}
		}
		
	}

		trigger = {
			age > 13
			any_child = {
				OR = {
					has_trait = bastard
					has_trait = legitimized_bastard
				}
				is_available = yes
				age > 13
				save_temporary_scope_as = tempbastardkid	
			}

			scope:tempbastardkid = {
				any_close_family_member = {
					NOR = {
					has_trait = bastard
					has_trait = legitimized_bastard
					has_trait = bastard_founder
					has_trait = compassionate
					has_trait = shy
					
					}
					is_available = yes
					age > 13
					save_temporary_scope_as = tempmeanfamily
					
				}
			}

			scope:tempmeanfamily = {
				NOR = {
					has_relation_friend = scope:tempbastardkid
					has_relation_best_friend = scope:tempbastardkid
					has_relation_lover = scope:tempbastardkid
					has_relation_soulmate = scope:tempbastardkid
					has_relation_rival = scope:tempbastardkid
					has_relation_nemesis = scope:tempbastardkid
				}
				
			}

			

		}

		left_portrait = {
			character = scope:bastardkid
			animation = anger
		}

		right_portrait = {
			character = scope:meanfamily
			animation = disapproval
		}
	# side with bastard 
	option = {
		name = enfp_bastard.0005.a
			scope:bastardkid = {
				add_opinion = {
					target = root
					opinion = 50
					modifier = grateful_opinion

				}

			
			}

			scope:meanfamily = {
				add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -75
				}	
			}

			ai_chance = {
				base = 50
			}

	}
	# side with family member
	option = {
		name = enfp_bastard.0005.b
		scope:meanfamily = {
				add_opinion = {
					target = root
					opinion = 50
					modifier = grateful_opinion

				}

			
			}

			scope:bastardkid = {
				add_opinion = {
				target = root
				modifier = angry_opinion
				opinion = -75
				}	
			}

			ai_chance = {
				base = 50
			}
	}
}