﻿
#####################################################################
# EFFECT LIST
#####################################################################
# !!! Remember to add all new effects with a short description here !!!

#save_var_scope_effect - To check for a variable saved scope and save it as a scope

#####################################################################
# EFFECTS
#####################################################################

#To check for a scope saved to a variable and save it as a scope
save_var_scope_effect = {
	var:$VAR$ = {
		save_scope_as = $VAR$
	}
}

#To loan money from someone (Remember: you can only have one loan at a time!)
set_up_loan_effect = {
	set_variable = {
		name = loan_holder
		value = $LENDER$
	}
	set_variable = {
		name = loan_amount_owed
		value = $AMOUNT$
	}
	$LENDER$ = { #To make the loan inheritable
		set_variable = {
			name = owes_me_money
			value = root
		}
		hidden_effect = {
			set_variable = {
				name = loan_amount_lent
				value = prev.var:loan_amount_owed
			}
			if = {
				limit  = { exists = var:loan_amount_lent }
				pay_short_term_gold = {
					target = root
					gold = var:loan_amount_lent
				}
				remove_variable = loan_amount_lent
			}
 		}
	}
}

disease_data_save_contraction_effect = {
	if = {
		limit = {
			activate_disease_data_tracking_trigger = yes
			has_variable = disease_data_activate_tracking
		}
		
		change_variable = {
			name = disease_data_character_$DISEASE$_amount
			add = 1
		}
	}
}

#ARTIFACTS 
add_character_artifact_claim_to_scope_effect = {
	prev = { save_scope_as = artifact }
	if = {
		limit = {
			NOT = { 
				$SCOPE$ = { has_personal_artifact_claim = scope:artifact }
			}
		}
		$SCOPE$ = { add_personal_artifact_claim = prev }
	}	
}

# For setting randomized event locales
get_random_location_effect = {
	hidden_effect = {
	    random_list = {
	        1 = { # Library
	            trigger = {
	                NOT = { government_has_flag = government_is_tribal }
	            }
	            set_variable = {
	                name = random_location
	                value = 0
	            }  
	        }
	        1 = { # Garden
	            set_variable = {
	                name = random_location
	                value = 1
	            }  
	        }
	        1 = { # Corridor
	            set_variable = {
	                name = random_location
	                value = 2
	            }  
	        }
	        1 = { # Council Chamber
	            trigger = {
	                NOT = { government_has_flag = government_is_tribal }
	            }
	            set_variable = {
	                name = random_location
	                value = 3
	            }  
	        }
	        1 = { # Throne Room
	            set_variable = {
	                name = random_location
	                value = 4
	            }  
	        }
	        1 = { # War Camp
	            trigger = { is_in_army = yes }
	            set_variable = {
	                name = random_location
	                value = 5
	            }  
	        }
	    }
	}
}

# For setting or adding a character to the bought_truce_list
add_to_bought_truce_list = {
	add_to_variable_list = {
		name = bought_truce_list
		target = $TARGET$
		days = $DAYS$
	}
}
