Exemple #1
0
        public static void ApplyModifierToFloat(DamageTypeValues modifier, HitData.DamageType dmgType, ref float damage)
        {
            var resist = modifier.GetByType(dmgType);

            if (resist != 0)
            {
                damage -= damage * (resist / 100f);
            }
        }
Exemple #2
0
        public float GetSkilledTypedValue(DamageTypeValues source, HitData.DamageType dmgType, float skillMultiplier, float weaponMultiplier, float?capValue = null)
        {
            float skill = GetSkill();
            var   value = source.GetByType(dmgType) / 100f;

            if (value == 0)
            {
                return(0);
            }
            // each skill level increases damage by x
            var skilled = value * skillMultiplier * skill;
            // each skill level increases damage by +x% of weapon damage
            var weapon = casterWeaponDmg * skill * weaponMultiplier / 100f;
            // getting the total base value
            var total = skilled + weapon;

            // checking for cap values
            if (capValue != null && total > capValue)
            {
                total = (float)capValue;
            }
            // returning a rounded value
            return(total);
        }