﻿### Wet Nurse Tasks ###

wet_nurse_instill_virtue = {
	court_position_types = { wet_nurse_court_position }

	# Monthly cost for the task
	cost = {
		round = no
		prestige = {
			add = {
				value = monthly_court_position_task_cost
				desc = COURT_POSITION_TASK_COST_BREAKDOWN_BASE
				format = "BASE_VALUE_FORMAT_DECIMALS_PLUS_NEGATIVE"
			}
		}
	}

	is_valid_showing_failures_only = {
		faith = scope:liege.faith
	}

	employee_modifier = {
		child_opinion = 10
	}

	on_start = {
		custom_tooltip = wet_nurse_instill_virtue_fallback_tt
	}

	on_monthly = {
		save_scope_as = wetnurse_trait_giver
		liege_or_court_owner = { save_scope_as = notification_character }
		scope:notification_character = {
			random_courtier_or_guest = {
				limit = {
					is_adult = no
					age >= 6
					number_of_personality_traits < 3
					trigger_if = {
						limit = {
							any_relation = { type = guardian }
						}
						any_relation = {
							type = guardian
							NOT = { this = scope:notification_character }
						}
					}
				}
				random = {
					chance = {
						value = 1
						add = {
							value = "scope:wetnurse_trait_giver.aptitude(wet_nurse_court_position)"
							multiply = 0.4
						}
					}
					instill_virtue_trait_effect = yes
				}
			}
			if = {
				limit = {
					is_adult = no
					number_of_personality_traits < 3
					age >= 6
				}
				random = {
					chance = {
						value = 1
						add = {
							value = "scope:wetnurse_trait_giver.aptitude(court_tutor_court_position)"
							multiply = 0.5 # Unop: Was 1 wich seems high, you'll still get your virtues, just not as quickly
						}
					}
					instill_virtue_trait_effect = yes
				}
			}
		}
	}

	ai_will_do = {
		value = 0 # Never used by AI
	}
}

wet_nurse_promote_relationships = {
	court_position_types = { wet_nurse_court_position }

	# Monthly cost for the task
	cost = {
		round = no
		prestige = {
			add = {
				value = monthly_court_position_task_cost
				desc = COURT_POSITION_TASK_COST_BREAKDOWN_BASE
				format = "BASE_VALUE_FORMAT_DECIMALS_PLUS_NEGATIVE"
			}
		}
	}

	base_employer_modifier = {
		child_opinion = 5
	}

	employee_modifier = {
		diplomacy = 2
	}

	on_start = {
		custom_tooltip = wet_nurse_promote_relationships_fallback_tt
	}

	on_monthly = {
		liege_or_court_owner = { save_scope_as = notification_character }
		scope:notification_character = {
			random = {
				chance = {
					value = 2
					add = {
						value = "aptitude(wet_nurse_court_position)"
						multiply = 0.3
					}
				}
				random_courtier_or_guest = {
					limit = {
						is_adult = no
					}
					save_scope_as = child_character
					scope:notification_character = {
						random_courtier_or_guest = {
							limit = {
								is_adult = no
								this != scope:child_character
							}
							save_scope_as = child_character_2
						}
					}
					random_list = {
						5 = { # Remove bully
							trigger = {
								any_relation = {
									type = bully
								}
							}
							promote_relationships_remove_relation_effect = { RELATION = bully }
						}
						5 = { # Remove victim
							trigger = {
								any_relation = {
									type = victim
								}
							}
							promote_relationships_remove_relation_effect = { RELATION = victim }
						}
						2 = { # Build friendship
							trigger = {
								exists = scope:child_character_2
							}
							scope:child_character = {
								progress_towards_friend_effect = {
									CHARACTER = scope:child_character_2
									OPINION = 15
									REASON = friend_upgrade_generic
								}
							}
						}
					}
				}
			}
		}
	}

	ai_will_do = {
		value = 0 # Never used by AI
	}
}

wet_nurse_promote_competition = {
	court_position_types = { wet_nurse_court_position }

	# Monthly cost for the task
	cost = {
		round = no
		prestige = {
			add = {
				value = monthly_court_position_task_cost
				desc = COURT_POSITION_TASK_COST_BREAKDOWN_BASE
				format = "BASE_VALUE_FORMAT_DECIMALS_PLUS_NEGATIVE"
			}
		}
	}

	employee_modifier = {
		intrigue = 1
		prowess = 1
		child_opinion = -5
	}

	on_start = {
		custom_tooltip = wet_nurse_promote_competition_fallback_tt
	}

	on_monthly = {
		liege_or_court_owner = { save_scope_as = notification_character }
		scope:notification_character = {
			random = {
				chance = {
					value = 1
					add = {
						value = "aptitude(wet_nurse_court_position)"
						multiply = 0.4
					}
				}
				random_courtier_or_guest = {
					limit = {
						is_adult = no
						NOT = { has_variable = wet_nurse_promote_competition_char_cooldown }
					}
					set_variable = {
						name = wet_nurse_promote_competition_char_cooldown
						months = 6
					}
					save_scope_as = child_character
					scope:notification_character = {
						random_courtier_or_guest = {
							limit = {
								is_adult = no
								this != scope:child_character
							}
							save_scope_as = child_character_2
						}
					}
					random_list = {
						5 = { # Gain intrigue
							add_intrigue_skill = 1
						}
						5 = { # Gain prowess
							add_prowess_skill = 1
						}
					}
					if = {
						limit = {
							exists = scope:child_character_2
						}
						random = {
							chance = 50
							progress_towards_rival_effect = {
								REASON = rival_ignored_suffering
								CHARACTER = scope:child_character_2 #Unop: Replaced: scope:second with scope:child_character_2 as second is not defined
								OPINION = default_rival_opinion
							}
						}
					}
				}
			}
		}
	}

	ai_will_do = {
		value = 0 # Never used by AI
	}
}
