5 internal sealed
class CharacterAbilityReplaceAffliction : CharacterAbility
7 private readonly Identifier afflictionId;
8 private readonly Identifier newAfflictionId;
9 private readonly
float strengthMultiplier;
11 public CharacterAbilityReplaceAffliction(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement)
13 afflictionId = abilityElement.GetAttributeIdentifier(
"afflictionid", abilityElement.GetAttributeIdentifier(
"affliction", Identifier.Empty));
14 newAfflictionId = abilityElement.GetAttributeIdentifier(
"newafflictionid", abilityElement.GetAttributeIdentifier(
"newaffliction", Identifier.Empty));
16 strengthMultiplier = abilityElement.GetAttributeFloat(
"strengthmultiplier", 1.0f);
18 if (afflictionId.IsEmpty)
20 DebugConsole.ThrowError($
"Error in {nameof(CharacterAbilityReplaceAffliction)} - affliction identifier not set.");
27 if (affliction !=
null)
29 float afflictionStrength = affliction.
Strength;
32 if (!newAfflictionId.IsEmpty && AfflictionPrefab.Prefabs.TryGet(newAfflictionId, out var newAfflictionPrefab))
39 protected override void VerifyState(
bool conditionsMatched,
float timeSinceLastUpdate)
41 if (conditionsMatched)
virtual void ApplyEffect(AbilityObject abilityObject)
void ApplyAffliction(Limb targetLimb, Affliction affliction, bool allowStacking=true, bool ignoreUnkillability=false, bool recalculateVitality=true)
Limb GetAfflictionLimb(Affliction affliction)
void ReduceAfflictionOnAllLimbs(Identifier afflictionIdOrType, float amount, ActionType? treatmentAction=null, Character attacker=null)
Affliction GetAffliction(string identifier, bool allowLimbAfflictions=true)
CharacterHealth CharacterHealth