public EffectArgument(EffectArgument other) { if (other == null) { return; } Type = other.Type; StatType = other.StatType; StatIdx = other.StatIdx; IntVal = other.IntVal; DoubleVal = other.DoubleVal; MinVal = other.MinVal; MaxVal = other.MaxVal; }
public EffectArgument(float minVal, float maxVal) { Type = EffectArgumentType.Random; MinVal = minVal; MaxVal = maxVal; }
public EffectArgument(int val) { Type = EffectArgumentType.Int; IntVal = val; }
public EffectArgument(double val) { Type = EffectArgumentType.Double; DoubleVal = val; }
public EffectArgument(StatType statType, int propIdx) { Type = EffectArgumentType.Quality; StatType = statType; StatIdx = propIdx; }
public bool ResolveValue(WorldObject item) { // type:enum - invalid, double, int32, quality (2 int32s: type and quality), float range (min, max), variable index (int32) switch (Type) { case EffectArgumentType.Double: case EffectArgumentType.Int: // these are ok as-is IsValid = true; break; case EffectArgumentType.Quality: switch (StatType) { case StatType.Int: Type = EffectArgumentType.Int; var intVal = item.GetProperty((PropertyInt)StatIdx); if (intVal != null) { IntVal = intVal.Value; IsValid = true; } break; case StatType.Bool: Type = EffectArgumentType.Int; IntVal = Convert.ToInt32(item.GetProperty((PropertyBool)StatIdx) ?? false); IsValid = true; break; case StatType.Float: Type = EffectArgumentType.Double; var doubleVal = item.GetProperty((PropertyFloat)StatIdx); if (doubleVal != null) { DoubleVal = doubleVal.Value; IsValid = true; } break; case StatType.DID: Type = EffectArgumentType.Int; IntVal = (int)(item.GetProperty((PropertyDataId)StatIdx) ?? 0); IsValid = true; break; } break; case EffectArgumentType.Random: DoubleVal = ThreadSafeRandom.Next(MinVal, MaxVal); Type = EffectArgumentType.Double; IsValid = true; break; case EffectArgumentType.Variable: /*if (IntVal < 0 || IntVal >= GTVariables.Count) * break; * * this = GTVariables[IntVal]; * IsValid = true;*/ Console.WriteLine($"TODO: EffectArgumentType.Variable"); break; } return(IsValid); }
public EffectArgument(double val) { Type = EffectArgumentType.Double; DoubleVal = val; IsValid = true; }
public EffectArgument(int val) { Type = EffectArgumentType.Int; IntVal = val; IsValid = true; }
public EffectArgument(long val) { Type = EffectArgumentType.Int64; LongVal = val; IsValid = true; }