Esempio n. 1
0
        public static List <GenericShip> GetShipsInBullseyeArc(GenericShip ship, Team.Type team = Team.Type.Any)
        {
            List <GenericShip> shipsInBullseyeArc = new List <GenericShip>();

            foreach (var kv in Roster.AllShips)
            {
                GenericShip otherShip = kv.Value;

                if (team == Team.Type.Friendly && ship.Owner.Id != otherShip.Owner.Id)
                {
                    continue;
                }

                if (team == Team.Type.Enemy && ship.Owner.Id == otherShip.Owner.Id)
                {
                    continue;
                }

                ShotInfo shotInfo = new ShotInfo(ship, otherShip, ship.PrimaryWeapon);
                if (!shotInfo.InArcByType(ArcTypes.Bullseye))
                {
                    continue;
                }

                shipsInBullseyeArc.Add(otherShip);
            }

            return(shipsInBullseyeArc);
        }
Esempio n. 2
0
        public static bool IsShipInFacing(GenericShip from, GenericShip to, ArcFacing facing)
        {
            List <GenericArc> savedArcs = from.ArcInfo.Arcs;

            if (facing == ArcFacing.Front180)
            {
                from.ArcInfo.Arcs = new List <GenericArc>()
                {
                    new ArcSpecial180(from.ShipBase)
                }
            }
            ;
            else
            {
                from.ArcInfo.Arcs = new List <GenericArc>()
                {
                    new ArcSpecial180Rear(from.ShipBase)
                }
            };

            ShotInfo reverseShotInfo = new ShotInfo(from, to, from.PrimaryWeapon);

            from.ArcInfo.Arcs = savedArcs;
            return(reverseShotInfo.InArc);
        }
Esempio n. 3
0
 public static bool IsShipInArcByType(GenericShip source, GenericShip target, ArcType arc)
 {
     if (arc != ArcType.Bullseye)
     {
         ShotInfo shotInfo = new ShotInfo(source, target, source.PrimaryWeapons);
         return(shotInfo.InArcByType(arc));
     }
     else
     {
         return(source.SectorsInfo.IsShipInSector(target, ArcType.Bullseye));
     }
 }
Esempio n. 4
0
        public static bool IsShipInFacingOnly(GenericShip from, GenericShip to, ArcFacing facing)
        {
            List <GenericArc> savedArcs = from.ArcsInfo.Arcs;

            from.ArcsInfo.Arcs = new List <GenericArc>()
            {
                new ArcFullFront(from.ShipBase)
            };
            ShotInfo reverseShotInfo = new ShotInfo(from, to, from.PrimaryWeapons);
            bool     inForward180Arc = reverseShotInfo.InArc;

            from.ArcsInfo.Arcs = new List <GenericArc>()
            {
                new ArcFullRear(from.ShipBase)
            };
            reverseShotInfo = new ShotInfo(from, to, from.PrimaryWeapons);
            bool inRear180Arc = reverseShotInfo.InArc;

            from.ArcsInfo.Arcs = savedArcs;

            return((facing == ArcFacing.FullFront) ? inForward180Arc && !inRear180Arc : !inForward180Arc && inRear180Arc);
        }
Esempio n. 5
0
        public static bool IsShipInArc(GenericShip source, GenericShip target)
        {
            ShotInfo shotInfo = new ShotInfo(source, target, source.PrimaryWeapons);

            return(shotInfo.InArc);
        }
Esempio n. 6
0
        public static bool IsShipInArcByType(GenericShip source, GenericShip target, ArcTypes arc)
        {
            ShotInfo shotInfo = new ShotInfo(source, target, source.PrimaryWeapon);

            return(shotInfo.InArcByType(arc));
        }