Пример #1
0
        public void Move_SubtractsOneFromRemainingMovesPerTileMoved(IUnit<Archer> unit,
                                                                           ITile destination,
                                                                           int expectedRemainingMoves)
        {
            // :::: ARRANGE ::::
            var costlyUnit = new MoveCosts<Archer>(unit);

            // :::: ACT ::::
            costlyUnit.MoveTo(destination);

            // :::: ASSERT ::::
            costlyUnit.RemainingMoves.Should().Be(expectedRemainingMoves);
        }
Пример #2
0
        public override void checkValidityAndChangeMove(string moveName)
        {
            // If we have a designated cost for our move. Make sure we can perform it.
            //
            int moveCostValue;

            // If its a move that takes sword gauge, do some move specific checking and action
            //
            if (MoveCosts.TryGetValue(moveName, out moveCostValue))
            {
                if (SwordGauge - moveCostValue >= 0)
                {
                    if (moveName.Contains("rekka"))
                    {
                        convertRekka(moveName);
                    }
                    else if (moveName == "backfireball")
                    {
                        if (!ProjectileManager.containsPlayerProjectile(PlayerNumber))
                        {
                            changeMove(moveName);
                        }
                        else
                        {
                            changeMove(determineBackupMove(moveName));
                        }
                    }
                    else
                    {
                        changeMove(moveName);
                    }

                    SwordGauge = SwordGauge - moveCostValue;
                }

                else
                {
                    changeMove(determineBackupMove(moveName));
                    Console.WriteLine("Couldn't perform move cus not enough gauge");
                }
            }
            else if (CurrentSpecial < 50 && moveName == "supera")
            {
                changeMove("rekka");
            }
            else
            {
                changeMove(moveName);
            }
        }
Пример #3
0
        public void MoveTo_IsForwardedAfterSubtractingMoveCostsFromTheRemainingMovesOfTheUnit()
        {
            // :::: ARRANGE ::::
            var spyUnit = A.Fake<IUnit<Archer>>();
            var costlyUnit = new MoveCosts<Archer>(spyUnit);

            using (var scope = Fake.CreateScope())
            {
                // :::: ACT ::::
                costlyUnit.MoveTo(DummyPosition);

                // :::: ASSERT ::::
                using (scope.OrderedAssertions())
                {
                    // The setter of RemainingMoves has been invoked.
                    A.CallTo(spyUnit).Where(x => x.Method.Name == $"set_{nameof(spyUnit.RemainingMoves)}")
                     .MustHaveHappened();

                    A.CallTo(() => spyUnit.MoveTo(DummyPosition)).MustHaveHappened();
                }
            }
        }