Exemple #1
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 #2
0
        private void HostileStarbasesAttack(IMap map, IRegion activeRegion)
        {
            if (this.PlayerNowEnemyToFederation)
            {
                if (activeRegion.Type != RegionType.Nebulae) //starbases don't belong in Nebulae.  If some dummy put one here intentionally, then it will do no damage.  Why? because if you have no shields, a hostile starbase will disable you with the first shot and kill you with the second.
                {
                    var starbasesAttacking = activeRegion.GetStarbaseCount();

                    for (int i = 0; i < starbasesAttacking; i++)
                    {
                        int hostileStarbaseAttacksRandom = Utility.Utility.TestableRandom(this);  //this.RandomFactorForTesting == 0 ? Utility.Utility.Random.Next() : this.RandomFactorForTesting;

                        //todo: modify starbase to be its own ship object on the map
                        //HACK: this is a little bit of a cheat, saying that the playership is attacking itself, but until the starbase is its own object, this should be fine
                        this.HostileAttacks(map, map.Playership, hostileStarbaseAttacksRandom);

                        int hostileStarbaseAttacksRandom2 = Utility.Utility.TestableRandom(this); //this.RandomFactorForTesting == 0 ? Utility.Utility.Random.Next() : this.RandomFactorForTesting;

                        //cause starbases are bastards like that.  hey.. You started it!
                        this.HostileAttacks(map, map.Playership, hostileStarbaseAttacksRandom2);

                        //todo: when starbases are their own object, they will fire once.. it will just hurt more.
                    }
                }
                else
                {
                    this.Write.Line("Hostile Starbase fires blindly, unable to get a lock on your position in Nebula.");
                }
            }
        }