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)); } }
static private int ApplyFlooredLinear(LinearParameters linearParams, int value) { return((int)Mathf.Floor(linearParams.Scale * value + linearParams.Base)); }
static private int ApplyTruncatedLinear(LinearParameters linearParams, int value) { return((int)(linearParams.Scale * value + linearParams.Base)); }