Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
                    }
                }
            }
        }