Esempio n. 1
0
        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;
        }
Esempio n. 2
0
 public EffectArgument(float minVal, float maxVal)
 {
     Type   = EffectArgumentType.Random;
     MinVal = minVal;
     MaxVal = maxVal;
 }
Esempio n. 3
0
 public EffectArgument(int val)
 {
     Type   = EffectArgumentType.Int;
     IntVal = val;
 }
Esempio n. 4
0
 public EffectArgument(double val)
 {
     Type      = EffectArgumentType.Double;
     DoubleVal = val;
 }
Esempio n. 5
0
 public EffectArgument(StatType statType, int propIdx)
 {
     Type     = EffectArgumentType.Quality;
     StatType = statType;
     StatIdx  = propIdx;
 }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
 public EffectArgument(double val)
 {
     Type      = EffectArgumentType.Double;
     DoubleVal = val;
     IsValid   = true;
 }
Esempio n. 8
0
 public EffectArgument(int val)
 {
     Type    = EffectArgumentType.Int;
     IntVal  = val;
     IsValid = true;
 }
Esempio n. 9
0
 public EffectArgument(long val)
 {
     Type    = EffectArgumentType.Int64;
     LongVal = val;
     IsValid = true;
 }