void ApplyDamage(EiDamage damage) { if (HasShieldType(damage.DamageType)) { if (HasShield) { // calculate armor Loss var shieldLoss = shieldData.flatShieldLoss + shieldData.shieldLossByTotalDamagePercentage * damage.Damage; var preCalcDamage = damage.Damage; // Reduce damage damage.ReduceDamage(shieldData.flatReduction, shieldData.damageMultiplier, calculateFlatReductionFirst); //fix after reduction armor loss shieldLoss += (preCalcDamage - damage.Damage) * shieldData.shieldLossByDamagePercentage; //Check if needed further damage adjustments var tempArmor = CurrentShield; if (shieldLoss > tempArmor) { var percentage = 1f - (tempArmor / shieldLoss); currentShield.Value = 0f; //do some magic stuff for doing more accurate damage reduction based on armor damage.SetDamage(UnityEngine.Mathf.Lerp(damage.Damage, preCalcDamage, percentage)); } else { currentShield.Value -= shieldLoss; } } } }
void ApplyHeal(EiDamage damage) { if (damage.DamageType == targetDamageType) { damage.Convert(); onHealChange.Trigger(); } }
void ApplyHeal(EiDamage heal) { if (heal.HasHealing()) { var healToBeAdded = Math.Min(MissingHealth, heal.Heal); currentHealth.Value += healToBeAdded; heal.RemoveHeal(healToBeAdded); } }
void ApplyDamage(EiDamage damage) { if (damage.HasDamage()) { var damageToBeDealt = Math.Min(CurrentHealth, damage.Damage); currentHealth.Value -= damageToBeDealt; damage.RemoveDamage(damageToBeDealt); } }
void ApplyDamage(EiDamage damage) { for (int i = protection.Count - 1; i >= 0; i--) { var protData = protection [i]; if (protData.damageType == damage.DamageType) { damage.ReduceDamage(protData.flatReduction, protData.damageMultiplier, calculateFlatProtectionFirst); } } }
public void Damage(EiDamage damage) { if (damage.Target == null) { damage.Target = damageTarget; } else { if ((damage.Target) != damageTarget) { Debug.LogWarning("The damage target is different to what it hit\n" + Entity.EntityName); } } onHit.Trigger(damage); damage.ReduceDamage(flatDamageReduction.Value, damageMultiplier.Value, calculateFlatReducationFirst); damageTarget.Damage(damage); }
public virtual void Heal(EiDamage heal) { for (int i = subscribedHealingPipeline.Count - 1; i >= 0; i--) { if (heal.Break) { break; } if (heal.HasDamage()) { heal.Iteration++; Damage(heal); return; } subscribedHealingPipeline [i].Target(heal); } heal.Dispose(); }
public virtual void Damage(EiDamage damage) { for (int i = subscribedDamagePipeline.Count - 1; i >= 0; i--) { if (damage.Break) { break; } if (damage.HasHealing()) { damage.Iteration++; Heal(damage); return; } subscribedDamagePipeline [i].Target(damage); } damage.Dispose(); }
void ApplyHeal(EiDamage heal) { if (!canRegenShieldByHealthRegen) { return; } if (!HasShieldType(heal.DamageType)) { return; } var amountToHeal = Math.Min(MissingShield, heal.Heal); if (amountToHeal < 0f) { amountToHeal = 0f; } currentShield.Value += amountToHeal; heal.RemoveHeal(amountToHeal); }