Esempio n. 1
0
        getValueFunction(ComparedValue comparedValue)
        {
            switch (comparedValue)
            {
            case ComparedValue.CasterHealth:
                return((c1, c2, f) => c1.Health);

            case ComparedValue.CasterPercentHealth:
                return((c1, c2, f) => c1.Health / c1.Stats.maxHP);

            case ComparedValue.CasterSecondary:
                return((c1, c2, f) => c1.Secondary);

            case ComparedValue.CasterPercentSecondary:
                return((c1, c2, f) => c1.Secondary / c1.Stats.maxSecondary);

            case ComparedValue.TargetHealth:
                return((c1, c2, f) => c2.Health);

            case ComparedValue.TargetPercentHealth:
                return((c1, c2, f) => c2.Health / c1.Stats.maxHP);

            case ComparedValue.TargetSecondary:
                return((c1, c2, f) => c2.Secondary);

            case ComparedValue.TargetPercentSecondary:
                return((c1, c2, f) => c2.Secondary / c2.Stats.maxSecondary);

            default:
            case ComparedValue.Value:
                return((c1, c2, f) => f);
            }
        }
Esempio n. 2
0
        public void constructFunction(ComparedValue comparedValue,
                                      ValueComparison comparison, float value)
        {
            var comparisonFunction = getComparison(comparison, value);
            var valueFunction      = getValueFunction(comparedValue);

            func = (c1, c2, f) => comparisonFunction(valueFunction(c1, c2, f));
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = TargetPropertyName?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (ComparedValue?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)ValueComparingOperator;
         return(hashCode);
     }
 }
Esempio n. 4
0
 public ValueCondition(ComparedValue comparedValue,
                       ValueComparison comparison, float value)
 {
     constructFunction(comparedValue, comparison, value);
 }
Esempio n. 5
0
     getValueFunction(ComparedValue comparedValue)
 {
     switch(comparedValue)
     {
         case ComparedValue.CasterHealth:
             return (c1, c2, f) => c1.Health;
         case ComparedValue.CasterPercentHealth:
             return (c1, c2, f) => c1.Health / c1.Stats.maxHP;
         case ComparedValue.CasterSecondary:
             return (c1, c2, f) => c1.Secondary;
         case ComparedValue.CasterPercentSecondary:
             return (c1, c2, f) => c1.Secondary / c1.Stats.maxSecondary;
         case ComparedValue.TargetHealth:
             return (c1, c2, f) => c2.Health;
         case ComparedValue.TargetPercentHealth:
             return (c1, c2, f) => c2.Health / c1.Stats.maxHP;
         case ComparedValue.TargetSecondary:
             return (c1, c2, f) => c2.Secondary;
         case ComparedValue.TargetPercentSecondary:
             return (c1, c2, f) => c2.Secondary / c2.Stats.maxSecondary;
         default:
         case ComparedValue.Value:
             return (c1, c2, f) => f;
     }
 }
Esempio n. 6
0
 public void constructFunction(ComparedValue comparedValue,
                               ValueComparison comparison, float value)
 {
     var comparisonFunction = getComparison(comparison, value);
     var valueFunction = getValueFunction(comparedValue);
     func = (c1, c2, f) => comparisonFunction(valueFunction(c1, c2, f));
 }
Esempio n. 7
0
 public ValueCondition(ComparedValue comparedValue,
                       ValueComparison comparison, float value)
 {
     constructFunction(comparedValue, comparison, value);
 }
Esempio n. 8
0
 public override int GetHashCode()
 {
     unchecked {
         return(((TargetPropertyName != null ? TargetPropertyName.GetHashCode() : 0) * 397) ^ (int)ValueComparingOperator ^ ComparedValue.GetHashCode());
     }
 }