public StatMod(Tag modTag, Stat.Type identifier, StatType type, float value) { ModTag = modTag; Identifier = identifier; Type = type; StackIdentifier = Identifier.ToString(); Value = new ModProperty(value, Type == StatType.Additive ? ModProperty.StackBehaviour.Add : ModProperty.StackBehaviour.Multiply); OnStackRecalculated += StatMod_OnStackRecalculated; }
public void StackWith(Mod other) { if (StackIdentifier != other.StackIdentifier) { throw new InvalidOperationException("Tried stacking two mods with different stacking identifiers. " + ToString() + " and " + other.ToString()); } for (int i = 0; i < Properties.Length; i++) { ModProperty here = Properties[i]; ModProperty others = other.Properties[i]; here.Stack(others); } foreach (var source in other._sources) { AddSource(source); } }
public void Min(ModProperty other) { _currentValue = Mathf.Min(_currentValue, other._currentValue); }
public void Multiply(ModProperty other) { _currentValue *= other._currentValue; }
public void AddMinusOne(ModProperty other) { _currentValue += other._currentValue - 1; }
public void Add(ModProperty other) { _currentValue += other._currentValue; }
public void Stack(ModProperty other) { BehaviourMethods[Behaviour](other); }