Ejemplo n.º 1
0
        //public List<string> AbilityPackagesTrained { get; set; }

        public override int GetHashCode()
        {
            int hash = Name.GetHashCode();

            if (Title != null)
            {
                hash ^= Title.GetHashCode();
            }
            hash ^= ClassSpec.Id.GetHashCode();
            hash ^= MinLevel.GetHashCode();
            hash ^= MaxLevel.GetHashCode();
            hash ^= Faction.GetHashCode();
            hash ^= Toughness.GetHashCode();
            hash ^= DifficultyFlags.GetHashCode();
            if (Codex != null)
            {
                hash ^= Codex.Id.GetHashCode();
            }
            hash ^= ProfessionTrained.GetHashCode();
            if (ConversationFqn != null)
            {
                hash ^= ConversationFqn.GetHashCode();
            }
            return(hash);
        }
Ejemplo n.º 2
0
        public int CalculateHash(HashCalculator calc)
        {
            if (Ai.IsSearchInProgress && IsVisibleToSearchingPlayer == false)
            {
                return(Zone.GetHashCode());
            }

            if (_hash.Value.HasValue == false)
            {
                // this value can be same for different cards with same NAME,
                // sometimes this is good sometimes not, currently we favor
                // smaller tree sizes and less accurate results.
                // if tree size is no longer a problem we will replace NAME with
                // a guid.
                _hash.Value = HashCalculator.Combine(
                    Name.GetHashCode(),
                    _hasSummoningSickness.Value.GetHashCode(),
                    UsageScore.GetHashCode(),
                    IsTapped.GetHashCode(),
                    Damage,
                    HasRegenerationShield.GetHashCode(),
                    HasLeathalDamage.GetHashCode(),
                    Power.GetHashCode(),
                    Toughness.GetHashCode(),
                    Level.GetHashCode(),
                    Counters.GetHashCode(),
                    Type.GetHashCode(),
                    Zone.GetHashCode(),
                    _isRevealed.Value.GetHashCode(),
                    _isPeeked.Value.GetHashCode(),
                    _isHidden.Value.GetHashCode(),
                    calc.Calculate(_simpleAbilities),
                    calc.Calculate(_triggeredAbilities),
                    calc.Calculate(_activatedAbilities),
                    calc.Calculate(_protections),
                    calc.Calculate(_attachments),
                    calc.Calculate(_colors)
                    );
            }

            return(_hash.Value.GetValueOrDefault());
        }