Exemplo n.º 1
0
    public void TakeDamage(float dmg, Weapon.weaponEffect eff, float pot = 0)
    {
        if (cools <= 0)
        {
            hp   -= dmg;
            cools = iframes;

            switch (eff)
            {
            case (Weapon.weaponEffect.none):
                hp -= CalculateDamage(dmg, defMod);
                if (hp <= 0)
                {
                    Die();
                }
                break;

            case (Weapon.weaponEffect.poison):
                hp -= CalculateDamage(dmg, defMod);
                if (hp <= 0)
                {
                    Die();
                }
                curPoison += pot;
                if (curPoison >= poisonResistance && poisonCools <= 0)
                {
                    poisonDmgCools = timeBetweenPoisonDamage;
                    poisonCools    = poisonTime;
                }
                break;

            case (Weapon.weaponEffect.burn):
                //Debug.Log("Taking fire damage");
                hp -= CalculateDamage(dmg, defMod);
                if (hp <= 0)
                {
                    Die();
                }
                curBurn += pot;
                //Debug.Log(curBurn);
                if (curBurn >= burnResistance && burnCools <= 0)
                {
                    burnDmgCools = timeBetweenBurnDamage;
                    burnCools    = burnTime;
                }
                break;

            case (Weapon.weaponEffect.slow):
                hp -= CalculateDamage(dmg, defMod);
                if (hp <= 0)
                {
                    Die();
                }
                curSlow += pot;
                if (curSlow >= slowResistance && slowCools <= 0)
                {
                    slowCools = slowTime;
                }
                break;

            case (Weapon.weaponEffect.paralyze):
                hp -= CalculateDamage(dmg, defMod);
                if (hp <= 0)
                {
                    Die();
                }
                curParalyze += pot;
                if (curParalyze >= paralyzeResistance && paralyzeCools <= 0)
                {
                    paralyzeCools = paralyzeTime;
                }
                break;
            }
        }
    }
Exemplo n.º 2
0
    public void TakeDamage(Weapon.weaponEffect effect, float potency, float dmg, float mod)
    {
        if (cools <= 0)
        {
            switch (effect)
            {
            case (Weapon.weaponEffect.none):
                hp -= CalculateDamage(dmg, mod);
                if (hp <= 0)
                {
                    Die();
                }
                break;

            case (Weapon.weaponEffect.poison):
                hp -= CalculateDamage(dmg, mod);
                if (hp <= 0)
                {
                    Die();
                }
                curPoison += potency;
                if (curPoison >= poisonResistance && poisonCools <= 0)
                {
                    poisonDmgCools = timeBetweenPoisonDamage;
                    poisonCools    = poisonTime;
                }
                break;

            case (Weapon.weaponEffect.burn):
                hp -= CalculateDamage(dmg, mod);
                if (hp <= 0)
                {
                    Die();
                }
                curBurn += potency;
                //Debug.Log(curBurn);
                if (curBurn >= burnResistance && burnCools <= 0)
                {
                    burnDmgCools = timeBetweenBurnDamage;
                    burnCools    = burnTime;
                }
                break;

            case (Weapon.weaponEffect.slow):
                hp -= CalculateDamage(dmg, mod);
                if (hp <= 0)
                {
                    Die();
                }
                curSlow += potency;
                if (curSlow >= slowResistance && slowCools <= 0)
                {
                    slowCools = slowTime;
                }
                break;

            case (Weapon.weaponEffect.paralyze):
                hp -= CalculateDamage(dmg, mod);
                if (hp <= 0)
                {
                    Die();
                }
                curParalyze += potency;
                if (curParalyze >= paralyzeResistance && paralyzeCools <= 0)
                {
                    paralyzeCools = paralyzeTime;
                }
                break;
            }
            cools = iframes;
        }
    }