public ScreenRating GetFormationAreaScreenRating()
        {
            ScreenRating formationScreen = new ScreenRating();

            foreach (var u in this.Units)
            {
                formationScreen = ScreenRating.Combine(formationScreen, u.GetAreaScreenRating());
            }

            return(formationScreen);
        }
Beispiel #2
0
        public ScreenRating GetAreaScreenRating()
        {
            ScreenRating areaRating = new ScreenRating(0, false);

            foreach (ScreenSystem def in this.Defenses
                     .Where(d =>
                            d is ScreenSystem && d.StatusString == "Operational" && d.SpecialProperties.HasFlag(DefenseSpecialProperties.Area_Defense))
                     .Select(d => (ScreenSystem)d))
            {
                areaRating = ScreenRating.Combine(def.ScreenRating, areaRating);
            }

            return(areaRating);
        }
        public virtual int FinalizeScreenValue(ScreenRating screen, AttackSpecialProperties effectiveAttackProperties = AttackSpecialProperties.None)
        {
            if (effectiveAttackProperties.HasFlag(AttackSpecialProperties.Ignores_Advanced_Screens))
            {
                return(0); // Ignores any screens
            }

            if (!screen.Advanced && effectiveAttackProperties.HasFlag(AttackSpecialProperties.Ignores_Standard_Screens))
            {
                return(0); // Ignores standard screens
            }

            // else
            return(screen.Value);
        }
Beispiel #4
0
        public ScreenRating GetLocalScreenRating()
        {
            ScreenRating rating = new ScreenRating(0, false);

            foreach (ScreenSystem def in this.Defenses
                     .Where(d =>
                            d is ScreenSystem && d.StatusString == "Operational" && !d.SpecialProperties.HasFlag(DefenseSpecialProperties.Area_Defense))
                     .Select(d => (ScreenSystem)d))
            {
                rating = ScreenRating.Combine(def.ScreenRating, rating);
            }

            // Combine type and count flags to get total rating
            return(rating);
        }
Beispiel #5
0
 public static ScreenRating Combine(ScreenRating screenA, ScreenRating screenB)
 {
     return(new ScreenRating(Math.Min(MAXSCREENRATING, screenA.Value + screenB.Value), screenA.Advanced || screenB.Advanced));
 }