コード例 #1
0
ファイル: Navigation.cs プロジェクト: evankiljoy/star-trek-kg
        private void SuccessfulDockWithStarbase()
        {
            this.Game.Write.ResourceLine("DockingMessageLowerShields");
            Shields.For(this.ShipConnectedTo).Energy = 0;

            Shields.For(this.ShipConnectedTo).Damage = 0;

            this.ShipConnectedTo.RepairEverything();

            this.Game.Write.ResourceLine(this.Game.Config.GetSetting <string>("PlayerShip"), "SuccessfullDock");
        }
コード例 #2
0
ファイル: Phasers.cs プロジェクト: evankiljoy/star-trek-kg
        private static void DestroyBadGuy(ICollection <IShip> destroyedShips, IShip badGuyShip)
        {
            badGuyShip.Destroyed           = true;
            badGuyShip.Energy              = 0;
            Shields.For(badGuyShip).Energy = 0;

            //Other subsystems may retain some energy, for salvage mechanic.

            //Phasers hit all ships on a single turn, so this builds up a list of destroyed ships
            destroyedShips.Add(badGuyShip);
        }
コード例 #3
0
ファイル: Phasers.cs プロジェクト: evankiljoy/star-trek-kg
        //todo: move to badguy.DamageControl() object
        private void BadGuyTakesDamage(ICollection <IShip> destroyedShips, IShip badGuyShip, double deliveredEnergy)
        {
            //todo: add more descriptive output messages depending on how much phaser energy absorbed by baddie

            var badGuyShields = Shields.For(badGuyShip);

            badGuyShields.Energy -= (int)deliveredEnergy;

            if ((badGuyShields.Energy < 0) || badGuyShip.Energy < 0)
            {
                Phasers.DestroyBadGuy(destroyedShips, badGuyShip);
            }
            else
            {
                this.DamageBadGuy(badGuyShip, badGuyShields);
            }
        }
コード例 #4
0
ファイル: Debug.cs プロジェクト: evankiljoy/star-trek-kg
        public override void Controls(string command)
        {
            switch (command.ToLower())
            {
            case "dsrec":
                //this.PrintGalacticRecord(this.Map.Regions);
                this.Game.Write.Line("full galactic record with ship position as colored text, baddies as red");
                this.Game.Write.Line("Not Implemented Yet");
                break;

            case "dsnav":
                //Navigation.For(this.ShipConnectedTo).Controls(this.Map);
                //ShortRangeScan.For(this.ShipConnectedTo).Controls(this.Map);
                this.Game.Write.Line("Nav Command prompt, then outputs visual of NAV Track in an SRS window");
                this.Game.Write.Line("Not Implemented Yet");
                break;

            case "dstor":
                //Torpedoes.For(this.ShipConnectedTo).Controls(this.Map);
                //ShortRangeScan.For(this.ShipConnectedTo).Controls(this.Map);
                this.Game.Write.Line("Torpedo Command prompt, then outputs visual of Torpedo Track in an SRS window");
                this.Game.Write.Line("Not Implemented Yet");
                break;

            case "dqnav":
                //Navigation.For(this.ShipConnectedTo).Controls(this.Map);
                //this.PrintGalacticRecord(WithNavTrack);
                this.Game.Write.Line("Nav Command prompt, then outputs visual of NAV Track in a Galactic Map window");
                this.Game.Write.Line("Not Implemented Yet");
                break;

            case "dibd":

                //todo: newly appeared ship needs to NOT fire inbetween turns!

                var testShipNames = this.Game.Config.FactionShips(FactionName.TestFaction).ToList().Shuffle();

                var RegionX = Coordinate.GetRandom();
                var RegionY = Coordinate.GetRandom();

                var randomSector = new Sector(new LocationDef(RegionX, RegionY));

                this.Game.Map.Config = this.Game.Config;

                var hostileShip = new Ship(FactionName.Klingon, testShipNames[0], randomSector, this.Game.Map, this.Game);
                Shields.For(hostileShip).Energy = Utility.Utility.Random.Next(100, 200);     //todo: resource those numbers out

                this.Game.Map.Regions.GetActive().AddShip(hostileShip, hostileShip.Sector);

                //todo: if there not enough names set up for opposing ships things could break, or ships will have duplicate names
                this.Game.Write.Line("Hostile Ship: \"" + hostileShip.Name + "\" just warped into sector [" + randomSector.X + "," + randomSector.Y + "]");
                this.Game.Write.Line("Scanners indicate " + hostileShip.Name + "'s Energy: " + hostileShip.Energy + " Shields: " + Shields.For(hostileShip).Energy + " ");
                break;

            case "disb":

                //var RegionX = Coordinate.GetRandom();
                //var RegionY = Coordinate.GetRandom();

                //var randomSector = new Sector(new LocationDef(RegionX, RegionY));

                //this.Game.Map.Config = this.Game.Config;

                //var starbase = new Starbase("starbaseAlpha", this.Game.Map, new Sector(new LocationDef(new Coordinate(0, 0), new Coordinate(2, 7))));

                var activeRegion = this.Game.Map.Regions.GetActive();

                //activeRegion[randomSector].Item = SectorItem.Starbase;
                //activeRegion.AddShip(starbase, starbase.Sector);

                //var hostileShip = new Ship(testShipNames[0], randomSector, this.Game.Map);

                //this.Game.Map.Regions.GetActive().AddShip(hostileShip, hostileShip.Sector);

                ////todo: if there not enough names set up for opposing ships things could break, or ships will have duplicate names
                //this.Game.Write.Line("Hostile Ship: \"" + hostileShip.Name + "\" just warped into sector [" + randomSector.X + "," + randomSector.Y + "]");
                //this.Game.Write.Line("Scanners indicate " + hostileShip.Name + "'s Energy: " + hostileShip.Energy + " Shields: " + Shields.For(hostileShip).Energy + " ");
                break;

            case "dist":
                var sectorWithNewStar = this.Game.Map.Regions.GetActive().AddStar(this.Game.Map.Regions.GetActive());
                this.Game.Write.Line("A star has just formed spontaneously at: " + "[" + sectorWithNewStar.X + "," + sectorWithNewStar.Y + "]");
                this.Game.Write.Line("Stellar Cartography has named it: " + ((Star)sectorWithNewStar.Object).Name);
                break;

            case "dbgm":
                Constants.DEBUG_MODE = !Constants.DEBUG_MODE;
                this.Game.Write.Line("Debug Mode set to: " + Constants.DEBUG_MODE + ".  This will clear on app restart.");
                break;

            case "dlrs":
                LongRangeScan.For(this.ShipConnectedTo).Debug_Scan_All_Regions(Constants.DEBUG_MODE);
                this.Game.Write.Line("All Regions set to: " + Constants.DEBUG_MODE + ".  (set debugmode to true to make this scan all.)");
                break;

            default:
                this.Game.Write.Line(">> exiting Debug Mode..");
                break;
            }
        }
コード例 #5
0
        //output this as KeyValueCollection that the UI can display as it likes.

        public void PrintCurrentStatus(IMap map, int computerDamage, Ship ship, Region currentRegion)
        {
            if (this.Damaged())
            {
                return;
            }

            //todo: completely redo this

            this.Game.Write.Console.WriteLine("");
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSTimeRemaining"), map.timeRemaining);
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSHostilesRemaining"), map.Regions.GetHostileCount());
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSHostilesInRegion"), currentRegion.GetHostiles().Count);
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSStarbases"), map.starbases);
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSWarpEngineDamage"), Navigation.For(ship).Damage);
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSSRSDamage"), ShortRangeScan.For(ship).Damage);
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSLRSDamage"), LongRangeScan.For(ship).Damage);
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSCRSDamage"), CombinedRangeScan.For(ship).Damage);
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSShieldsDamage"), Shields.For(ship).Damage);
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSComputerDamage"), computerDamage);
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSPhotonDamage"), Torpedoes.For(ship).Damage);
            this.Game.Write.Console.WriteLine(this.Game.Config.GetText("CSPhaserDamage"), Phasers.For(ship).Damage);
            this.Game.Write.Console.WriteLine();

            //foreach (var badGuy in currentRegion.Hostiles)
            //{
            //
            //}

            this.Game.Write.Console.WriteLine();

            //todo: Display all baddie names in Region when encountered.
        }