public override TaggedString GetModifierChangeString(ValueModifierSet valueModifier)
        {
            if (cachedInversedValueModifier == null)
            {
                var newValueModifier = valueModifier.MemberwiseClone();
                if (newValueModifier.setValue != null && newValueModifier.setValue != 0)
                {
                    newValueModifier.setValue = 60f / ((int)newValueModifier.setValue).TicksToSeconds();
                }
                if (newValueModifier.addValue != 0)
                {
                    newValueModifier.addValue = 60f / ((int)newValueModifier.addValue).TicksToSeconds();
                }
                if (newValueModifier.multiplier != 0)
                {
                    newValueModifier.multiplier = 1 / newValueModifier.multiplier;
                }
                cachedInversedValueModifier = newValueModifier;
            }

            return(cachedInversedValueModifier.ModifierChangeString(toStringStyle));
        }
Beispiel #2
0
 public virtual TaggedString GetModifierChangeString(ValueModifierSet valueModifier)
 {
     return(valueModifier.ModifierChangeString(toStringStyle));
 }
        public override IEnumerable <string> ConfigErrors(LootAffixDef parentDef)
        {
            foreach (string configError in base.ConfigErrors(parentDef))
            {
                yield return(configError);
            }

            // affectedStat sanity checks
            if (affectedStat == null)
            {
                yield return("The affectedStat is not set!");

                yield break;
            }
            if (affectedStat.forInformationOnly)
            {
                yield return("The affectedStat is for information purposes only");
            }
            if (affectedStat.alwaysHide)
            {
                yield return("The affectedStat is always hidden");
            }

            // ValueModifierSet sanity checks
            if (valueModifier == null)
            {
                yield return("The valueModifer is not set!");

                yield break;
            }

            foreach (string configError in valueModifier.ConfigErrors(parentDef, this))
            {
                yield return(configError);
            }

            ValueModifierSet vm  = valueModifier;
            StatDef          ast = affectedStat;

            if (vm.preMinValue != -9999999f)
            {
                if (vm.preMinValue > ast.maxValue)
                {
                    yield return(string.Format("The preMinValue is higher than the affectedStat's maxValue: {0} > {1}", vm.preMinValue, ast.maxValue));
                }
                if (vm.preMinValue < ast.minValue)
                {
                    yield return(string.Format("The preMinValue is lower than the affectedStat's minValue: {0} < {1}", vm.preMinValue, ast.minValue));
                }
                if (vm.preMinValue == ast.minValue)
                {
                    yield return(string.Format("The preMinValue is equal than the affectedStat's minValue: {0}", vm.preMinValue));
                }
            }
            if (vm.minValue != -9999999f)
            {
                if (vm.minValue > ast.maxValue)
                {
                    yield return(string.Format("The minValue is higher than the affectedStat's maxValue: {0} > {1}", vm.minValue, ast.maxValue));
                }
                if (vm.minValue < ast.minValue)
                {
                    yield return(string.Format("The minValue is lower than the affectedStat's minValue: {0} < {1}", vm.minValue, ast.minValue));
                }
                if (vm.minValue == ast.minValue)
                {
                    yield return(string.Format("The minValue is equal than the affectedStat's minValue: {0}", vm.minValue));
                }
            }
            if (vm.maxValue != 9999999f)
            {
                if (vm.maxValue > ast.maxValue)
                {
                    yield return(string.Format("The maxValue is higher than the affectedStat's maxValue: {0} > {1}", vm.maxValue, ast.maxValue));
                }
                if (vm.maxValue < ast.minValue)
                {
                    yield return(string.Format("The maxValue is lower than the affectedStat's minValue: {0} < {1}", vm.maxValue, ast.minValue));
                }
                if (vm.maxValue == ast.maxValue)
                {
                    yield return(string.Format("The maxValue is equal than the affectedStat's maxValue: {0}", vm.maxValue));
                }
            }
        }