예제 #1
0
        public void GetInput_ReturnsCorrectMenuSelection_SubMenuRequiresBattleMoveInput()
        {
            //arrange
            MockMenu mockTargetMenu = new MockMenu(requiresBattleMoveInput: true, input: _input, output: _output);

            mockTargetMenu.SetEchoMode();
            KeysOffOwnerNumberInputMenu menu = new KeysOffOwnerNumberInputMenu("foo", _input, _output, mockTargetMenu);

            int expectedReturnedNumber = 1;

            _owner.SetHealth(expectedReturnedNumber + 1);
            menu.Build(_owner, _ownerTeam, _enemyTeam, null);

            _input.Push(expectedReturnedNumber.ToString());

            BattleMove eatPotatoMove = new DoNothingMove("eats a potato");

            //act
            NumberInputMenuSelection returnedSelection = menu.GetInput(eatPotatoMove, null) as NumberInputMenuSelection;

            //assert
            Assert.NotNull(returnedSelection);
            Assert.AreEqual(expectedReturnedNumber, returnedSelection.Number);
            Assert.AreEqual(eatPotatoMove, returnedSelection.Move);
        }
예제 #2
0
        public void SetUp()
        {
            _input         = new MockInput();
            _output        = new MockOutput();
            _menuManager   = new TestMenuManager(_input, _output);
            _chanceService = new MockChanceService();
            _battleManager = new BattleManager(_chanceService, _input, _output);

            _human     = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1);
            _humanTeam = new TestTeam(_menuManager, _human);

            _enemy     = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1);
            _enemyTeam = new Team(_menuManager, _enemy);

            _doNothingMove = (DoNothingMove)MoveFactory.Get(BattleMoveType.DoNothing);
        }
예제 #3
0
        public void Setup()
        {
            _logger        = new EventLogger();
            _input         = new MockInput();
            _output        = new MockOutput();
            _menuManager   = new TestMenuManager(_input, _output);
            _chanceService = new MockChanceService();
            _battleManager = new TestBattleManager(_chanceService, _input, _output);

            _humanFighter = new TestHumanFighter("foo", 1);
            _humanTeam    = new TestTeam(_humanFighter);

            _enemy     = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1);
            _enemyTeam = new Team(_menuManager, _enemy);

            _doNothing = new DoNothingMove();
        }
예제 #4
0
        public void CorrectlyHandles_MultiTurnMoves()
        {
            DoNothingMove firstMove  = new DoNothingMove("foo");
            DoNothingMove secondMove = new DoNothingMove("bar");
            DoNothingMove thirdMove  = new DoNothingMove("baz");

            TestMultiTurnMove multiTurnMove = new TestMultiTurnMove("foo", TargetType.Self, firstMove, secondMove, thirdMove);

            TestEnemyFighter enemy = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1);

            enemy.SetMove(new DoNothingMove("fwop"));
            _enemyTeam = new Team(TestMenuManager.GetTestMenuManager(), enemy);

            TestHumanFighter human = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1);

            human.AddSpecialMove(multiTurnMove);

            _playerTeam = new Team(_manager, human);

            _manager.InitializeForBattle(_playerTeam, _enemyTeam);

            _input.Push(new List <string> {
                "fight", "special move", "foo", "1"
            });

            List <HumanFighter> inputList = new List <HumanFighter> {
                human
            };
            List <BattleMoveWithTarget> returnedList = _manager.GetInputs(inputList);

            Assert.AreEqual(firstMove, returnedList[0].Move);

            returnedList = _manager.GetInputs(inputList);

            Assert.AreEqual(secondMove, returnedList[0].Move);

            returnedList = _manager.GetInputs(inputList);

            Assert.AreEqual(thirdMove, returnedList[0].Move);
        }
        public void SetUp()
        {
            _input         = new MockInput();
            _output        = new MockOutput();
            _menuManager   = new TestMenuManager(_input, _output);
            _chanceService = new MockChanceService();
            _battleManager = new BattleManager(_chanceService, _input, _output);

            _human     = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1);
            _humanTeam = new TestTeam(_menuManager, _human);

            _enemy     = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1);
            _enemyTeam = new Team(_menuManager, _enemy);

            _doNothingMove = (DoNothingMove)MoveFactory.Get(BattleMoveType.DoNothing);

            _restoreHealthEffect           = new RestorationBattleMoveEffect(RestorationType.Health, 5, BattleMoveEffectActivationType.OnAttackHit);
            _attackWithRestoreHealthEffect = new AttackBattleMove("foo", TargetType.SingleEnemy, 100, 10, effects: _restoreHealthEffect);

            _restoreManaEffect           = new RestorationBattleMoveEffect(RestorationType.Mana, 5, BattleMoveEffectActivationType.OnAttackHit);
            _attackWithRestoreManaEffect = new AttackBattleMove("foo", TargetType.SingleEnemy, 100, 10, effects: _restoreManaEffect);
        }
예제 #6
0
        public void SetUp()
        {
            _output        = new MockOutput();
            _input         = new MockInput();
            _menuManager   = new TestMenuManager(_input, _output);
            _chanceService = new MockChanceService();
            _battleManager = new TestBattleManager(_chanceService, _input, _output);
            _logger        = new EventLogger();

            _human     = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1);
            _enemy     = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1);
            _humanTeam = new TestTeam(_human);
            _enemyTeam = new Team(_menuManager, _enemy);

            _human.SetSpeed(10);
            _enemy.SetSpeed(0);

            doNothing = new DoNothingMove();
            _enemy.SetMove(doNothing);

            _fireballSpell = SpellFactory.GetSpell(MagicType.Fire, 1);
        }
예제 #7
0
        public void SelectMove_MultiTurnMoveSelected()
        {
            var enemy     = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1);
            var enemyTeam = new Team(_menuManager, enemy);

            var human     = (TestHumanFighter)TestFighterFactory.GetFighter(TestFighterType.TestHuman, 1);
            var humanTeam = new Team(_menuManager, human);

            var fooMove = new DoNothingMove("Foo!");
            var barMove = new DoNothingMove("Bar!");
            var bazMove = new AttackBattleMove("Baz", TargetType.SingleEnemy, 50, 100);

            var multiTurnMove = new MultiTurnBattleMove("multi turn move", TargetType.SingleEnemy,
                                                        fooMove,
                                                        barMove,
                                                        bazMove);

            enemy.SetAvailableMove(multiTurnMove);

            var selectedMove = enemy.SetupMove(enemyTeam, humanTeam);

            Assert.AreEqual(multiTurnMove, selectedMove.Move);

            var attack = MoveFactory.Get(BattleMoveType.Attack);

            enemy.SetAvailableMove(attack);

            selectedMove = enemy.SetupMove(enemyTeam, humanTeam);
            Assert.AreEqual(barMove, selectedMove.Move);

            selectedMove = enemy.SetupMove(enemyTeam, humanTeam);
            Assert.AreEqual(bazMove, selectedMove.Move);

            selectedMove = enemy.SetupMove(enemyTeam, humanTeam);
            Assert.AreEqual(attack, selectedMove.Move);
        }
예제 #8
0
 public TestDoNothingMove(DoNothingMove copy)
     : base(copy)
 {
 }