Beispiel #1
0
        public void RemoveAbility(SpecialAbility ability)
        {
            if (SpecialAbilities == null || !SpecialAbilities.Any(a => a == ability))
            {
                return;
            }

            var list = SpecialAbilities.ToList();

            list.Remove(ability);
            RemovePetAdvancement(ability);

            SpecialAbilities = list.ToArray();

            ColUtility.Free(list);
        }
Beispiel #2
0
        public bool CanChooseMagicalAbility(MagicalAbility ability)
        {
            if (!Creature.Controlled)
            {
                return(true);
            }

            if (HasSpecialMagicalAbility() &&
                IsSpecialMagicalAbility(ability) &&
                SpecialAbilities != null &&
                SpecialAbilities.Length > 0 &&
                SpecialAbilities.Any(a => !a.NaturalAbility))
            {
                return(false);
            }

            return(true);
        }
Beispiel #3
0
        public bool HasAbility(object o)
        {
            if (o is MagicalAbility)
            {
                return((MagicalAbility & (MagicalAbility)o) != 0);
            }

            if (o is SpecialAbility && SpecialAbilities != null)
            {
                return(SpecialAbilities.Any(a => a == (SpecialAbility)o));
            }

            if (o is AreaEffect && AreaEffects != null)
            {
                return(AreaEffects.Any(a => a == (AreaEffect)o));
            }

            if (o is WeaponAbility && WeaponAbilities != null)
            {
                return(WeaponAbilities.Any(a => a == (WeaponAbility)o));
            }

            return(false);
        }
Beispiel #4
0
        public bool AddAbility(SpecialAbility ability, bool advancement = true)
        {
            if (SpecialAbilities == null)
            {
                SpecialAbilities = new SpecialAbility[] { ability };
            }
            else if (!SpecialAbilities.Any(a => a == ability))
            {
                var temp = SpecialAbilities;

                SpecialAbilities = new SpecialAbility[temp.Length + 1];

                for (int i = 0; i < temp.Length; i++)
                {
                    SpecialAbilities[i] = temp[i];
                }

                SpecialAbilities[temp.Length] = ability;
            }

            OnAddAbility(ability, advancement);

            return(true);
        }
Beispiel #5
0
 public bool HasSpecialAbility(SpecialAbility ability)
 {
     return(SpecialAbilities != null && SpecialAbilities.Any(a => a == ability));
 }