Exemplo n.º 1
0
        public void Level1ShieldGuy_CorrectlyDeterminesViableMoves_AllAlliesWithFullyHealedShields()
        {
            IronBattleShield shield = new IronBattleShield(1, 1, 0);

            _level1ShieldGuy.SetBattleShield(shield);
            _ally1.SetBattleShield(shield);
            _ally2.SetBattleShield(shield);

            _chanceService.PushWhichEventsOccur(0);
            BattleMove returnedMove = _level1ShieldGuy.SelectMove(_shieldGuyTeam, _humanTeam);

            double[] lastEventOccursArgs = _chanceService.LastEventOccursArgs;

            Assert.AreEqual(2, lastEventOccursArgs.Length);
            Assert.AreEqual(0.2, lastEventOccursArgs[0]);
            Assert.AreEqual(0.8, lastEventOccursArgs[1]);

            Assert.AreEqual(BattleMoveType.Attack, returnedMove.MoveType);

            _chanceService.PushWhichEventsOccur(1);
            returnedMove = _level1ShieldGuy.SelectMove(_shieldGuyTeam, _humanTeam);
            ShieldFortifyingMove shieldFortifyingMove = returnedMove as ShieldFortifyingMove;

            Assert.NotNull(shieldFortifyingMove);
            Assert.AreEqual(ShieldFortifyingType.Defense, shieldFortifyingMove.FortifyingType);
        }
Exemplo n.º 2
0
        public void BattleManager_CorrectlyPrintsMessages_TargetHasShield([Values("eats pudding", null)] string executionMessage)
        {
            const int        shieldDefense    = 5;
            const int        shieldHealth     = 1;
            IronBattleShield shield           = new IronBattleShield(shieldHealth, shieldDefense, 0);
            ShieldBusterMove shieldBusterMove = new ShieldBusterMove("foo", TargetType.SingleEnemy, executionMessage);

            _humanFighter.SetSpeed(1);
            _humanFighter.SetMove(shieldBusterMove, 1);
            _humanFighter.SetMove(_runawayMove);
            _humanFighter.SetMoveTarget(_enemy);

            _enemy.SetBattleShield(shield);
            //_logger.SubscribeAll(_enemy.BattleShield);
            _enemy.SetMove(_doNothingMove);

            BattleManagerBattleConfiguration config = new BattleManagerBattleConfiguration
            {
                ShowIntroAndOutroMessages = false
            };

            _battleManager.Battle(_humanTeam, _enemyTeam, config: config);

            MockOutputMessage[] outputs = _output.GetOutputs();

            int expectedLength = 1;

            if (executionMessage != null)
            {
                expectedLength++;
            }
            Assert.AreEqual(expectedLength, outputs.Length);

            int i = 0;

            if (executionMessage != null)
            {
                Assert.AreEqual($"{_humanFighter.DisplayName} {executionMessage}!\n", outputs[i++].Message);
            }
            Assert.AreEqual($"{_enemy.DisplayName}'s shield was destroyed!\n", outputs[i].Message);
        }