Exemplo n.º 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!");
        }
Exemplo n.º 2
0
        public void DoesNotCounter_EvadedMove()
        {
            _humanFighter.AddStatus(_status);
            _enemy.AddStatus(_status);

            _humanFighter.SetDefense(_enemy.Strength);
            _humanFighter.SetMove(_doNothing, 1);
            _humanFighter.SetMove(_runawayMove);

            _enemy.SetMove(_basicAttackMove);
            _enemy.SetHealth(_humanFighter.Strength + 1);
            _chanceService.PushEventsOccur(false); //attack misses

            _battleManager.Battle(_humanTeam, _enemyTeam);

            Assert.AreEqual(_enemy.MaxHealth, _enemy.CurrentHealth);
        }
        public void MoveWithNeverMissEffect_CanStillBeEvaded()
        {
            _human.SetMove(_attackWithNeverMissEffect, 1);
            _human.SetMoveTarget(_enemy);
            _chanceService.PushEventsOccur(false); //just check the crit
            _human.SetMove(_runawayMove);

            AutoEvadeStatus autoEvadeStatus = new AutoEvadeStatus(1, false);

            _enemy.AddStatus(autoEvadeStatus);
            _enemy.SetMove(_doNothingMove);

            _battleManager.Battle(_humanTeam, _enemyTeam);

            Assert.AreEqual(_enemy.MaxHealth, _enemy.CurrentHealth, "Enemy should have evaded the never-miss attack and escaped at full health!");
        }
Exemplo n.º 4
0
        public void MoveWithCannotBeEvadedEffect_HitsOpponentThatEvaded()
        {
            CannotBeEvadedBattleMoveEffect cannotBeEvadedEffect = new CannotBeEvadedBattleMoveEffect();
            AttackBattleMove noEvadeAttack = new AttackBattleMove("foo", TargetType.SingleEnemy, 100, 10, effects: cannotBeEvadedEffect);

            _human.SetMove(noEvadeAttack, 1);
            _human.SetMove(_runawayMove);
            _human.SetMoveTarget(_enemy);
            _chanceService.PushAttackHitsNotCrit(); //attack hits, not a crit

            AutoEvadeStatus autoEvadeStatus = new AutoEvadeStatus(1, false);

            _enemy.AddStatus(autoEvadeStatus);
            _enemy.SetMove(_doNothingMove);
            _enemy.SetHealth(_human.Strength + 1);

            _battleManager.Battle(_humanTeam, _enemyTeam);

            Assert.AreEqual(1, _enemy.CurrentHealth, "attack should have hit even though enemy had an AutoEvade status!");
        }
Exemplo n.º 5
0
        public void ConditionalEffect_AppropriatelySuppressed_WhenNotEvadedConditionNotMet([Values(10, 20)] int percentage)
        {
            AttackBattleMove conditionalHealMove = GetNotEvadeRestoreHealthAttack(percentage);

            _team1Fighter.SetHealth(100, 10);
            _team1Fighter.SetMove(conditionalHealMove, 1);
            _team1Fighter.SetMoveTarget(_team2Fighter);
            _team1Fighter.SetMove(_runawayMove);

            _chanceService.PushAttackHitsNotCrit();

            AutoEvadeStatus autoEvadeStatus = new AutoEvadeStatus(1, false);

            _team2Fighter.AddStatus(autoEvadeStatus);
            _team2Fighter.SetHealth(100);
            _team2Fighter.SetMove(_doNothingMove);

            _battleManager.Battle(_team1, _team2);

            int expectedRemainingHealth = 10;

            Assert.AreEqual(expectedRemainingHealth, _team1Fighter.CurrentHealth, "The enemy had evade status, so the user should not have regained any HP");
        }