public override int GetHashCode()
 {
     unchecked
     {
         return(((Prop1 != null ? Prop1.GetHashCode() : 0) * 397) ^ (Prop2 != null ? Prop2.GetHashCode() : 0));
     }
 }
예제 #2
0
        public override int GetHashCode()
        {
            var result = (Prop1 != null ? Prop1.GetHashCode() : 0);

            result = 31 * result + Prop2;
            return(result);
        }
예제 #3
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return(false);
            }
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (obj.GetType() != GetType())
            {
                return(false);
            }

            var value = obj as ImmutableFour;

            if (value == null)
            {
                return(false);
            }

            return
                (Prop0 == value.Prop0 &&
                 Prop1 != null && value.Prop1 != null &&
                 Prop1.Equals(value.Prop1) &&
                 Prop2 != null && value.Prop2 != null &&
                 Prop2.Equals(value.Prop2) &&
                 Prop3 != null && value.Prop3 != null &&
                 Prop3.Equals(value.Prop3));
        }
예제 #4
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return(false);
            }
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (obj.GetType() != GetType())
            {
                return(false);
            }

            var value = obj as Association;

            if (value == null)
            {
                return(false);
            }

            return
                (Prop0 == value.Prop0 &&
                 Prop1 != null && value.Prop1 != null &&
                 Prop1.Equals(value.Prop1) &&
                 Prop2 == value.Prop2);
        }
예제 #5
0
            public string[] Valor()
            {
                int i = 0;

                string[] a = new string[3];
                a[i++] = Prop1.ToString();
                a[i++] = Prop2.ToString();
                a[i++] = Prop3.ToString();
                return(a);
            }
 public override int GetHashCode()
 {
     unchecked     // Overflow is fine, just wrap
     {
         int hash = 17;
         hash = hash * 23 + Prop1.GetHashCode();
         hash = hash * 23 + Prop2;
         return(hash);
     }
 }
예제 #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (Prop1 != null ? Prop1.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Prop2 != null ? Prop2.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (EnumArray != null ? EnumArray.GetHashCode() : 0);
         return(hashCode);
     }
 }
예제 #8
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (Prop1 != null ? Prop1.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Prop2;
         hashCode = (hashCode * 397) ^ Prop3.GetHashCode();
         return(hashCode);
     }
 }
예제 #9
0
        internal bool ValuesEqual()
        {
            if (Prop1 is null)
            {
                return(Prop2 is null);
            }

            if (Prop2 is null)
            {
                return(false);
            }

            return(Prop1.Equals(Prop2));
        }
예제 #10
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return(false);
            }
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (obj.GetType() != GetType())
            {
                return(false);
            }

            var value = obj as AllObjectCollections;

            if (value == null)
            {
                return(false);
            }

            return
                (Prop0 != null && value.Prop0 != null &&
                 Prop0.Equals(value.Prop0) &&
                 Prop1 != null && value.Prop1 != null &&
                 Prop1.Equals(value.Prop1) &&
                 Prop2 != null && value.Prop2 != null &&
                 Prop2.Equals(value.Prop2) &&
                 Prop3 != null && value.Prop3 != null &&
                 Prop3.Equals(value.Prop3) &&
                 Prop4 != null && value.Prop4 != null &&
                 Prop4.Equals(value.Prop4) &&
                 Prop5 != null && value.Prop5 != null &&
                 Prop5.Equals(value.Prop5) &&
                 Prop6 != null && value.Prop6 != null &&
                 Prop6.Equals(value.Prop6) &&
                 Prop7 != null && value.Prop7 != null &&
                 Prop7.Equals(value.Prop7) &&
                 Prop8 != null && value.Prop8 != null &&
                 Prop8.Equals(value.Prop8) &&
                 Prop9 != null && value.Prop9 != null &&
                 Prop9.Equals(value.Prop9) &&
                 Prop10 != null && value.Prop10 != null &&
                 Prop10.Equals(value.Prop10) &&
                 Prop11 != null && value.Prop11 != null &&
                 Prop11.Equals(value.Prop11));
        }
예제 #11
0
        public override int GetHashCode()
        {
            unchecked
            {
                // Choose large primes to avoid hashing collisions
                const int HashingBase       = (int)2166136261;
                const int HashingMultiplier = 16777619;

                int hash = HashingBase;
                hash = (hash * HashingMultiplier) ^ Prop0.GetHashCode();
                hash = (hash * HashingMultiplier) ^
                       (!object.ReferenceEquals(null, Prop1) ? Prop1.GetHashCode() : 0);
                hash = (hash * HashingMultiplier) ^ Prop2.GetHashCode();
                return(hash);
            }
        }
 public override int GetHashCode()
 {
     unchecked
     {
         uint code = 0;
         if (Prop1 != null)
         {
             code ^= (uint)Prop1.GetHashCode();
         }
         code = (code << 16) | (code >> 16);
         if (Prop2 != null)
         {
             code ^= (uint)Prop2.GetHashCode();
         }
         return((int)code);
     }
 }
예제 #13
0
        public static DefensivePropertySet ProcessAllAttackPropertySets(Prop1 defensiveProp1, Prop2 defensiveProp2, Prop3 defensiveProp3)
        {
            var defensivePropertySet = new DefensivePropertySet(defensiveProp1, defensiveProp2, defensiveProp3);

            foreach (var offensiveProp1 in Prop1Values)
            {
                foreach (var offensiveProp2 in Prop2Values)
                {
                    foreach (var offensiveProp3 in Prop3Values)
                    {
                        var offensivePropertySet = ProcessAttackPropertySet(defensiveProp1, defensiveProp2, defensiveProp3, offensiveProp1, offensiveProp2, offensiveProp3);
                        defensivePropertySet.TargetingOffensiveProperties.Add(offensivePropertySet.GetDictionaryKey(), offensivePropertySet);
                    }
                }
            }

            return(defensivePropertySet);
        }
예제 #14
0
        public override int GetHashCode()
        {
            unchecked
            {
                // Choose large primes to avoid hashing collisions
                const int HashingBase       = (int)2166136261;
                const int HashingMultiplier = 16777619;

                int hash = HashingBase;
                hash = (hash * HashingMultiplier) ^ Prop0.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Prop1.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Prop2.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Prop3.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Prop4.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Prop5.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Prop6.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Prop7.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Prop8.GetHashCode();
                hash = (hash * HashingMultiplier) ^ Prop9.GetHashCode();
                return(hash);
            }
        }
예제 #15
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (!(o is Component))
            {
                return(false);
            }

            var that = (Component)o;

            if (Prop2 != that.Prop2)
            {
                return(false);
            }
            if (Prop1 != null ? !Prop1.Equals(that.Prop1) : that.Prop1 != null)
            {
                return(false);
            }

            return(true);
        }
예제 #16
0
 public void OnAfterDeserialize()
 {
     Prop4 = Prop1.CombineLatest(Prop2, (x, y) => (x + y) * 2).ToReadOnlyReactiveProperty();
 }
 public OffensivePropertySetAverage(Prop1 offensiveProp1, Prop2 offensiveProp2, Prop3 offensiveProp3, IEnumerable <OffensivePropertySet> allOffensiveProperties, IEnumerable <(Prop1 prop1, Prop2 prop2, Prop3 prop3)> allTargetPropertyKeys)
예제 #18
0
 public string GetUniqueKey()
 {
     return(Prop1.ToString() + "-" + Prop2.ToString());
 }
예제 #19
0
 public DefensivePropertySet(Prop1 defensiveProp1, Prop2 defensiveProp2, Prop3 defensiveProp3)
     : base(defensiveProp1, defensiveProp2, defensiveProp3)
 {
 }
예제 #20
0
 public PropertySet(Prop1 prop1, Prop2 prop2, Prop3 prop3)
 {
     this.Property1 = prop1;
     this.Property2 = prop2;
     this.Property3 = prop3;
 }
예제 #21
0
        public static OffensivePropertySet ProcessAttackPropertySet(Prop1 defensiveProp1, Prop2 defensiveProp2, Prop3 defensiveProp3, Prop1 offensiveProp1, Prop2 offensiveProp2, Prop3 offensiveProp3)
        {
            double sum1 = 0;
            double sum2 = 0;
            double sum3 = 0;

            var possibleImmunity = false;

            // + means weak

            switch (defensiveProp1)
            {
            case Prop1.Blunt:
                if (offensiveProp1 == Prop1.Blade)
                {
                    sum1++;
                }
                if (offensiveProp1 == Prop1.Gun)
                {
                    sum1--;
                }
                if (offensiveProp2 == Prop2.Fire)
                {
                    sum1--;
                }
                if (offensiveProp3 == Prop3.Magical)
                {
                    sum1++;
                }
                break;

            case Prop1.Blade:
                if (offensiveProp1 == Prop1.Gun)
                {
                    sum1++;
                }
                if (offensiveProp1 == Prop1.Blunt)
                {
                    sum1--;
                }
                if (offensiveProp2 == Prop2.Earth)
                {
                    sum1++;
                }
                if (offensiveProp3 == Prop3.Kinetical)
                {
                    sum1--;
                }
                break;

            case Prop1.Gun:
                if (offensiveProp1 == Prop1.Blunt)
                {
                    sum1++;
                }
                if (offensiveProp1 == Prop1.Blade)
                {
                    sum1--;
                }
                if (offensiveProp2 == Prop2.Water)
                {
                    sum1++;
                }
                if (offensiveProp3 == Prop3.Physical)
                {
                    sum1--;
                }
                if (offensiveProp3 == Prop3.Kinetical)
                {
                    possibleImmunity = true;
                    sum1            -= ImmunityWeight;
                }
                if (offensiveProp2 == Prop2.Fire)
                {
                    sum1 += BaneWeight;
                }
                break;

            default:
                break;
            }

            switch (defensiveProp2)
            {
            case Prop2.Earth:
                if (offensiveProp2 == Prop2.Fire)
                {
                    sum2++;
                }
                if (offensiveProp2 == Prop2.Water)
                {
                    sum2--;
                }
                if (offensiveProp1 == Prop1.Blade)
                {
                    sum2--;
                }
                if (offensiveProp3 == Prop3.Kinetical)
                {
                    sum2++;
                }
                break;

            case Prop2.Fire:
                if (offensiveProp2 == Prop2.Water)
                {
                    sum2++;
                }
                if (offensiveProp2 == Prop2.Earth)
                {
                    sum2--;
                }
                if (offensiveProp1 == Prop1.Blunt)
                {
                    sum2++;
                }
                if (offensiveProp3 == Prop3.Magical)
                {
                    sum2--;
                }
                if (offensiveProp1 == Prop1.Gun)
                {
                    possibleImmunity = true;
                    sum2            -= ImmunityWeight;
                }
                if (offensiveProp3 == Prop3.Kinetical)
                {
                    sum2 += BaneWeight;
                }
                break;

            case Prop2.Water:
                if (offensiveProp2 == Prop2.Earth)
                {
                    sum2++;
                }
                if (offensiveProp2 == Prop2.Fire)
                {
                    sum2--;
                }
                if (offensiveProp3 == Prop3.Physical)
                {
                    sum2++;
                }
                if (offensiveProp1 == Prop1.Gun)
                {
                    sum2--;
                }
                break;

            default:
                break;
            }

            switch (defensiveProp3)
            {
            case Prop3.Physical:
                if (offensiveProp3 == Prop3.Magical)
                {
                    sum3++;
                }
                if (offensiveProp3 == Prop3.Kinetical)
                {
                    sum3--;
                }
                if (offensiveProp2 == Prop2.Water)
                {
                    sum3--;
                }
                if (offensiveProp1 == Prop1.Gun)
                {
                    sum3++;
                }
                break;

            case Prop3.Magical:
                if (offensiveProp3 == Prop3.Kinetical)
                {
                    sum3++;
                }
                if (offensiveProp3 == Prop3.Physical)
                {
                    sum3--;
                }
                if (offensiveProp2 == Prop2.Fire)
                {
                    sum3++;
                }
                if (offensiveProp1 == Prop1.Blunt)
                {
                    sum3--;
                }
                break;

            case Prop3.Kinetical:
                if (offensiveProp3 == Prop3.Physical)
                {
                    sum3++;
                }
                if (offensiveProp3 == Prop3.Magical)
                {
                    sum3--;
                }
                if (offensiveProp1 == Prop1.Blade)
                {
                    sum3++;
                }
                if (offensiveProp2 == Prop2.Earth)
                {
                    sum3--;
                }
                if (offensiveProp2 == Prop2.Fire)
                {
                    possibleImmunity = true;
                    sum3            -= ImmunityWeight;
                }
                if (offensiveProp1 == Prop1.Gun)
                {
                    sum3 += BaneWeight;
                }
                break;

            default:
                break;
            }

            var sum = sum1 + sum2 + sum3;

            var offensivePropertySet = new OffensivePropertySet
            {
                Property1             = offensiveProp1,
                Property2             = offensiveProp2,
                Property3             = offensiveProp3,
                TargetPropertyKey     = (defensiveProp1, defensiveProp2, defensiveProp3),
                TargetResistanceValue = Math.Abs(sum) < 1 ? Math.Round(sum, MidpointRounding.AwayFromZero) : sum,
                TargetIsImmune        = possibleImmunity && sum <= -1
            };

            return(offensivePropertySet);
        }
예제 #22
0
        public static DefensivePropertySetCollection ProcessDefensivePropertySet(Prop1 defensiveProp1, Prop2 defensiveProp2, Prop3 defensiveProp3)
        {
            var defensivePropertySet = ProcessAllAttackPropertySets(defensiveProp1, defensiveProp2, defensiveProp3);

            return(new DefensivePropertySetCollection(defensivePropertySet));
        }