29 DebugConsole.ThrowError($
"Error in {nameof(AfflictionAction)}: affliction not defined (use the attribute \"{nameof(Affliction)}\").",
34 private bool isFinished =
false;
46 public override void Update(
float deltaTime)
48 if (isFinished) {
return; }
52 foreach (var target
in targets)
54 if (target !=
null && target is
Character character)
59 strength *= character.MaxVitality;
63 var limb = character.AnimController.GetLimb(
LimbType);
66 character.CharacterHealth.ApplyAffliction(limb, afflictionPrefab.Instantiate(strength), ignoreUnkillability:
true);
68 else if (strength < 0.0f)
70 character.CharacterHealth.ReduceAfflictionOnLimb(limb,
Affliction, -strength);
77 character.CharacterHealth.ApplyAffliction(
null, afflictionPrefab.Instantiate(strength), ignoreUnkillability:
true);
79 else if (strength < 0.0f)
81 character.CharacterHealth.ReduceAfflictionOnAllLimbs(
Affliction, -strength);
92 return $
"{ToolBox.GetDebugSymbol(isFinished)} {nameof(AfflictionAction)} -> (TargetTag: {TargetTag.ColorizeObject()}, " +
93 $
"Affliction: {Affliction.ColorizeObject()}, Strength: {Strength.ColorizeObject()}, " +
94 $
"LimbType: {LimbType.ColorizeObject()})";
Gives an affliction to a specific character.
override void Update(float deltaTime)
override bool IsFinished(ref string goTo)
Has the action finished.
AfflictionAction(ScriptedEvent parentEvent, ContentXElement element)
bool MultiplyByMaxVitality
override string ToDebugString()
Rich test to display in debugdraw
AfflictionPrefab is a prefab that defines a type of affliction that can be applied to a character....
static readonly PrefabCollection< AfflictionPrefab > Prefabs
ContentPackage? ContentPackage
readonly ScriptedEvent ParentEvent
IEnumerable< Entity > GetTargets(Identifier tag)