4 protected ref ScriptInvoker m_OnDamageStateChanged;
9 EHitZoneGroup GetHitZoneGroup()
11 return EHitZoneGroup.VIRTUAL;
20 if (!m_OnHealthChanged && createNew)
23 return m_OnHealthChanged;
29 ScriptInvoker GetOnDamageStateChanged(
bool createNew =
true)
31 if (!m_OnDamageStateChanged && createNew)
32 m_OnDamageStateChanged =
new ScriptInvoker();
34 return m_OnDamageStateChanged;
43 return container.GetOwner();
49 override protected void OnHealthSet()
51 if (m_OnHealthChanged)
52 m_OnHealthChanged.Invoke();
57 override protected void OnDamageStateChanged()
59 if (m_OnDamageStateChanged)
60 m_OnDamageStateChanged.Invoke(
this);
64 override float ComputeEffectiveDamage(notnull
BaseDamageContext damageContext,
bool isDOT)
66 if (damageContext.damageValue == 0)
70 return damageContext.damageValue;
73 float effectiveDamage = damageContext.damageValue * GetBaseDamageMultiplier();
78 if (isDOT || effectiveDamage < 0)
79 return effectiveDamage;
89 return effectiveDamage;
98 void CustomRegeneration(IEntity target,
float itemRegenerationDuration,
float itemRegenerationSpeed = 0,
float itemAbsoluteRegenerationAmount = 0)
100 if (itemRegenerationSpeed)
102 GetGame().GetCallqueue().CallLater(RemoveCustomRegeneration, itemRegenerationDuration * 1000,
false, target, itemRegenerationSpeed);
104 else if (itemAbsoluteRegenerationAmount)
106 itemRegenerationSpeed = itemAbsoluteRegenerationAmount / itemRegenerationDuration;
107 GetGame().GetCallqueue().CallLater(RemoveCustomRegeneration, itemRegenerationDuration * 1000,
false, target, itemRegenerationSpeed);
111 Print(
"Consumable with regenerating abilities was used but no duration or amount was defined", LogLevel.WARNING);
115 float currentRegen = GetDamageOverTime(
EDamageType.HEALING);
116 SetDamageOverTime(
EDamageType.HEALING, currentRegen + itemRegenerationSpeed * -1);
123 void RemoveCustomRegeneration(IEntity target,
float itemRegenerationSpeed)
126 if (GetDamageOverTime(
EDamageType.HEALING) + itemRegenerationSpeed > 0)