Beispiel #1
0
        public void TestRepairFullRoom()
        {
            var ship = new TestShip(Alignment.Player);

            Assert.IsTrue(ship.Crew.All(c => c.Action == CrewAction.Idle));
            CrewActionsHandler.TickCrew(ship);

            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(100, ship.Rooms[0].CurrentDurability);
            Assert.AreEqual(100, ship.SpecialRooms[0].CurrentDurability);
        }
        public void TestStartWorkingAndNotWorking()
        {
            var ship = new TestShip(Alignment.Player);

            Assert.IsTrue(ship.Crew.All(c => c.Action == CrewAction.Idle));
            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(CrewAction.Working, ship.Crew[0].Action);
            Assert.AreEqual(CrewAction.Working, ship.Crew[1].Action);
            Assert.AreEqual(CrewAction.Idle, ship.Crew[2].Action);
            Assert.AreEqual(CrewAction.Idle, ship.Crew[3].Action);
            Assert.AreEqual(CrewAction.Working, ship.Crew[4].Action);
        }
        public void TestRoomStatesAfterMovingFromNotWorkingRoom()
        {
            var ship = new TestShip(Alignment.Player);

            Assert.IsTrue(ship.Crew.All(c => c.Action == CrewAction.Idle));
            CrewActionsHandler.TickCrew(ship);

            Assert.AreEqual(0, ship.SpecialRooms[1].Stat.EmptyWorkingSpaces);

            PlayerCommands.MoveCrewMember(ship.Crew[2], ship.Cells[11], ship);
            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(0, ship.SpecialRooms[1].Stat.EmptyWorkingSpaces);
        }
Beispiel #4
0
        public void TestHealingOutOfLivingRoom()
        {
            var ship = new TestShip(Alignment.Player);

            Assert.IsTrue(ship.Crew.All(c => c.Action == CrewAction.Idle));
            CrewActionsHandler.TickCrew(ship);

            PlayerCommands.TrySetRoomEnergyConsumption(ship.SpecialRooms[2], 2, ship);
            SpecialRoomBonusCalculator.Recalculate(ship);
            foreach (var crew in ship.Crew)
            {
                crew.CurrentHP = 10;
            }
            CrewActionsHandler.TickCrew(ship);
            Assert.IsTrue(ship.Crew.All(c => c.CurrentHP == 10));
        }
Beispiel #5
0
        public void TestOverHealCrewMember()
        {
            var ship = new TestShip(Alignment.Player);

            Assert.IsTrue(ship.Crew.All(c => c.Action == CrewAction.Idle));
            CrewActionsHandler.TickCrew(ship);

            PlayerCommands.MoveCrewMember(ship.Crew[1], ship.Cells[5], ship);
            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(ship.Cells[5], ship.Crew[1].Cell);

            PlayerCommands.TrySetRoomEnergyConsumption(ship.SpecialRooms[2], 2, ship);
            SpecialRoomBonusCalculator.Recalculate(ship);
            ship.Crew[1].CurrentHP = 99;
            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(100, ship.Crew[1].CurrentHP);
        }
        public void TestCrewActionsAfterMovingToNotFullWorkingRoom()
        {
            var ship = new TestShip(Alignment.Player);

            Assert.IsTrue(ship.Crew.All(c => c.Action == CrewAction.Idle));
            CrewActionsHandler.TickCrew(ship);

            PlayerCommands.MoveCrewMember(ship.Crew[2], ship.Cells[11], ship);
            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(CrewAction.Moving, ship.Crew[2].Action);

            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(CrewAction.Idle, ship.Crew[2].Action);

            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(CrewAction.Working, ship.Crew[2].Action);
        }
        public void TestCrewStatesAfterMoving()
        {
            var ship = new TestShip(Alignment.Player);

            Assert.IsTrue(ship.Crew.All(c => c.Action == CrewAction.Idle));
            CrewActionsHandler.TickCrew(ship);

            PlayerCommands.MoveCrewMember(ship.Crew[2], ship.Cells[2], ship);
            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(ship.Cells[2], ship.Crew[2].Cell);
            Assert.AreEqual(CrewAction.Moving, ship.Crew[2].Action);
            Assert.AreEqual(ship.Cells[2], ship.Crew[2].Destination);

            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(ship.Cells[2], ship.Crew[2].Cell);
            Assert.AreEqual(null, ship.Crew[2].Destination);
        }
        public void TestWayToDistination()
        {
            var ship = new TestShip(Alignment.Player);

            CrewActionsHandler.TickCrew(ship);

            PlayerCommands.MoveCrewMember(ship.Crew[4], ship.Cells[2], ship);
            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(ship.Cells[10], ship.Crew[4].Cell);

            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(ship.Cells[11], ship.Crew[4].Cell);

            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(ship.Cells[3], ship.Crew[4].Cell);

            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(ship.Cells[2], ship.Crew[4].Cell);

            CrewActionsHandler.TickCrew(ship);
            Assert.AreEqual(ship.Cells[2], ship.Crew[4].Cell);
        }