public void RemoveAbility(AreaEffect ability) { if (AreaEffects == null || !AreaEffects.Any(a => a == ability)) { return; } var list = AreaEffects.ToList(); list.Remove(ability); RemovePetAdvancement(ability); AreaEffects = list.ToArray(); ColUtility.Free(list); }
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); }
public bool AddAbility(AreaEffect ability, bool advancement = true) { if (AreaEffects == null) { AreaEffects = new AreaEffect[] { ability }; } else if (!AreaEffects.Any(a => a == ability)) { var temp = AreaEffects; AreaEffects = new AreaEffect[temp.Length + 1]; for (int i = 0; i < temp.Length; i++) { AreaEffects[i] = temp[i]; } AreaEffects[temp.Length] = ability; } OnAddAbility(ability, advancement); return(true); }
public bool HasAreaEffect(AreaEffect ability) { return(AreaEffects != null && AreaEffects.Any(a => a == ability)); }