예제 #1
0
    private int GetSkillPointsFromLvlUp()
    {
        int ExstraSkillPoints = 0;

        // Кэш процентного стата
        float _chanceToGetAnExtraSkillPoint = chanceToGetAnExtraSkillPoint.GetValue();

        if (_chanceToGetAnExtraSkillPoint > 0f && Random.Range(0f, 1f) < _chanceToGetAnExtraSkillPoint)
        {
            Debug.Log("Везунчик! +1 Extra Skill Point!");
            ExstraSkillPoints++;
        }

        int totalAvailableSkillPoints = skillPointsPerLevel + ExstraSkillPoints;

        return(totalAvailableSkillPoints);
    }
예제 #2
0
    public override float TakeDamage(CharacterStats killerStats, DamageType damageType, float damage, ref bool isEvaded, ref bool isBlocked, bool canEvade = true, bool isCritical = false, bool displayPopup = false)
    {
        for (int i = 0; i < defenseModifiers.Count; i++)
        {
            defenseModifiers[i].ApplyDefenseModifier(killerStats, damageType, damage, ref isEvaded, ref isBlocked);
        }

        //Если вероятность уворотов больше нуля И если рандом говорит о том, что нужно увернуться
        if (canEvade && (isEvaded || (evasionChance.GetValue() > 0f && Random.Range(0f, 1f) <= evasionChance.GetValue())))
        {
            isEvaded = true;
            Debug.Log(transform.name + " dodge the damage!"); //Задоджили урон!

            if (displayPopup)
            {
                VFXManager.Instance.DisplayPopupText(gameObject.transform.position, "Dodge");
            }
        }
        else //Получаем урон
        {
            if (!isBlocked)
            {
                damage = base.TakeDamage(killerStats, damageType, damage, ref isEvaded, ref isBlocked, canEvade, isCritical, displayPopup);
            }
            else
            {
                damage = 0f;
                Debug.Log(transform.name + " blocked the " + damageType);

                if (displayPopup)
                {
                    VFXManager.Instance.DisplayPopupText(gameObject.transform.position, "Blocked the " + damageType);
                }
            }
        }

        return(damage);
    }