Exemplo n.º 1
0
        public void WarpControls()
        {
            if (this.Damaged())
            {
                this.SetMaxWarpFactor();
            }

            int distance;
            int direction;

            if (this.Movement.InvalidCourseCheck(out direction))
            {
                return;
            }


            if (this.Warp.InvalidWarpFactorCheck(this.MaxWarpFactor, out distance))
            {
                return;
            }

            int lastRegionY;
            int lastRegionX;

            if (!Warp.Engage(direction, distance, out lastRegionY, out lastRegionX, this.Game.Map))
            {
                return;
            }

            this.RepairOrTakeDamage(lastRegionX, lastRegionY);

            var crs = CombinedRangeScan.For(this.ShipConnectedTo);

            if (crs.Damaged())
            {
                ShortRangeScan.For(this.ShipConnectedTo).Controls();
            }
            else
            {
                crs.Controls();
            }

            //todo: upon arriving in Region, all damaged controls need to be enumerated
            //this.Game.Write.OutputConditionAndWarnings(this.ShipConnectedTo, this.Game.Config.GetSetting<int>("ShieldsDownLevel"));
        }