public List <Effect> GetAllEffects(EffectInheritance inherit, EffectLocation targetLocation) { var list = new List <Effect>(); bool isSelf = (inherit & EffectInheritance.Self) == EffectInheritance.Self; bool isInvisible = (inherit & EffectInheritance.Invisible) == EffectInheritance.Invisible; foreach (var effect in TechBase.Effects) { if (!CheckLocation(OwnerLocation, effect.Location, targetLocation)) { continue; } if (isSelf) { if (!effect.IsPrivate) { list.Add(effect); } } if (!isInvisible) { continue; } if (effect.IsPrivate) { list.Add(effect); } } return(list); }
public int Max(EffectCode effectCode, EffectInheritance inherit, byte paramOrder) { int max = Int32.MinValue; foreach (var e in GetEffects(effectCode, inherit)) { if ((int)e.Value[paramOrder] > max) { max = (int)e.Value[paramOrder]; } } return(max); }
public int Min(EffectCode effectCode, EffectInheritance inherit, byte paramOrder) { int min = Int32.MaxValue; foreach (var e in GetEffects(effectCode, inherit)) { if ((int)e.Value[paramOrder] < min) { min = (int)e.Value[paramOrder]; } } return(min); }
public List <Effect> GetEffects(EffectCode effectCode, EffectInheritance inherit = EffectInheritance.All) { var list = new List <Effect>(); foreach (var tech in technologies) { list.AddRange(tech.GetEffects(effectCode, inherit, OwnerLocation)); } if ((inherit & EffectInheritance.Upward) == EffectInheritance.Upward) { if (Parent != null) { list.AddRange(Parent.GetEffects(effectCode, EffectInheritance.Upward | EffectInheritance.Self)); } } return(list); }
public IEnumerable <Effect> GetAllEffects(EffectInheritance inherit = EffectInheritance.All) { foreach (var effect in technologies.SelectMany(tech => tech.GetAllEffects(inherit, OwnerLocation))) { yield return(effect); } if ((inherit & EffectInheritance.Upward) == EffectInheritance.Upward) { if (Parent != null) { foreach (var effect in Parent.GetAllEffects(EffectInheritance.Upward | EffectInheritance.Self)) { yield return(effect); } } } }