Exemple #1
0
        public void CastSpell_CorrectlyReflectsSpells([Values(MagicType.Fire, MagicType.Ice, MagicType.Lightning)] MagicType spellType,
                                                      [Values(true, false)] bool reflectAll)
        {
            const int spellCost  = 5;
            const int spellPower = 5;
            const int expectedRemainingHealth = 100 - spellPower;

            Spell      spell       = new Spell("foo", spellType, SpellType.Attack, TargetType.SingleEnemy, spellCost, spellPower);
            BattleMove runawayMove = MoveFactory.Get(BattleMoveType.Runaway);

            MagicType     reflectType = reflectAll ? MagicType.All : spellType;
            ReflectStatus status      = new ReflectStatus(1, reflectType);

            _human.SetHealth(100);
            _human.SetMana(spellCost);
            _human.SetMagicStrength(0);
            _human.SetMagicBonus(spellType, 0);
            _human.SetMagicResistance(0);
            _human.SetResistanceBonus(spellType, 0);
            _human.AddSpell(spell);
            _human.SetMove(spell, 1);
            _human.SetMove(runawayMove);
            _human.SetMoveTarget(_enemy);

            _enemy.AddStatus(status);
            _enemy.SetHealth(100);

            _battleManager.Battle(_humanTeam, _enemyTeam);

            Assert.AreEqual(_enemy.MaxHealth, _enemy.CurrentHealth, "enemy should still have full health, the spell should have been reflected!");
            Assert.AreEqual(expectedRemainingHealth, _human.CurrentHealth, "the human should have lost 5 health from being hit by their own spell!");
        }