﻿### Court Physician Tasks ###

physician_treat_epidemic = {
	court_position_types = { court_physician_court_position }

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

	is_shown = {
		is_landed_or_landless_administrative = yes
	}

	employee_modifier = {
		monthly_prestige = minor_court_position_task_prestige_salary
	}

	scaling_employer_modifiers = {
		terrible = {
		 	epidemic_resistance = 2
		}
		poor = {
		 	epidemic_resistance = 5
		}
		average = {
		 	epidemic_resistance = 7
		}
		good = {
		 	epidemic_resistance = 10
		}
		excellent = {
		 	epidemic_resistance = 15
		}
	}

	ai_will_do = {
		value = 30
		if = {
			limit = {
				any_sub_realm_county = {
					any_county_province = {
						any_province_epidemic = {
							count >= 1
						}
					}
				}
				NOT = { has_trait = avaricious }
			}
			multiply = 1.5
		}
		if = {
			limit = {
				any_sub_realm_county = {
					any_county_province = {
						any_province_epidemic = {
							count >= 1
							outbreak_intensity >= major
						}
					}
				}
			}
			multiply = 2
		}
		if = {
			limit = {
				capital_county ?= {
					any_county_province = {
						any_province_epidemic = {
							count >= 1
						}
					}
				}
			}
			multiply = 2
		}
		if = {
			limit = {
				monthly_character_income < monthly_court_position_task_cost_double
				NOT = {
					capital_county ?= {
						any_county_province = {
							any_province_epidemic = {
								count >= 1
								outbreak_intensity >= major
							}
						}
					}
				}
			}
			add = -1000
		}
	}
}

physician_guard_family = {
	court_position_types = { court_physician_court_position court_tutor_court_position court_scholar_court_position wizard_court_position }

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

	employee_modifier = {
		monthly_lifestyle_xp_gain_mult = 0.2
	}

	scaling_employer_modifiers = {
		terrible = {
		 	monthly_lifestyle_xp_gain_mult = 0.02
		}
		poor = {
		 	monthly_lifestyle_xp_gain_mult = 0.04
		}
		average = {
		 	monthly_lifestyle_xp_gain_mult = 0.06
		}
		good = {
		 	monthly_lifestyle_xp_gain_mult = 0.08
		}
		excellent = {
		 	monthly_lifestyle_xp_gain_mult = 0.1
		}
	}

	is_shown = {  }
	is_valid_showing_failures_only = { }

	on_start = { }
	on_end = { }

	ai_will_do = {
		value = 30
		if = {
			limit = {
				monthly_character_income < monthly_court_position_task_cost_double
			}
			add = -1000
		}
	}
}

physician_improve_self = {
	court_position_types = { court_physician_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 = {
		lifestyle_physician_xp_gain_mult = 0.25
	}

	on_start = {
		custom_tooltip = physician_improve_self_fallback_tt
	}

	on_monthly = {
		random = {
			chance = {
				value = 3
				add = {
					value = "aptitude(court_physician_court_position)"
					multiply = 0.5
				}
			}
			if = {
				limit = {
					NOT = { has_trait = lifestyle_physician }
				}
				add_trait = lifestyle_physician
			}
			else = {
				random_list = {
					30 = {
						add_learning_skill = 1
					}
					70 = {
						trigger = {
							has_trait_xp = {
								trait = lifestyle_physician
								value <= 100
							}
						}
						add_trait_xp = {
							trait = lifestyle_physician
							value = 3
						}
					}
				}
			}
		}
	}

	ai_will_do = {
		value = 50 # Always good
		if = {
			limit = {
				monthly_character_income < monthly_court_position_task_cost_double
			}
			add = -1000
		}
	}
}

