Esempio n. 1
0
        void Awake()
        {
            var settings = mod.GetSettings();

            if (IsEnabled(settings, StrengthDamageModifier))
            {
                strengthDamageModifier = GetLinearParameters(settings, StrengthDamageModifier);
                FormulaHelper.RegisterOverride <Func <int, int> >(mod, "DamageModifier", strength => ApplyFlooredLinear(strengthDamageModifier, strength));
            }

            if (IsEnabled(settings, MaxEncumbrance))
            {
                maxEncumbrance = GetLinearParameters(settings, MaxEncumbrance);
                FormulaHelper.RegisterOverride <Func <int, int> >(mod, "MaxEncumbrance", strength => ApplyFlooredLinear(maxEncumbrance, strength));
            }

            if (IsEnabled(settings, HandToHandMinDamage))
            {
                handToHandMinDamage = GetLinearParameters(settings, HandToHandMinDamage);
                FormulaHelper.RegisterOverride <Func <int, int> >(mod, "CalculateHandToHandMinDamage", skill => ApplyTruncatedLinear(handToHandMinDamage, skill));
            }

            if (IsEnabled(settings, HandToHandMaxDamage))
            {
                handToHandMaxDamage = GetLinearParameters(settings, HandToHandMaxDamage);
                FormulaHelper.RegisterOverride <Func <int, int> >(mod, "CalculateHandToHandMaxDamage", skill => ApplyTruncatedLinear(handToHandMaxDamage, skill));
            }
        }
Esempio n. 2
0
 static private int ApplyFlooredLinear(LinearParameters linearParams, int value)
 {
     return((int)Mathf.Floor(linearParams.Scale * value + linearParams.Base));
 }
Esempio n. 3
0
 static private int ApplyTruncatedLinear(LinearParameters linearParams, int value)
 {
     return((int)(linearParams.Scale * value + linearParams.Base));
 }