Пример #1
0
    //Modifies health over time.
    public void ModifyHealth(float amount, HpModType type, float duration)
    {
        amount = (amount / ((ticksPerSecond * duration) + 1));

        SetHealthBarValues(amount * ((ticksPerSecond * duration) + 1), type);

        StartCoroutine(ModifyHealthOverTime(amount, type, duration));
    }
Пример #2
0
 public void Damage(float amount, HpModType type, float duration, Side attackerSide)
 {
     if (!myAttackerSides.Contains(attackerSide))
     {
         myAttackerSides.Add(attackerSide);              //ATTACKER SIDE LOGIC
     }
     ModifyHealth(amount, type, duration);
 }
Пример #3
0
    IEnumerator ModifyHealthOverTime(float amount, HpModType type, float duration)
    {
        while (duration >= 0)
        {
            if (canTakeDamage || type == HpModType.heal)
            {
                currentHealth += FindRealAmount(amount, type);
            }

            SetHealthBarValues(-amount, type);
            SetHealthBarLines();

            duration -= 1 / ticksPerSecond;

            yield return(new WaitForSeconds(1 / ticksPerSecond));
        }
    }
Пример #4
0
    //Deals damage or heals.
    public void ModifyHealth(float amount, HpModType type)
    {
        amount = FindRealAmount(amount, type);

        if (canTakeDamage || type == HpModType.heal)
        {
            currentHealth += amount;

            if (type == HpModType.heal)
            {
                animatingHeal += amount;
            }
            else
            {
                animatingDamage -= amount;
            }
        }
    }
Пример #5
0
    //========================================================= Health Modification =========================================================

    //Calculates defensive stats.
    float FindRealAmount(float amount, HpModType type)
    {
        switch (type)
        {
        case HpModType.physicalDamage:
            amount *= (100 - DefensiveStats[HpModType.physicalDamage]) / -100;
            break;

        case HpModType.magicalDamage:
            amount *= (100 - DefensiveStats[HpModType.magicalDamage]) / -100;
            break;

        case HpModType.trueDamage:
            amount = -amount;
            break;

        case HpModType.heal:
            amount *= (100 - DefensiveStats[HpModType.heal]) / 100;
            break;
        }
        return(amount);
    }
Пример #6
0
 //Modifiels health proportionally.
 public void ModifyHealth(float amount, HpModType type, RatioType ratioType)
 {
     ModifyHealth(FindRealAmount(amount, ratioType), type);
 }
Пример #7
0
 void SetHealthBarValues(float amount, HpModType type)
 {
     HpModOverTime[type] += amount;
 }
Пример #8
0
    //Removes the defensive stat modifier.
    IEnumerator RemoveDefensiveStatModifier(float amount, HpModType type, float duration)
    {
        yield return(new WaitForSeconds(duration));

        DefensiveStats[type] = (DefensiveStats[type] - 100) / (1 - amount / 100) + 100;
    }
Пример #9
0
    //Adds a defensive stat modifier for a limited time.
    public void AddDefensiveStatModifier(float amount, HpModType type, float duration)
    {
        DefensiveStats[type] = (DefensiveStats[type] - 100) * (1 - amount / 100) + 100;

        StartCoroutine(RemoveDefensiveStatModifier(amount, type, duration));
    }
Пример #10
0
    //========================================================= Defensive Stat Modification =========================================================

    //Adds a defensive stat modifier.
    public void AddDefensiveStatModifier(float amount, HpModType type)
    {
        DefensiveStats[type] = (DefensiveStats[type] - 100) * (1 - amount / 100) + 100;
    }
Пример #11
0
 public HpMod(float value, HpModType type)
 {
     Value = value;
     Type  = type;
 }
Пример #12
0
 public HpMod(double value, HpModType type, bool useHealthBuffer = false)
 {
     Value           = value;
     Type            = type;
     UseHealthBuffer = useHealthBuffer;
 }