static AxeItem() { string axeUiLink = new AxeItem().UILink(); caloriesBurn = new ConstantValue(0); damage = new ConstantValue(100); }
/// <summary> /// Converts Eco dynamic value to js /// </summary> private string EvaluateDynamicValue(IDynamicValue value) { if (value is ConstantValue) { return(value.GetBaseValue.ToString(CultureInfo.InvariantCulture)); } if (value is MultiDynamicValue multiValue) { string parameters = string.Join(",", multiValue.Values.Select(EvaluateDynamicValue)); return($"Operation_{multiValue.Op}({parameters})"); } if (value is SkillModifiedValue skillValue) { string values = string.Join(",", skillValue.Values.Select(floatValue => floatValue.ToString(CultureInfo.InvariantCulture))); _usedSkill = skillValue.SkillType.Name; return($"[{values}][skills[\"{skillValue.SkillType.Name}\"]]"); } if (value is TalentModifiedValue talentValue) { return($"talents[\"{talentValue.TalentType.Name}\"] ? {talentValue.Talent.Value.ToString(CultureInfo.InvariantCulture)} : {talentValue.BaseValue.ToString(CultureInfo.InvariantCulture)}"); } if (value is ModuleModifiedValue moduleModifiedValue) { return($"modules[\"{moduleModifiedValue.ValueTypeName}\"] ? {moduleModifiedValue.GetBaseValue.ToString(CultureInfo.InvariantCulture)} : 1"); } throw new Exception($"Can't evaluate value {value}"); }
private static string WriteAffectedBy(IDynamicValue value) { if (value is SkillModifiedValue) { return((value as SkillModifiedValue).Skill.DisplayName); } return(""); }
void TryEmitScalar(IDynamicValue <R> d) { var v = default(R); var success = false; try { v = d.GetValue(out success); } catch (Exception ex) { if (delayErrors) { ExceptionHelper.AddException(ref errors, ex); } else { Interlocked.CompareExchange(ref errors, ex, null); } Drain(); return; } if (success) { if (Interlocked.CompareExchange(ref wip, 1, 0) == 0) { downstream.OnNext(v); if (Interlocked.Decrement(ref wip) == 0) { return; } } else { var q = scalarQueue; if (q == null) { q = new SpscLinkedArrayQueue <R>(capacityHint); Volatile.Write(ref scalarQueue, q); } q.TryOffer(v); if (Interlocked.Increment(ref wip) != 1) { return; } } DrainLoop(); } }
private static float GetIDynamicValue(IDynamicValue value, User user) { if (value is MultiDynamicValue) { return((value as MultiDynamicValue).GetCurrentValue(user)); } if (value is SkillModifiedValue) { return((value as SkillModifiedValue).Values[0]); } if (value is ConstantValue) { return((value as ConstantValue).GetBaseValue); } return(0.0f); }
public InvertedDynamicValue(IDynamicValue x) { dynamicValue = x; }
/// <summary> /// -BUGGY- i have no idea why but that currently causes issues /// <para/>Inverts the given DynamicValue and returns a new InvertDynamicvalue /// </summary> /// <param name="x"></param> /// <returns></returns> public static InvertedDynamicValue InvertDynamicvalue(IDynamicValue x) { return(new InvertedDynamicValue(x)); }
public static object ShouldEqual(this IDynamicValue actual, string expected) { Assert.AreEqual(new DynamicValue(expected), actual); return(expected); }