Exemple #1
0
        public void BattleManager_AppropriatelyExecutesDanceTechnique_TriggersAppropriateEvents()
        {
            _enemy1.SetMove(_testTechnique);
            _enemy1.SetSpeed(10);
            _enemy2.SetMove(_doNothingMove);

            _human1.SetMove(_basicAttack);
            _human1.SetMoveTarget(_enemy1);
            _human1.SetStrength(EnemyDefenseAfterDanceMove + _enemy1.MaxHealth);
            _human2.SetMove(_basicAttack);
            _human2.SetMoveTarget(_enemy2);
            _human2.SetStrength(EnemyDefenseAfterDanceMove + _enemy2.MaxHealth);
            _chanceService.PushEventsOccur(true, false, true, false); //set up attack hits, attack crits for both attacks

            _logger.Subscribe(EventType.FieldEffectExecuted, _battleManager);

            _battleManager.Battle(_humanTeam, _enemyTeam);

            List <EventLog> logs = _logger.Logs;

            Assert.AreEqual(2, logs.Count);

            EventLog log = logs[0];
            FieldEffectExecutedEventArgs e = log.E as FieldEffectExecutedEventArgs;

            Assert.That(e, Is.Not.Null);
            if (e != null)
            {
                Assert.AreEqual(_raiseTeamDefense50Percent, e.Effect);
                Assert.AreEqual(1, e.EffectOwners.Count);
                Assert.AreEqual(_enemy1, e.EffectOwners[0]);
            }

            log = logs[1];
            e   = log.E as FieldEffectExecutedEventArgs;
            Assert.That(e, Is.Not.Null);
            if (e != null)
            {
                Assert.AreEqual(_lowerEnemyDefense50Percent, e.Effect);
                Assert.AreEqual(1, e.EffectOwners.Count);
                Assert.AreEqual(_enemy1, e.EffectOwners[0]);
            }
        }
 private void _logFieldEffectExecuted(object sender, FieldEffectExecutedEventArgs e)
 {
     Logs.Add(new EventLog(EventType.FieldEffectExecuted, sender, e));
 }