14 private readonly Identifier statIdentifier;
16 private readonly
float value;
17 private readonly
float maxValue;
18 private readonly
bool targetAllies;
19 private readonly
bool removeOnDeath;
20 private readonly
bool giveOnAddingFirstTime;
21 private readonly
bool setValue;
28 private readonly
bool targetAbilityTarget =
false;
36 if (statIdentifier.IsEmpty)
38 DebugConsole.ThrowError($
"Error in talent \"{CharacterTalent.DebugIdentifier}\" - stat identifier not defined.",
50 targetAbilityTarget = abilityElement.
GetAttributeBool(nameof(targetAbilityTarget),
false);
55 if (giveOnAddingFirstTime && addingFirstTime)
57 ApplyEffectSpecific(abilityObject:
null);
63 ApplyEffectSpecific(abilityObject);
68 ApplyEffectSpecific(abilityObject:
null);
87 if (targetCharacter ==
null)
89 DebugConsole.ThrowError($
"Error in {nameof(CharacterAbilityGivePermanentStat.ApplyEffectSpecific)}: character was null.\n{Environment.StackTrace.CleanupStackTrace()}");
92 if (targetCharacter?.Info ==
null)
94 DebugConsole.AddWarning($
"Error in {nameof(CharacterAbilityGivePermanentStat.ApplyEffectSpecific)}: character {targetCharacter} has no CharacterInfo. Are you trying to use the condition on a non-player character?\n{Environment.StackTrace.CleanupStackTrace()}");
97 targetCharacter.
Info.
ChangeSavedStatValue(statType, value, identifier, removeOnDeath, maxValue: maxValue, setValue: setValue);
108 return original.Replace(
"[placeholder]", location.NameIdentifier.Value);
110 return original.Replace(
"[placeholder]", map.CurrentLocationIndex.ToString());
override void ApplyEffect()
static Identifier HandlePlaceholders(PermanentStatPlaceholder placeholder, Identifier original)
override void InitializeAbility(bool addingFirstTime)
override bool AppliesEffectOnIntervalUpdate
override bool AllowClientSimulation
CharacterAbilityGivePermanentStat(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement)
override void ApplyEffect(AbilityObject abilityObject)
readonly AbilityEffectType AbilityEffectType
static StatTypes ParseStatType(string statTypeString, string debugIdentifier)
static IEnumerable< Character > GetFriendlyCrew(Character character)
void ChangeSavedStatValue(StatTypes statType, float value, Identifier statIdentifier, bool removeOnDeath, float maxValue=float.MaxValue, bool setValue=false)
string? GetAttributeString(string key, string? def)
float GetAttributeFloat(string key, float def)
ContentPackage? ContentPackage
bool GetAttributeBool(string key, bool def)
Identifier GetAttributeIdentifier(string key, string def)
static GameSession?? GameSession
StatTypes
StatTypes are used to alter several traits of a character. They are mostly used by talents.