示例#1
0
        public void Fire(int energyToFire) //, IShip shipFiringPhasers
        {
            if (!this.EnergyCheckFail(energyToFire, this.ShipConnectedTo))
            {
                //todo: move to Game() object
                this.Game.ALLHostilesAttack(this.Game.Map); //todo: this can't stay here becouse if an enemy ship has phasers, this will have an indefinite loop.  to fix, we should probably pass back phaserenergy success, and do the output. later.

                this.ShipConnectedTo.Energy = this.ShipConnectedTo.Energy -= energyToFire;
                Phasers.For(this.ShipConnectedTo).Execute(energyToFire);
            }
            else
            {
                //Energy Check has failed
                this.Game.Write.Line("Not enough Energy to fire Phasers");
            }
        }
示例#2
0
        private void TargetObjectInRegion()
        {
            string replyFromUser;

            this.Game.Write.PromptUser("Target with (T)orpedoes or (P)hasers? ", out replyFromUser);

            switch (replyFromUser.ToUpper())
            {
            case "T":
                Torpedoes.For(this.ShipConnectedTo).TargetObject();
                break;

            case "P":
                Phasers.For(this.ShipConnectedTo).TargetObject();
                break;
            }
        }
示例#3
0
        //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
        //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.
        }