Ejemplo n.º 1
0
        public void Combat_CheckCopies()
        {
            Galaxy              gal       = new Galaxy();
            testships           testships = new testships();
            StarSystem          sys       = new StarSystem(1);
            Sector              location  = new Sector(sys, new System.Drawing.Point());
            List <SpaceVehicle> ships     = testships.ships;

            foreach (SpaceVehicle ship in ships)
            {
                location.Place(ship);
            }

            Battle_Space battle = new Battle_Space(location);


            var id0 = testships.ships[0].ID;
            var id1 = testships.ships[1].ID;

            battle.Resolve();

            Assert.AreNotEqual(battle.StartCombatants[id0], battle.ActualCombatants[id0]);
            Assert.AreNotEqual(battle.StartCombatants[id1], battle.ActualCombatants[id1]);
            //MogreFreeMain replay = new MogreFreeMain(battle); doing this crashes VS on compile.
        }
Ejemplo n.º 2
0
        public void Combat_LearnDesigns()
        {
            // setup
            Galaxy    gal       = new Galaxy();
            testships testships = new testships();

            gal.Empires.Add(testships.empires[0]);
            gal.Empires.Add(testships.empires[1]);
            StarSystem sys = new StarSystem(1);

            gal.StarSystemLocations.Add(new ObjectLocation <StarSystem>(sys, new System.Drawing.Point()));
            Sector location           = new Sector(sys, new System.Drawing.Point());
            List <SpaceVehicle> ships = testships.ships;

            foreach (SpaceVehicle ship in ships)
            {
                location.Place(ship);
            }

            // make sure there are *two* designs
            var originalDesigns = gal.Referrables.OfType <IDesign>().ToArray();

            Assert.AreEqual(2, originalDesigns.Count());

            // process turn
            Galaxy.ProcessTurn(false);

            // was there a battle?
            Assert.AreEqual(1, gal.Battles.Count);

            // make sure there are still two designs
            var finalDesigns = gal.Referrables.OfType <IDesign>().ToArray();

            Assert.AreEqual(2, finalDesigns.Count());

            // make sure they are the *same* designs
            Assert.IsTrue(originalDesigns.SequenceEqual(finalDesigns), "Original designs must match final designs.");

            // did we learn designs?
            Assert.AreEqual(2, gal.Empires[0].KnownDesigns.Count);
            Assert.AreEqual(2, gal.Empires[1].KnownDesigns.Count);
        }