public void CharacterHoldsActionGenerically_HeGoesAfterOtherCharactersPhaseIfHeLosesDexRoll()
        {
            //arrange
            CombatSequence sequence = Factory.SequenceWithFastMediumAndSlowCharacters;

            sequence.StartCombat();
            HeroSystemCharacter holder = sequence.ActivePhase.Character;

            HoldActionManuever held = holder.Manuevers["Hold Action"] as HoldActionManuever;

            HeroSystemCharacter attacker = sequence.NextCombatPhase.Character;
            Attack ranged = new Attack("Basic Ranged", attacker, DamageType.Normal, 5, DefenseType.PD, true);

            HeroSystemCharacter defender = sequence.NextCombatPhase.Character;

            Dice.RandomnessState = RandomnessState.average;


            //act

            held.Perform();

            ranged.Target(defender);

            holder.DEX.CurrentValue = 5;
            held.Interrupt(InterruptionWith.Generic);

            Assert.AreNotEqual(holder, sequence.ActivePhase.Character);
            Assert.AreEqual(attacker, sequence.ActivePhase.Character);

            sequence.CompleteActivePhase();
            Assert.AreEqual(holder, sequence.ActivePhase.Character);
        }
        public void MoreThanOneCharacterTriesToUseHeldActionAtSameTime_CharacterWhoWinsDexRollGoesFirst()
        {
            //arrange
            CombatSequence sequence = Factory.SequenceWithFastMediumAndSlowCharacters;

            sequence.StartCombat();
            HeroSystemCharacter holder1 = sequence.ActivePhase.Character;


            HeroSystemCharacter holder2 = sequence.ActiveSegment.PhaseNextInDexOrder.Character;

            HoldActionManuever held1 = holder1.Manuevers["Hold Action"] as HoldActionManuever;

            held1.DexWaitingFor = 10;

            HoldActionManuever held2 = holder2.Manuevers["Hold Action"] as HoldActionManuever;

            held2.DexWaitingFor = 10;


            held1.Perform();
            holder1.DEX.CurrentValue = 30;

            held2.Perform();

            Dice.RandomnessState = RandomnessState.average;

            Assert.AreEqual(holder1, sequence.ActivePhase.Character);
            sequence.CompleteActivePhase();

            Assert.AreEqual(holder2, sequence.ActivePhase.Character);
        }
        public void CharacterHoldsActionGenerically_HeCanInteruptOtherCharactersPhaseOnlyIfHeWinsDexRoll()
        {
            //arrange
            CombatSequence sequence = Factory.SequenceWithFastMediumAndSlowCharacters;

            sequence.StartCombat();
            HeroSystemCharacter holder = sequence.ActivePhase.Character;

            HoldActionManuever held = holder.Manuevers["Hold Action"] as HoldActionManuever;

            HeroSystemCharacter attacker = sequence.NextCombatPhase.Character;
            Attack ranged = new Attack("Basic Ranged", attacker, DamageType.Normal, 5, DefenseType.PD, true);

            HeroSystemCharacter defender = sequence.NextCombatPhase.Character;

            Dice.RandomnessState = RandomnessState.average;


            //act

            held.Perform();
            ranged.Target(defender);
            held.Interrupt(InterruptionWith.Generic);

            //assert
            Assert.AreEqual(holder, sequence.ActivePhase.Character);
            Assert.AreEqual(sequence.ActivePhase, held.HeldPhase);
            Assert.AreEqual(sequence.InterruptedPhase.Character, attacker);
            Assert.AreEqual(sequence.InterruptedPhase.PhaseLeft, 1);
        }
        public void CharacterUsingHeldDefensiveAction_AlwaysGoesBeforeOtherHeldOrInterruptedActions()
        {
            //arrange
            CombatSequence sequence = Factory.SequenceWithFastMediumAndSlowCharacters;

            sequence.StartCombat();
            HeroSystemCharacter holder1 = sequence.ActivePhase.Character;


            HeroSystemCharacter attacker = sequence.ActiveSegment.PhaseNextInDexOrder.Character;

            HoldActionManuever held1 = holder1.Manuevers["Hold Action"] as HoldActionManuever;

            held1.Perform();

            Attack attack = attacker.Manuevers["Strike"] as Attack;

            attack?.Target(holder1);

            holder1.DEX.CurrentValue = 10;
            held1.Interrupt(InterruptionWith.Defensive);

            Assert.AreEqual(holder1, sequence.ActivePhase.Character);
        }