예제 #1
0
        public void TestSimpleOneRoundExpeditionWithOneOfAllUnits()
        {
            var sendUnits = new UnitCollection(
                new UnitAmount(UnitInfo.WorkerUnitType, 1),
                new UnitAmount(UnitInfo.SoldierUnitType, 1),
                new UnitAmount(UnitInfo.ScientistUnitType, 1));
            ExpeditionData data = new ExpeditionData
            {
                Owner               = null, // not important
                StartingRound       = 1,
                EndingRound         = 1,
                AssignedUnits       = sendUnits,
                RemainingUnits      = sendUnits.Clone(),
                CurrentRange        = 0.0m,
                DiscoveredResources = new ResourceCollection()
            };

            ExpeditionLogic expeditionLogic = ObtainExpeditionLogic();

            var statePrinter = StatePrinters.For(data);

            statePrinter.PrintState(data, Console.Out);
            expeditionLogic.ProcessExpedition(data, 1);
            statePrinter.PrintState(data, Console.Out);
        }
예제 #2
0
        public void TestThreeRoundExpeditionWithTenOfAllUnits()
        {
            var sendUnits = new UnitCollection(
                new UnitAmount(UnitInfo.WorkerUnitType, 10),
                new UnitAmount(UnitInfo.SoldierUnitType, 10),
                new UnitAmount(UnitInfo.ScientistUnitType, 10));
            ExpeditionData data = new ExpeditionData
            {
                Owner               = null, // not important
                StartingRound       = 1,
                EndingRound         = 3,
                AssignedUnits       = sendUnits,
                RemainingUnits      = sendUnits.Clone(),
                CurrentRange        = 0.0m,
                DiscoveredResources = new ResourceCollection()
            };

            var             gameState       = new GameState();
            ExpeditionLogic expeditionLogic = ObtainExpeditionLogic(gameState);

            var enemy1 = new Player("Nosgoh", PlayerType.Enemy);

            enemy1.BaseUnits = new UnitCollection(
                new UnitAmount(UnitInfo.SoldierUnitType, 40),
                new UnitAmount(UnitInfo.WargUnitType, 45));
            gameState.AddPlayer(enemy1);


            var statePrinter = StatePrinters.For(data);

            statePrinter.PrintState(data, Console.Out);
            expeditionLogic.ProcessExpedition(data, 1);
            statePrinter.PrintState(data, Console.Out);
            expeditionLogic.ProcessExpedition(data, 2);
            statePrinter.PrintState(data, Console.Out);
            expeditionLogic.ProcessExpedition(data, 3);
            statePrinter.PrintState(data, Console.Out);
        }