public static ValueBuilder Minimum(this IValueBuilders valueFactory, ValueBuilder left, IValueBuilder right) => valueFactory.If(left > right).Then(right).Else(left);
public static ValueBuilder Maximum(this IValueBuilders valueFactory, ValueBuilder left, double right) => valueFactory.If(left < right).Then(right).Else(left);
public static ValueBuilder Floor(this ValueBuilder value) => value.Select(Math.Floor, o => "Floor(" + o + ")");
public static ValueBuilder Ceiling(this ValueBuilder value) => value.Select(Math.Ceiling, o => "Ceiling(" + o + ")");
/// <summary> /// Returns a value converter multiplying values by <c>(stat.Value / divideBy).Ceiling</c>. /// </summary> public static Func <ValueBuilder, ValueBuilder> PerStatCeiled(IStatBuilder stat, ValueBuilder divideBy) => v => v * (stat.Value / divideBy).Ceiling();
/// <summary> /// Returns <c>value.AsPercentage * stat.Value</c>. /// </summary> public static ValueBuilder PercentOf(this ValueBuilder value, IStatBuilder stat) => value.AsPercentage * stat.Value;
public static Func <ValueBuilder, ValueBuilder> PerStat(ValueBuilder statValue, ValueBuilder divideBy) => v => v * (statValue / divideBy).Floor();
/// <summary> /// Returns a value converter multiplying values by <c>(stat.Value / divideBy).Floor</c>. /// </summary> public static Func <ValueBuilder, ValueBuilder> PerStat(IStatBuilder stat, ValueBuilder divideBy) => PerStat(stat.Value, divideBy);
public static ValueBuilder PerStat(this ValueBuilder value, ValueBuilder multiplierValue, ValueBuilder divideBy) => value * (multiplierValue / divideBy).Floor();
public static ValueBuilder PerStat(this ValueBuilder value, IStatBuilder multiplier, ValueBuilder divideBy) => value.PerStat(multiplier.Value, divideBy);
public static Func <ValueBuilder, ValueBuilder> PerStat(ValueBuilder statValue, ValueBuilder divideBy) => v => PerStat(v, statValue, divideBy);