public static float CalculateModifiedBaseAttribute(float BaseValue, EModifierOperationType ModifierOperation, float EvaluatedMagnitude)
        {
            switch (ModifierOperation)
            {
            case EModifierOperationType.Add:
                BaseValue += EvaluatedMagnitude;
                break;

            case EModifierOperationType.Divide:
                if (Math.Abs(EvaluatedMagnitude) > 0.01)
                {
                    BaseValue /= EvaluatedMagnitude;
                }
                break;

            case EModifierOperationType.Multiply:
                BaseValue *= EvaluatedMagnitude;
                break;

            case EModifierOperationType.Override:
                BaseValue = EvaluatedMagnitude;
                break;
            }

            return(BaseValue);
        }
Пример #2
0
 public void AddAggregatorMod(float EvaluatedMagnitude, EModifierOperationType ModifierOperation)
 {
     // If aggregator exists, check if we have a definition for this modifier operation
     if (!Mods.TryGetValue(ModifierOperation, out var aggregateMods))
     {
         aggregateMods = new List <AggregatorModifier>();
         Mods.Add(ModifierOperation, aggregateMods);
     }
     aggregateMods.Add(new AggregatorModifier(EvaluatedMagnitude));
 }