Exemple #1
0
        //todo: this function needs to be part of SRS
        private void SRSScanHostile(IRegion Region)
        {
            this.Write.Console.WriteLine(this.Config.GetText("HostileDetected"),
                                         (Region.GetHostiles().Count == 1 ? "" : "s"));

            bool inNebula = Region.Type == RegionType.Nebulae;

            foreach (var hostile in Region.GetHostiles())
            {
                var hostileName = hostile.Name;

                if (inNebula)
                {
                    hostileName = "Unknown";
                }

                if (hostile.Faction == FactionName.Federation)
                {
                    hostileName = hostile.Name + " " + Game.GetFederationShipRegistration(hostile);
                }

                this.Write.Console.WriteLine(this.Config.GetText("IDHostile"), hostileName);
            }

            this.Write.Console.WriteLine("");
        }
Exemple #2
0
        private void RenderScannedRegion(IRegion Region, Location myLocation, int RegionUB, int RegionLB)
        {
            int starbaseCount = -1;
            int starCount     = -1;
            int hostileCount  = -1;

            if (Region.Type != RegionType.Nebulae)
            {
                starbaseCount = Region.GetStarbaseCount();
                starCount     = Region.GetStarCount();
                hostileCount  = Region.GetHostiles().Count();
            }

            bool renderingMyLocation = false;

            if (myLocation.Region.Scanned)
            {
                renderingMyLocation = myLocation.Region.X == RegionUB && myLocation.Region.Y == RegionLB;
            }

            if (Region.Type != RegionType.Nebulae)
            {
                this.Game.Write.RenderRegionCounts(renderingMyLocation, starbaseCount, starCount, hostileCount);
            }
            else
            {
                this.Game.Write.RenderNebula(renderingMyLocation);
            }
        }
Exemple #3
0
        public bool AutoRaiseShieldsIfNeeded(IRegion Region)
        {
            bool shieldsAutoRaised = false;

            if (Region.GetHostiles().Count > 0)
            {
                shieldsAutoRaised = Game.Auto_Raise_Shields(this.ShipConnectedTo.Map, Region);
            }

            return(shieldsAutoRaised);
        }
Exemple #4
0
        public void OutputScanWarnings(IRegion Region, IMap map, bool shieldsAutoRaised)
        {
            if (Region.GetHostiles().Count > 0)
            {
                this.SRSScanHostile(Region);
            }

            this.Write.OutputConditionAndWarnings(map.Playership, this.Config.GetSetting <int>("ShieldsDownLevel"));

            if (shieldsAutoRaised)
            {
                map.Write.Line("Shields automatically raised to " + Shields.For(map.Playership).Energy);
            }
        }
Exemple #5
0
        private bool AddHostileFedToEmptyRegion(IRegion Region, Stack <string> federaleNames)
        {
            var hostilesInRegion = Region.GetHostiles();

            if (hostilesInRegion.Any()) //we don't want to mix with Klingons just yet..
            {
                var klingons = hostilesInRegion.Where(h => h.Faction == FactionName.Klingon);

                if (!klingons.Any())
                {
                    this.AddHostilesToRegion(Region, federaleNames);

                    //we are only doing this once..
                    return(true);
                }
            }
            return(false);
        }