Esempio n. 1
0
    public void ApplyDamage(AttributesSheet casterAttributes, DamageLine line, bool isCritical, Weapon weapon = null)
    {
        float value = line.FinalValue;

        if (isCritical)
        {
            value *= 1.5f + casterAttributes.GetCriticalDamageModifier();
        }

        Debug.Log(UnitName + ": damaged " + value + " (" + line.DamageType + ")(" + line.ElementType + ")(" + isCritical + ")");
        int oldValue = AttributesSheet.CurrentHealth;

        AttributesSheet.CurrentHealth -= (int)value;
        Debug.Log(UnitName + ": " + oldValue + " => " + AttributesSheet.CurrentHealth);

        Animator.Play(AnimationPrefix + "Take Damage");
        CombatUIManager.UpdateHealthBar();
        UpdateHealthSlider();

        UpdateIsAlive();
    }
Esempio n. 2
0
    public void ApplyRecovery(AttributesSheet casterAttributes, RecoveryLine line, bool isCritical)
    {
        float value = line.finalValue;

        if (isCritical)
        {
            value *= 1.5f + casterAttributes.GetCriticalDamageModifier();
        }

        Debug.Log(UnitName + ": recovered " + value + " (" + line.recoveryType + ")(" + isCritical + ")");
        if (line.recoveryType == RecoveryType.Health)
        {
            AttributesSheet.CurrentHealth += (int)value;
        }
        else if (line.recoveryType == RecoveryType.Mana)
        {
            AttributesSheet.CurrentMana += (int)value;
        }

        CombatUIManager.UpdateHealthBar();
        UpdateHealthSlider();
        CombatUIManager.UpdateManaBar();
    }