Beispiel #1
0
        public void CorrectlyReturnsTestCombo()
        {
            CombinedFieldEffect fakeCombo = new CombinedFieldEffect("foo", new CriticalChanceMultiplierFieldEffect(TargetType.EnemyTeam, "fwop", 0, 5));

            _combiner.AddFakeCombination(DanceEffectType.Fire, DanceEffectType.Soul, fakeCombo);
            CombinedFieldEffect returnedEffect = _combiner.Combine(DanceEffectType.Fire, DanceEffectType.Soul);

            Assert.AreEqual(fakeCombo, returnedEffect);
        }
Beispiel #2
0
        public void AddFakeCombination(DanceEffectType effect1, DanceEffectType effect2, CombinedFieldEffect combinedEffect)
        {
            DanceEffectType first  = (DanceEffectType)Math.Min((int)effect1, (int)effect2);
            DanceEffectType second = (DanceEffectType)Math.Max((int)effect1, (int)effect2);

            _firstEffectType  = first;
            _secondEffectType = second;
            _effect           = combinedEffect;
        }
Beispiel #3
0
        public void BattleManager_AppropriatelyCancelsCombinationEffect_IfEitherOwnerDies()
        {
            var windDance = (TestDanceMove)TestMoveFactory.Get(moveType: BattleMoveType.Dance);

            windDance.SetDuration(2);
            windDance.SetDanceEffect(DanceEffectType.Wind);
            windDance.AddMove(_doNothingMove);
            _human1.SetHealth(100, 10);
            _human1.SetSpeed(1);
            _human1.SetMove(windDance);
            _human1.SetMoveTarget(_human1);

            var fireDance = (TestDanceMove)TestMoveFactory.Get(moveType: BattleMoveType.Dance);

            fireDance.SetDuration(2);
            fireDance.SetDanceEffect(DanceEffectType.Fire);
            fireDance.AddMove(_doNothingMove);
            fireDance.AddMove(_runawayMove);
            _human2.SetHealth(100, 10);
            _human2.SetSpeed(1);
            _human2.SetMove(fireDance);
            _human2.SetMoveTarget(_human2);

            _enemy1.SetStrength(_human1.Defense + _human1.MaxHealth + 1);
            _enemy1.SetMove(_basicAttack);
            _enemy1.SetMoveTarget(_human1);
            _chanceService.PushEventsOccur(true, false); //attack hits, not a crit

            _enemyTeam = new Team(TestMenuManager.GetTestMenuManager(), _enemy1);

            RestoreHealthPercentageFieldEffect restoreHealthEffect =
                new RestoreHealthPercentageFieldEffect(TargetType.OwnTeam, "heal dance", 20, 10);

            CombinedFieldEffect testCombo = new CombinedFieldEffect("heal dance", restoreHealthEffect);

            _combiner.AddFakeCombination(DanceEffectType.Wind, DanceEffectType.Fire, testCombo);

            BattleManagerBattleConfiguration config = new BattleManagerBattleConfiguration
            {
                FieldEffectCombiner = _combiner
            };

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

            //will be 30 if the dance effect isn't interrupted
            Assert.AreEqual(10, _human2.CurrentHealth);
        }
Beispiel #4
0
        public void TestCombineScreenOutputs()
        {
            const string doNothingMessage = "danced the foo dance";

            CombineDanceMove_Setup(doNothingMessage);

            var outputs = _output.GetOutputs();

            CombinedFieldEffect combined = _combiner.Combine(DanceEffectType.Wind, DanceEffectType.Fire);
            //The dances go for 2 turns each making 4 "danced the foo dance" messages,
            //1 more combined field effect "combined to become ____", 1 for field effect message, then 2 more for each "player was healed!"
            int expectedOutputMessages = 5 + combined.Effects.Count + 2;

            Assert.AreEqual(expectedOutputMessages, outputs.Length);

            Assert.AreEqual($"{_human1.DisplayName} {doNothingMessage}\n", outputs[0].Message);
            Assert.AreEqual($"{_human2.DisplayName} {doNothingMessage}\n", outputs[1].Message);

            Assert.AreEqual($"They combined to become {combined.Description}\n", outputs[2].Message);
        }
Beispiel #5
0
        private void CombineDanceMove_Setup(string doNothingMessage = "")
        {
            var doNothing = (TestDoNothingMove)TestMoveFactory.Get(moveType: BattleMoveType.DoNothing);

            doNothing.SetMessage(doNothingMessage);
            var windDance = (TestDanceMove)TestMoveFactory.Get(moveType: BattleMoveType.Dance);

            windDance.SetDuration(2);
            windDance.SetDanceEffect(DanceEffectType.Wind);
            windDance.AddMove(doNothing);
            windDance.AddMove(doNothing);
            _human1.SetMove(windDance, 1);
            _human1.SetMove(_runawayMove);
            _human1.SetMoveTarget(_human1);
            _human1.SetHealth(100, 10);

            var fireDance = (TestDanceMove)TestMoveFactory.Get(moveType: BattleMoveType.Dance);

            fireDance.SetDuration(2);
            fireDance.SetDanceEffect(DanceEffectType.Fire);
            fireDance.AddMove(doNothing);
            fireDance.AddMove(doNothing);
            _human2.SetMove(fireDance);
            _human2.SetMoveTarget(_human2);
            _human2.SetHealth(100, 10);

            _enemy1.SetMove(_doNothingMove);
            _enemy2.SetMove(_doNothingMove);

            CombinedFieldEffect fakeCombinedEffect = new CombinedFieldEffect("fwee", new RestoreHealthPercentageFieldEffect(TargetType.OwnTeam, "fwee", 80, immediatelyExecuted: true));

            _combiner.AddFakeCombination(DanceEffectType.Wind, DanceEffectType.Fire, fakeCombinedEffect);

            BattleManagerBattleConfiguration config = new BattleManagerBattleConfiguration
            {
                FieldEffectCombiner       = _combiner,
                ShowIntroAndOutroMessages = false
            };

            _battleManager.Battle(_humanTeam, _enemyTeam, config: config);
        }
Beispiel #6
0
        public void CorrectlyReturnsDefaultImplementation_NoTestCombosSetup()
        {
            CombinedFieldEffect returnedEffect = _combiner.Combine(DanceEffectType.Fire, DanceEffectType.Soul);

            Assert.AreEqual("courage dance", returnedEffect.Description);
        }
Beispiel #7
0
 public TestFieldEffectCombiner()
 {
     _effect = null;
 }
Beispiel #8
0
 public void ImplementEffects(CombinedFieldEffect effect, int effectDuration, IFighter dancer1, IFighter dancer2)
 {
     effect.Effects.ForEach(fe => ImplementEffect(fe, effectDuration, dancer1, dancer2));
 }