﻿# Returns whether or not ACTOR can drain TRAIT from TARGET.
# Specifically tests for non-leveled traits.
#
# Only evaluates to true if TARGET has TRAIT and ACTOR doesn't.
#
# Parameters (All Required):
# ACTOR = the character doing the trait draining.
# TARGET = the character being drained.
# TRAIT = the trait or trait group being drained.
exhaurire_vitale_can_drain_fixed_trait = {
	$ACTOR$ = {
		NOT = {
			has_trait = $TRAIT$
		}
	}
	$TARGET$ = {
		has_trait = $TRAIT$
	}
}

# Returns whether or not ACTOR can drain TRAIT from TARGET.
# Specifically tests for leveled traits.
#
# Only evaluates to true if TARGET has a higher rank of TRAIT than ACTOR.
#
# Parameters (All Required):
# ACTOR = the character doing the trait draining.
# TARGET = the character being drained.
# TRAIT = the trait or trait group being drained.
exhaurire_vitale_can_drain_leveled_trait = {
	$ACTOR$ = {
		has_trait_rank = {
			trait = $TRAIT$
			character < $TARGET$
		}
	}
	$TARGET$ = {
		has_trait = $TRAIT$
	}
}

# Returns whether or not ACTOR can drain any traits from TARGET.
#
# Only evaluates to true if TARGET has a higher rank of any drainable trait
# than ACTOR.
#
# Note: List here should be kept in sync with parallel list in
# regula_exhaurire_vitale_effects.txt.
#
# Parameters (All Required):
# ACTOR = the character doing the trait draining.
# TARGET = the character being drained.
exhaurire_vitale_can_drain_any_trait = {
	custom_description = {
		text = regula_exhaurire_vitale_can_drain_any_trait_trigger
		OR = {
			exhaurire_vitale_can_drain_fixed_trait = {
				ACTOR = $ACTOR$
				TARGET = $TARGET$
				TRAIT = pure_blooded
			}
			exhaurire_vitale_can_drain_fixed_trait = {
				ACTOR = $ACTOR$
				TARGET = $TARGET$
				TRAIT = fecund
			}
			exhaurire_vitale_can_drain_fixed_trait = {
				ACTOR = $ACTOR$
				TARGET = $TARGET$
				TRAIT = strong
			}
			exhaurire_vitale_can_drain_fixed_trait = {
				ACTOR = $ACTOR$
				TARGET = $TARGET$
				TRAIT = shrewd
			}
			exhaurire_vitale_can_drain_leveled_trait = {
				ACTOR = $ACTOR$
				TARGET = $TARGET$
				TRAIT = beauty_good
			}
			exhaurire_vitale_can_drain_leveled_trait = {
				ACTOR = $ACTOR$
				TARGET = $TARGET$
				TRAIT = intellect_good
			}
			exhaurire_vitale_can_drain_leveled_trait = {
				ACTOR = $ACTOR$
				TARGET = $TARGET$
				TRAIT = physique_good
			}
		}
	}
}
