﻿
######################################################################
# EFFECTS
######################################################################

@cost_to_learn_physician_1 = 100
@cost_to_learn_physician_1_with_perk = 50

@cost_to_learn_physician_2 = 150
@cost_to_learn_physician_2_with_perk = 75

@cost_to_learn_physician_3 = 200
@cost_to_learn_physician_3_with_perk = 100

@months_to_learn_physician_1 = 12
@months_to_learn_physician_2 = 18
@months_to_learn_physician_3 = 24

physician_training_1 = {

	scope:actor = {
		send_interface_toast = {
			type = msg_character_level_increase
			title = character_undergoing_physician_training_title
			desc = character_undergoing_physician_training
			left_icon = scope:recipient
		}
		
		if = {
			limit = {
				NOT = { has_perk = anatomical_studies_perk }
			}
			
			remove_short_term_gold = @cost_to_learn_physician_1
		}
		else = {
			remove_short_term_gold = @cost_to_learn_physician_1_with_perk
		}
		
		trigger_event = {
			id = physician_training.0011
			months = @months_to_learn_physician_1
		}
	}
	
	scope:recipient = {
		move_to_pool = yes
		
		add_trait = ucp_busy_physician_training
		
		add_character_flag = {
			flag = physician_training_unavailable
			months = @months_to_learn_physician_1
		}
		
		# this is needed in case the actor dies during the recipient's training		
		trigger_event = {
			id = physician_training.0021
			months = @months_to_learn_physician_1
		}
		
	}

	scope:actor = {
		add_courtier = scope:recipient
	}

}

physician_training_2 = {

	scope:actor = {
		send_interface_toast = {
			type = msg_character_level_increase
			title = character_undergoing_physician_training_title
			desc = character_undergoing_physician_training
			left_icon = scope:recipient
		}
		
		if = {
			limit = {
				NOT = { has_perk = anatomical_studies_perk }
			}
			
			remove_short_term_gold = @cost_to_learn_physician_2
		}
		else = {
			remove_short_term_gold = @cost_to_learn_physician_2_with_perk		
		}		
		
		trigger_event = {
			id = physician_training.0012
			months = @months_to_learn_physician_2
		}		
	}
	
	scope:recipient = {
		move_to_pool = yes		
		
		add_trait = ucp_busy_physician_training
		
		add_character_flag = {
			flag = physician_training_unavailable
			months = @months_to_learn_physician_2
		}
		
		# this is needed in case the actor dies during the recipient's training		
		trigger_event = {
			id = physician_training.0022
			months = @months_to_learn_physician_2
		}
		
	}
	
	scope:actor = {
		add_courtier = scope:recipient
	}

}

physician_training_3 = {

	scope:actor = {
		send_interface_toast = {
			type = msg_character_level_increase
			title = character_undergoing_physician_training_title
			desc = character_undergoing_physician_training
			left_icon = scope:recipient
		}
		
		if = {
			limit = {
				NOT = { has_perk = anatomical_studies_perk }
			}
			
			remove_short_term_gold = @cost_to_learn_physician_3
		}
		else = {
			remove_short_term_gold = @cost_to_learn_physician_3_with_perk		
		}		
		
		trigger_event = {
			id = physician_training.0013
			months = @months_to_learn_physician_3
		}		
	}
	
	scope:recipient = {
		move_to_pool = yes		
		add_trait = ucp_busy_physician_training
		
		add_character_flag = {
			flag = physician_training_unavailable
			months = @months_to_learn_physician_3
		}
		
		# this is needed in case the actor dies during the recipient's training		
		trigger_event = {
			id = physician_training.0023
			months = @months_to_learn_physician_3
		}
	
	}
	
	scope:actor = {
		add_courtier = scope:recipient
	}

}


physician_training_1_complete = {

	#if meanwhile, the courtier left to another court, they are called back, because investment
	root = {
		add_courtier = scope:recipient
	}

	scope:recipient = {	

		add_trait = lifestyle_physician	
		
		add_opinion = {
			target = root
			modifier = sponsored_my_physician_training
		}
		
	}

}

physician_training_1_complete_with_dismissal = {

	scope:recipient = {		
		
		add_trait = lifestyle_physician	
		
		add_opinion = {
			target = root
			modifier = sponsored_my_physician_training
		}
		
		if = {
			limit = {
				is_courtier_of = root
			}
			
			move_to_pool = yes
		}
		
	}

}

physician_training_2_complete = {

	#if meanwhile, the courtier left to another court, they are called back, because investment
	root = {	
		add_courtier = scope:recipient
	}

	scope:recipient = {

		hidden_effect = {
			remove_trait = lifestyle_physician
			add_trait = lifestyle_physician
		}
	
		add_trait_xp = {
			trait = lifestyle_physician
			value = trait_second_level
		}
		
		add_opinion = {
			target = root
			modifier = sponsored_my_physician_training
		}
		
	}

}

physician_training_2_complete_with_dismissal = {

	scope:recipient = {	

		hidden_effect = {
			remove_trait = lifestyle_physician
			add_trait = lifestyle_physician
		}

		add_trait_xp = {
			trait = lifestyle_physician
			value = trait_second_level
		}
		
		add_opinion = {
			target = root
			modifier = sponsored_my_physician_training
		}
		
		if = {
			limit = {
				is_courtier_of = root
			}
			
			move_to_pool = yes
		}
	}

}

physician_training_3_complete = {

	#if meanwhile, the courtier left to another court, they are called back, because investment
	root = {
		add_courtier = scope:recipient
	}

	scope:recipient = {

		hidden_effect = {
			remove_trait = lifestyle_physician
			add_trait = lifestyle_physician
		}
	
		add_trait_xp = {
			trait = lifestyle_physician
			value = trait_third_level
		}
		
		add_opinion = {
			target = root
			modifier = sponsored_my_physician_training
		}
		
	}

}

physician_training_3_complete_with_dismissal = {

	scope:recipient = {

		hidden_effect = {
			remove_trait = lifestyle_physician
			add_trait = lifestyle_physician
		}
	
		add_trait_xp = {
			trait = lifestyle_physician
			value = trait_third_level
		}
		
		add_opinion = {
			target = root
			modifier = sponsored_my_physician_training
		}
		
		if = {
			limit = {
				is_courtier_of = root
			}
			
			move_to_pool = yes
		}
	}

}
