Esempio n. 1
0
        public void SpecialMoveFailedEvent_RaisedWhenShieldBusterFails_BusterPowerLessThanShieldBusterDefense()
        {
            _logger.Subscribe(_humanFighter, EventType.SpecialMoveFailed);

            IronBattleShield shield = new IronBattleShield(5, 5, 3, 2);

            _enemy.SetBattleShield(shield);

            Assert.NotNull(_enemy.BattleShield);

            ShieldBusterMove shieldBuster = new ShieldBusterMove("shieldBuster", TargetType.SingleEnemy, null, 1);

            _humanFighter.SetMove(shieldBuster, 1);
            _humanFighter.SetMoveTarget(_enemy);
            _humanFighter.SetMove(_runawayMove);

            _enemy.SetMove(_doNothingMove);

            _battleManager.Battle(_humanTeam, _enemyTeam);

            List <EventLog> logs = _logger.Logs;

            Assert.AreEqual(1, logs.Count);

            EventLog log = logs[0];

            Assert.AreEqual(EventType.SpecialMoveFailed, log.Type);

            SpecialMoveFailedEventArgs e = log.E as SpecialMoveFailedEventArgs;

            Assert.NotNull(e);
            Assert.AreEqual(SpecialMoveFailedReasonType.ShieldBusterDefenseHigherThanShieldBusterPower, e.Reason);
        }
Esempio n. 2
0
        public void ShieldBusterMove_CannotBustShieldsWithHigherShieldBusterDefense()
        {
            IronBattleShield shield = new IronBattleShield(5, 5, 3, 2);

            _enemy.SetBattleShield(shield);

            Assert.NotNull(_enemy.BattleShield);

            ShieldBusterMove shieldBuster = new ShieldBusterMove("shieldBuster", TargetType.SingleEnemy, null, 1);

            _humanFighter.SetMove(shieldBuster, 1);
            _humanFighter.SetMoveTarget(_enemy);
            _humanFighter.SetMove(_runawayMove);

            _enemy.SetMove(_doNothingMove);

            _battleManager.Battle(_humanTeam, _enemyTeam);

            Assert.NotNull(_enemy.BattleShield);
        }
Esempio n. 3
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);
        }