namespace = bp2_yearly_extra

################################
# My Favorite Councilor        #
# by Johan Husén               #
# bp2_yearly_extra             #
################################

# Gaining some skills from your councilor

bp2_yearly_extra.0001 = {
	type = character_event
	content_source = dlc_009
	title = bp2_yearly_extra.0001.t
	desc = bp2_yearly_extra.0001.desc
	theme = education
	left_portrait = {
		character = root
		animation = thinking 
	}
	right_portrait = {
		character = scope:target_councilor
		triggered_animation = {
			trigger = {
				scope:target_councilor = { has_council_position = councillor_court_chaplain }
			}
			animation = chaplain
		}
		triggered_animation = {
			trigger = {
				scope:target_councilor = { has_council_position = councillor_steward }
			}
			animation = steward
		}
		triggered_animation = {
			trigger = {
				scope:target_councilor = { has_council_position = councillor_marshal }
			}
			animation = marshal
		}
		triggered_animation = {
			trigger = {
				scope:target_councilor = { has_council_position = councillor_spymaster }
			}
			animation = spymaster
		}
		triggered_animation = {
			trigger = {
				scope:target_councilor = { has_council_position = councillor_chancellor }
			}
			animation = chancellor
		} 
	}
	cooldown = { years = 15 }

	trigger = {
		has_bp2_dlc_trigger = yes
		is_available_child = yes
		OR = {
			AND = {
				has_focus = education_diplomacy
				exists = cp:councillor_chancellor	
			}
			AND = {
				has_focus = education_martial
				exists = cp:councillor_marshal
			}
			AND = {
				has_focus = education_stewardship
				exists = cp:councillor_steward 
			}
			AND = {
				has_focus = education_intrigue
				exists = cp:councillor_spymaster 
			}
			AND = {
				has_focus = education_learning
				exists = cp:councillor_court_chaplain 
			}	
		}	
	}

	weight_multiplier = {
		base = 1
	}

	immediate = {
		if = {
			limit = {
				has_focus = education_diplomacy
				exists = cp:councillor_chancellor	
			}
			cp:councillor_chancellor = { save_scope_as = target_councilor }
		}
		else_if = {
			limit = {
				has_focus = education_martial
				exists = cp:councillor_marshal	
			}
			cp:councillor_marshal = { save_scope_as = target_councilor }
		}
		else_if = {
			limit = {
				has_focus = education_stewardship
				exists = cp:councillor_steward 
			}
			cp:councillor_steward = { save_scope_as = target_councilor }
		}
		else_if = {
			limit = {
				has_focus = education_intrigue
				exists = cp:councillor_spymaster 
			}
			cp:councillor_spymaster = { save_scope_as = target_councilor }
		}
		else_if = {
			limit = {
				has_focus = education_learning
				exists = cp:councillor_court_chaplain 
			}
			cp:councillor_court_chaplain = { save_scope_as = target_councilor }
		}
	}
	
	# Option A: I want to help out!
	option = {
		name = bp2_yearly_extra.0001.a
		flavor = bp2_yearly_extra.0001.a.tt

		if = {
			limit = { has_focus = education_diplomacy }
			add_diplomacy_skill = 1
		}
		else_if = {
			limit = { has_focus = education_martial }
			add_martial_skill = 1
		}
		else_if = {
			limit = { has_focus = education_stewardship }
			add_stewardship_skill = 1
		}
		else_if = {
			limit = { has_focus = education_intrigue }
			add_intrigue_skill = 1
		}
		else_if = {
			limit = { has_focus = education_learning }
			add_learning_skill = 1
		}
		stress_impact = {
			base = miniscule_stress_impact_gain
			diligent = minor_stress_impact_loss
			lazy = minor_stress_impact_gain
		}
		scope:target_councilor = {
			add_opinion = {
				target = root 
				modifier = frustrated_opinion
				opinion = -20
			}
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = lazy
				factor = 0
			}			
		}
	}
	
	# Option B: I just like to see them work.
	option = {
		name = bp2_yearly_extra.0001.b
		flavor = bp2_yearly_extra.0001.b.tt
		scope:target_councilor = {
			add_opinion = {
				target = root 
				modifier = thankful_opinion
				opinion = 20
			}
		}
		stress_impact = {
			base = minor_stress_impact_loss
			diligent = medium_stress_impact_loss
		}
		ai_chance = {
			base = 100
			modifier = {
				has_trait = diligent
				factor = 0
			}
			modifier = {
				has_trait = lazy
				add = 50
			}
			modifier = {
				has_trait = curious
				add = 50
			}
			modifier = {
				has_trait = pensive
				add = 50
			}
		}
	}
}
