Пример #1
0
        public Availabilities GetException(IWarrior warrior)
        {
            if (Exceptions != null)
            {
                foreach (Type item in Exceptions)
                {
                    if (item.IsInterface && warrior.GetType().GetInterfaces().Any(x => x.Equals(item)))
                    {
                        return(ExceptionAvailabilityRoll);
                    }
                    else if (item.Name.Equals(warrior.GetType().Name))
                    {
                        return(ExceptionAvailabilityRoll);
                    }
                }
            }

            return(AvailabilityRoll);
        }
Пример #2
0
        /// <summary>
        /// Verifies if this and another warrior
        /// TODO obsolete, so remove
        /// </summary>
        /// <param name="warrior">The warrior.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">warrior is null</exception>
        public bool AreEqual(IWarrior warrior)
        {
            if (warrior == null)
            {
                throw new ArgumentNullException("warrior is null");
            }

            bool areEqual =
                warrior.GetType().Name.Equals(this.GetType().Name) &&
                warrior.CurrentExperience == this.CurrentExperience &&
                this.CreationDate != null &&
                this.GetHashCode() == warrior.GetHashCode();

            return(areEqual);
        }